Bug #511

misbehavior of function VFSFile::fread(...)

Added by Andrey Karpenko over 2 years ago. Updated over 2 years ago.

Status:Closed Start date:February 27, 2015
Priority:Major Due date:
Assignee:- % Done:

100%

Category:plugins/gio
Target version:3.6.1
Affects version:3.6

Description

System: 3.16.0-30-generic #40-Ubuntu SMP Mon Jan 12 22:06:37 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
and 3.13.0-46-generic #75-Ubuntu SMP Tue Feb 10 15:24:04 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Description: misbehavior of function VFSFile::fread(...) in case of read from smb:// file server

Log message:
ERROR vfs_local.cc:116 [vfs_local_fopen]: smb://192.168.2.148/share/Music/Sandra.The.Platinum.Collection.(3CD).2009.Ape.Cue.Lossless/CD2/Sandra - Platinum Collection.ape: No such file or directory

Workaround: Use symlink to gvfs folder to access network files or use retry logic in the code

int XXX::Read(void * pBuffer, unsigned int nBytesToRead, unsigned int * pBytesRead) {
if(vfs!=0) {
int64_t cur = vfs-> ftell();
*pBytesRead = (unsigned int)vfs->fread(pBuffer, 1, nBytesToRead);
if(nBytesToRead > *pBytesRead) {
if(!vfs ->feof()) {
AUDERR;
AUDERR;
if(!vfs -> fseek(cur, VFSSeekType::VFS_SEEK_SET)) {
*pBytesRead = (unsigned int)vfs->fread(pBuffer, 1, nBytesToRead);
AUDERR;
}
}
}
return 0;
}
return 1;
}

In case of workaround use the log looks like:

ERROR newplugin.cc:156 [Read]: Requested 16320 bytes, actually read 64 bytes
ERROR newplugin.cc:158 [Read]: Trying to retry from the last place
ERROR newplugin.cc:162 [Read]: After second attempt read 16256 bytes

Note: It is possible to play files from the same server without any issues with different names
Thanks in advance

Audacious3.6.log (17.5 kB) Andrey Karpenko, February 28, 2015 16:14

Associated revisions

Revision e4475c8b
Added by John Lindgren over 2 years ago

gio: Avoid returning partial data from fread(). Closes: #511.

Revision 8e2d74d7
Added by John Lindgren over 2 years ago

gio: Avoid returning partial data from fread(). Closes: #511.

History

#1 Updated by John Lindgren over 2 years ago

I don't understand this bug report at all. There is no file named newplugin.cc in Audacious or Audacious Plugins; what code are you changing? And how does adding retry logic have anything to do with a "No such file or directory" error?

#2 Updated by Andrey Karpenko over 2 years ago

Hi John,
I have wrote two new plugins for your great and very nice player version 3.4.x . There were some reasons to write these plugins. I can explain why if you are interested in to know it.
It was tested a lot of time. Everything was fine it works on intel and arm32 platforms.

Yesterday I have ported the old code to new version of Audacious. And a strange behavior of the Monkey's Audio plugin was found.

Please, take a look at the code on https://github.com/wknightbor/Additional-plugins-for-Audacious-3.6

mac.cc line 147 (retry logic)

Please, find attached log.

If you suppose it isn't a fread function problem, Please, help me to fix it.
I believe I have found something helpful to improve the player.

Thanks in advance
Andrey

#3 Updated by John Lindgren over 2 years ago

  • Category set to plugins/gio

Okay, the part about the retry logic makes sense now. I expect we need to implement a loop around g_input_stream_read() in the GIO plugin. I assumed that g_input_stream_read() would behave like POSIX fread() and read as many bytes as requested, but it appears that this is not the case.

I still don't understand the part about the "No such file or directory" error. Are you thinking this error is due to a problem in Audacious, or was it just mentioned because it happened to be in the log?

#4 Updated by Andrey Karpenko over 2 years ago

Hi John

I still don't understand the part about the "No such file or directory" error. Are you thinking this error is due to a problem in Audacious, or was it just mentioned because it happened to be in the log?

Now I know there was two issues. The second was not because of player.
The error "No such file or directory" is not relevant.
Thanks

#5 Updated by John Lindgren over 2 years ago

Fixed in Git.

#6 Updated by John Lindgren over 2 years ago

  • Status changed from New to Closed
  • Target version set to 3.6.1
  • % Done changed from 0 to 100

Also available in: Atom PDF