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

delete_ns blocks thread indefinitely #311

Closed
LambdaSpg opened this issue Apr 22, 2024 · 1 comment · Fixed by #316
Closed

delete_ns blocks thread indefinitely #311

LambdaSpg opened this issue Apr 22, 2024 · 1 comment · Fixed by #316
Assignees
Labels
C-Bug Something isn't working

Comments

@LambdaSpg
Copy link

Describe the bug
Calling delete_ns blocks the thread because the RWLock does not get released after going out of scope

To Reproduce

    let io_clone = Arc::new(io.clone());
    io.ns("/", move |socket_ref: SocketRef| {
        info!("Connected!");
        socket_ref.on_disconnect(move || {
            io_clone.delete_ns("/");
            info!("This won't run, because the thread is blocked by RWLock");
        })
    });

Connect a client on '/', disconnect it, and the info won't get called. After that, the server does not work anymore and won't accept new connections.

Expected behavior
The server should continue running like usual

Versions (please complete the following information):

  • Socketioxide version: 0.12.0
  • Http lib: 0.7.5
  • Socket.io client version ^4.7.5
@LambdaSpg LambdaSpg added the C-Bug Something isn't working label Apr 22, 2024
@Totodore
Copy link
Owner

Hey, indeed, there is a deadlock when you call delete_ns from on_disconnect because the Namespace RwLock is currently being readen. I'll try to fix this ASAP and also add a test case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants