This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


From: Corinna Vinschen [mailto:corinna-cygwin@cygwin.com]
Sent: Tuesday, October 27, 2015 10:53
To: cygwin@cygwin.com
Subject: Re: gawk: Bad File Descriptor error with concurrent readonly access to a network file
 (Snip)
> 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.

Here is the portion of strace output where IMHO the error occurs. The behaviour is quite different when running with strace, so I hope it is the same error situation, but at least the message given is "Bad file descriptor".
I changed the paths to ???. This is strace --mask=syscall. If you need further info I would appreciate to send it directly to you since there is a lot of info in strace I do not want to put into the www:

  197   70416 [main] gawk 3844 open: 3 = open(???\datafile.txt, 0x8000)
  327   70743 [main] gawk 3844 fcntl64: 0 = fcntl(3, 1, 0x0)
  265   71008 [main] gawk 3844 fcntl64: 0 = fcntl(3, 2, 0x1)
 3298   74306 [main] gawk 3844 fhandler_base::fstat_helper: 0 = fstat (\??\???\datafile.txt, 0x8004AEF8) st_size=135, st_mode=0100644, st_ino=281474976912276st_atim=551A9D6D.BD48F54 st_ctim=5603C3F5.26F49798 st_mtim=54E1ECAE.B2A66C8 st_birthtim=551A9D6D.BD48F54
  206   74512 [main] gawk 3844 fstat64: 0 = fstat(3, 0x8004AEF8)
  216   74728 [main] gawk 3844 isatty: 0 = isatty(3)
 1887   76615 [main] gawk 3844 fhandler_base::fstat_helper: 0 = fstat (\??\???\datafile.txt, 0x8004AEF8) st_size=135, st_mode=0100644, st_ino=281474976912276st_atim=551A9D6D.BD48F54 st_ctim=5603C3F5.26F49798 st_mtim=54E1ECAE.B2A66C8 st_birthtim=551A9D6D.BD48F54
  241   76856 [main] gawk 3844 fstat64: 0 = fstat(3, 0x8004AEF8)
  304   77160 [main] gawk 3844 read: read(3, 0x8004AF90, 135) blocking
 1722   78882 [main] gawk 3844 seterrno_from_nt_status: /home/corinna/src/cygwin/cygwin-1.7.33/cygwin-1.7.33-1.i686/src/src/winsup/cygwin/fhandler.cc:276 status 0xC0000128 -> windows error 6
  210   79092 [main] gawk 3844 geterrno_from_win_error: windows error 6 == errno 9
  170   79262 [main] gawk 3844 read: -1 = read(3, 0x8004AF90, -1), errno 9

A successful call goes on after the "read: read(3, ..., 135)" like this:
  129  187614 [main] gawk 4452 fhandler_base::read: returning 135, text mode
  147  187761 [main] gawk 4452 read: 135 = read(3, 0x8004AF80, 135)
  181  187942 [main] gawk 4452 read: read(3, 0x8004AF80, 135) blocking
  130  188072 [main] gawk 4452 fhandler_base::read: returning 0, text mode
  150  188222 [main] gawk 4452 read: 0 = read(3, 0x8004AF80, 0)
  350  188572 [main] gawk 4452 close: close(3)
  163  188735 [main] gawk 4452 fhandler_base::close: closing '???/datafile.txt' handle 0x12C

Thanks, Wolfgang

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]