-
Notifications
You must be signed in to change notification settings - Fork 3
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
{ kind: Interrupted, error: "Mailbox has closed" } #7
Comments
Hi, I did a quick test on my side but I can't repro this issue. Can you provide more info about:
In the mainwhile I created 2 tests: Line 305 in fe77cf0
This test connects to the MQTT server(I'm using mosquitto) for 5 times and send random packet Line 410 in fe77cf0
Both tests are running fine on my side(MacOS 10.15.3), can you also try to run those tests on your side and see if it works? |
Thank you for your quick response:
appreciate you shared your test code. let me follow your pattern exactly and try it. |
after look at your code more closely, I understood why you add this sender, but it seems like my issue will not be impacted by this one. let me install a broker in my local computer and test your code. |
running 4 tests Your test code seems like failed on my local. message from mosquitto console: |
if I only run test_client case, it's success.
but if I only run `cargo test random_test', it will fail:
|
The random tests are actually infinite loops which sends the random packets forever so they won't actually "pass" the tests :). Looks like you are doing exactly the same as RUST_LOG=info cargo test test_random_publish_level0_created_client -- --nocapture And see if there are any error logs? If everything goes fine you will only get "INFO" logs like this:
If you find any error logs please paste them here and I can take a look. Or if you can share the full code snippet which you use to connect to local MQTT server I can also check what's happening. |
Thank you. I didn't find any error log. let me clean up my code and narrow down issue scope. if issue persists, I will send to you and appreciate you help in advance. |
Hi, I created a repo: https://github.com/xudesheng/actixmqtttest main binary: actixmqtttest, I modified your sample code but it always fail. I also run single in two separated instances and point to different devices, it works as expected.
I included error log in repo too. appreciate your help. |
hi, I compared your working/not working code and find that the client name of the not working one is wrong: let mut client = MqttClient::new(
r,
w,
format!("test_{}", client_id), // THIS LINE
mqtt_option,
MessageActor(sender.clone()).start().recipient(),
ErrorActor.start().recipient(),
None,
); It should just be I also made some improvement for multi-client support of the library and published v0.4.0, you can also have a try :). |
Shame! I wasted whole day there. |
@Syndim , sorry, one more question needs your help. Appreciate.
appreciate you can give some hit. |
@xudesheng sorry I don't have much experience about it. I think the event loop itself is single threaded but the executors aren't so I guess it may not be a big issue? |
I will run some benchmark test. I have used another lib 'mqtt-async-client' and have to lunch multiple threads and use tokio::local in each thread. |
First step, I added a loop to continuously publish message and it works:
`
let mut total_count = 0;
let mut rng = rand::thread_rng();
`
second step is to simulate multiple client by adding a for loop
`
for client in clients {
}
`
After adding a for loop, all clients will only be able to send out first message and then Actor will stop. Error message is
Custom { kind: Interrupted, error: "Mailbox has closed" }
. I couldn't figure out why Actor was stopped.Appreciate your help.
The text was updated successfully, but these errors were encountered: