I'm trying to use IOCP
to do async file reads.
This works fine 99% of the time.. but that 1% of the time a request seems to never finish and so the operation just waits forever.
The sequence of API calls for the file that hangs is
# Time of Day Relative Time Thread Module Category API Return Value Error Duration
1160 4:14:50.142 PM 0:00:00:308 1 ghc-stage2.exe File Management CreateFileW ( "\\?\<path>\llvm-targets", GENERIC_READ, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED | FILE_FLAG_SEQUENTIAL_SCAN, NULL ) 0x00000000000001f0 0.0001230
1173 4:14:50.143 PM 0:00:00:309 1 ghc-stage2.exe File Management CreateIoCompletionPort ( 0x00000000000001f0, 0x00000000000001e4, 496, 0 ) 0x00000000000001e4 0.0000407
1179 4:14:50.143 PM 0:00:00:309 1 ghc-stage2.exe File Management GetFileType ( 0x00000000000001f0 ) FILE_TYPE_DISK 0.0000039
1190 4:14:50.143 PM 0:00:00:309 1 ghc-stage2.exe File Management SetFileCompletionNotificationModes ( 0x00000000000001f0, 3 ) TRUE 0.0000075
1224 4:14:50.144 PM 0:00:00:310 1 ghc-stage2.exe Error Handling GetLastError ( ) ERROR_IO_PENDING 0.0000009
1223 4:14:50.143 PM 0:00:00:309 1 ghc-stage2.exe File Management ReadFile ( 0x00000000000001f0, 0x00000000074d7010, 8192, NULL, 0x00000000073670e0 ) FALSE 997 = Overlapped I/O operation is in progress. 0.0000811
1276 4:14:50.144 PM 0:00:00:310 5 ghc-stage2.exe File Management GetQueuedCompletionStatusEx ( 0x00000000000001e4, 0x0000000007406340, 64, 0x0000000007367140, INFINITE, FALSE )
Even when reading files one at a time this seems to happen and I'm not sure why. I initially thought that the pointer containing the LPOVERLAPPED_ENTRY
structure may be becoming invalid, but checking the location with gdb
shows it's still good.
(gdb) x/12w 0x0000000007406340
0x7406340: 0x00000000 0x00000000 0x00000000 0x00000000
0x7406350: 0x00000000 0x00000000 0x00000000 0x00000000
0x7406360: 0x00000000 0x00000000 0x00000000 0x00000000
Does anyone have any idea what might be going on?
User contributions licensed under CC BY-SA 3.0