Skip to content

BaseSocketChannel: assert(self.lifecycleManager.isActive) hit when running NIO tests in sandbox #2465

@weissi

Description

@weissi

I hit this assertion

assert(self.lifecycleManager.isActive)

when running the NIO tests in a tight sandbox. Output

     Test Suite 'All tests' started at 2023-07-11 05:46:11.149.
     Test Suite 'swift-nioPackageTests.xctest' started at 2023-07-11 05:46:11.153.
     Test Suite 'AcceptBackoffHandlerTest' started at 2023-07-11 05:46:11.154.
     Test Case '-[NIOPosixTests.AcceptBackoffHandlerTest testChannelInactiveCancelScheduled]' started.
     swift-nio/Tests/NIOPosixTests/AcceptBackoffHandlerTest.swift:268: error: -[NIOPosixTests.AcceptBackoffHandlerTest testChannelInactiveCancelScheduled] : XCTAssertNoThrow failed: threw error "bind(descriptor:ptr:bytes:): Operation not permitted (errno: 1)"
     NIOPosix/BaseSocketChannel.swift:1077: Assertion failed

The sandbox disallows bind and other network related stuff. So it's expected that the tests fail but I wouldn't expect an assertion to be hit.

This can probably be tested with the SAL (syscall abstraction layer) because that should make it easy to make bind fail with EPERM (== 1).

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugFeature doesn't work as expected.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions