Skip to content

IORing: blockingConsumeCompletions() drops context on error #364

Description

@glessard

Issue exposed as a test case:

extension IORingTests {
  func testMinimalContextLoss() throws {
    var ring = try IORing(queueDepth: 4)
    _ = try ring.submit(
      linkedRequests: .close(FileDescriptor(rawValue: -1), context: 42)
    )
    var received: UInt64? = nil
    ring.blockingConsumeCompletions { completion, _, _ in
      received = completion?.context
    }
    XCTAssertEqual(received, 42)  // fails: received is nil
  }
}

The completion handler runs, but completion is nil so there is no relation to the initial request. If the close() operation had succeeded, completion would be non-nil and the context would be available.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions