gawk: Bad File Descriptor error with concurrent readonly access to a network file

Corinna Vinschen corinna-cygwin@cygwin.com
Tue Oct 27 13:21:00 GMT 2015


On Sep 25 16:31, Vermessung AVT - Wolfgang Rieger wrote:
> 1) Concurrent read access to the setup files was possible and worked
> fine with local files (24 hrs testing with millions of file accesses
> in 4 parallel jobs).
> 2) However, when the file to be read (datafile.txt) is stored on a
> network share on a file server - which is the case in our working
> environment - the error could be reproduced. The number of Bad file
> descriptor errors seems to be related to the work load at the server
> where the file resides.
> 3) The MS copy command shows no such error, even with network files.
> So we can substitute the cat's by copy's. For gawk, however, there is
> no shell alternative.
> 
> It looks like there is a small time frame in opening files when the
> server file is non-accessible to other processes. If a parallel job
> happens to access the same file within that short time period while
> another process is opening it, the "Bad File Descriptor" error is
> thrown.

Cygwin uses full sharing for all files it opens, unless the file is
opened in very specific circumstances (e.g, creating a symlink, deleting
a file).  "Bad file descriptor" doesn't point to a sharing problem.
It seems the handle is unusable or something.

I tried your testcase and I can't reproduce the problem in my
environment.  Have you tried catching a trace of the problem via
strace?  It would be helpful to see where the EBADF occurs.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20151027/560a024f/attachment.sig>


More information about the Cygwin mailing list