Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deadlock when stopping a hubConnection if the WebSocket did not start #91

Closed
moozzyk opened this issue Mar 1, 2020 · 0 comments
Closed

Comments

@moozzyk
Copy link
Owner

moozzyk commented Mar 1, 2020

This test consistently reproduces the @datwelk's issue:

    func testThatDeadlockDoesNotHappen() {
        let didStop = expectation(description: "connection stopped")
        let hubConnectionDelegate = TestHubConnectionDelegate()
        hubConnectionDelegate.connectionDidCloseHandler = { error in
            XCTAssertNil(error)
            didStop.fulfill()
        }

        let hubConnection = HubConnectionBuilder(url: URL(string: "\(BASE_URL)/testhub")!)
            .withLogging(minLogLevel: .debug)
            .withHubConnectionDelegate(delegate: hubConnectionDelegate)
            .withHttpConnectionOptions(configureHttpOptions: {options in
                options.skipNegotiation = true
            })
            .build()
        hubConnection.start()
        hubConnection.stop()

        waitForExpectations(timeout: 5 /*seconds*/)
    }

stop is blocked on waiting for start to complete:

start cannot complete because neither of open, error, close events were fired because they want to by default run on the main thread as per:

/// The queue for firing off events. default is main_queue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant