Skip to content

Win32 potential resource handling and timeout issue with async I/O #1574

@dcoutts

Description

@dcoutts

ouroboros-network/Win32-network/src/System/Win32/Async.hs implements readHandle by initiating an async read then calling waitForCompletion, which will, via an MVar, wait for
c_GetQueuedCompletionStatus to complete in another thread, which passes in maxBound for timeout, which will be passed to HsGetQueuedCompletionStatus and then GetQueuedCompletionStatus, which can result in an infinite wait. ouroboros-network/Win32-network/test/Test/Async.hs includes a test interrupting this operation by calling killThread, which in combination with the surrounding code will close all the pipe and port handles. Although closing all related handles will break the infinite wait, it is a blunt hammer. Instead, prefer CancelIoEx to cancel a request individually or use timed instead of infinite waits.

As reported by Root9B.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions