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

[Soundness] Callbacks are run on different threads, but are not required to be Send #182

Closed
Alxandr opened this issue Dec 21, 2022 · 1 comment
Assignees
Labels
fix added A fix was added to an unreleased branch
Milestone

Comments

@Alxandr
Copy link

Alxandr commented Dec 21, 2022

I've been trying to figure out a bug I had using paho-mqtt, where I couldn't spawn local tasks in a LocalSet from tokio, so I decided to add some logging of the current thread ID:

        println!("thread-id: {:?}", std::thread::current().id());
        let not_send = NotSendValue;

		client.set_connected_callback({
			move |c| {
				println!("thread-id: {:?}{:?}", std::thread::current().id(), NotSendValue);
            }
        });

This results in printing two different thread numbers (18 and 20 in my specific case), and I'm allowed to use my not_send value from both threads, which is unsound.

@Alxandr Alxandr changed the title Callbacks are run on different threads, but are not required to be Send [Soundness] Callbacks are run on different threads, but are not required to be Send Dec 21, 2022
@fpagliughi
Copy link
Contributor

Yes! d9cecc4 should fix it.

@fpagliughi fpagliughi self-assigned this Jan 7, 2023
@fpagliughi fpagliughi added the fix added A fix was added to an unreleased branch label Jan 7, 2023
@fpagliughi fpagliughi added this to the v0.12.0 milestone Jan 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix added A fix was added to an unreleased branch
Projects
None yet
Development

No branches or pull requests

2 participants