-
Notifications
You must be signed in to change notification settings - Fork 102
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
segfault in paho_mqtt::async_client::Token::on_complete #46
Comments
Which version of the crate are you using, the released v0.5? The latest 'develop' branch? Or something else? The new code, which will hopefully be released soon as v0.6 is a big rewrite of the Token internals. They are now futures... which should interact well with tokio. But the API is fairly backward compatible as well. I'm also looking in to a bug in the underlying Paho C library which could segfault. A fix for that is due to be released shortly. |
ahh sorry, release
interesting, when i find a moment i’ll have a go at a minimum reproduction to see whether i can determine if the issue occurs without tokio, just needed to get this submitted before i left the office. |
I just updated the code on GitHub (master and release) to use Paho C v1.3.1. |
I assume this got fixed in v0.6. Re-open if not. |
i tried the updated version and it appears to segfault on connect, but, haven't had time to dig into whether it's the same or a different issue. will re-open or open a new issue when i have a chance ^_^ |
If you're using the default persistence and there's a persistence subdirectory, with a name something like It could be this: |
Oh. OK. I think I found it. It seems to be a problem with the pre-generated bindings on 32-bit targets. See #62. You can can do a quick test by adding the "build_bindgen" feature to the crate in your cargo file. In the next rev, I'm going to move to target-specific bindings to fix this. As this is ongoing, I'll reopen the issue. Let us know how it works out. |
ahh, important detail i completely forgot (sorry!) from the last comment is that this is cross built for building with
|
Yeah, this definitely looks like the same binding problem I just had. Due to the incorrect word sizes, pointers are mis-aligned in the structs coming back from the C lib. If you look at the address of the string getting passed to strlen(), it could be something like 0x04, or some other non-sensical value for an address. I just went through and generated a bunch of bindings for different targets, including 32 and 64-bit ARM boards, but I was kinda lazy and just did them all natively on the different boards. I wonder if the problem is from cross-compiling. Maybe bindgen is using the word size of the host and not the target? I'll look into that. |
This should be fixed by the target-specific bindings going in to v0.7 |
I think there's still an inherent problem cross-compiling with bindgen, but when cross-compiling using the pre-built bindings, it does now get the word size correct, which was the main initial problem here. So far it has been working pretty well. If something else comes up, feel free to re-open this or start another issue. |
Using a
paho_mqtt::Client
from anactix::Actor
causes surprise segfaults whenautomatic_reconnect
is specified and the initial connection fails.Manually managing connection state appears to resolve the issue.
I'm not sure if this is an interaction with the actix/tokio runtime or a standalone issue with the library.
Backtrace from the offending thread(s):
The text was updated successfully, but these errors were encountered: