-
Notifications
You must be signed in to change notification settings - Fork 8
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
queued messages never go out sometimes #16
Comments
Digging a bit more and adding some debug statements into interface.py It looks like I wonder if this is related to asyncio looping not happening?
|
I think I might have gotten it working. I changed the line here: aprsd is a threaded app. |
Right, didn't even think about testing thread safety… so your mileage may vary. Might be safer to pass a reference to the def _do_transmit():
interface.transmit(*args, **kwargs)
loop.call_soon_threadsafe(_do_transmit) That at least all the |
can I submit a PR to change that call to call_soon_threadsafe ? |
Well, we could do that… but as I say it may take more than changing one line to make the library truly thread-safe as it was written from the assumption of being used in a single-threaded asynchronous application. If two threads called https://github.com/sjlongland/aioax25/blob/master/aioax25/kiss.py#L615-L620 … both will start appending their data to the same output buffer … https://github.com/sjlongland/aioax25/blob/master/aioax25/kiss.py#L219-L233 You'll note there's no semaphores there, so it's possible two frames may be mixed up together leading to unpredictable results. It's worth noting that The answer may to look at whether a decorator function can be applied to the methods that can be applied to the relevant methods so that if you call it from a second thread, it does something like the above to schedule the call to take place in the other thread. |
https://github.com/agronholm/asyncio_extras/blob/master/asyncio_extras/threads.py#L143-L174 looks like a starting point -- not sure if I'd pull in the entire library (it hasn't been changed in years, maybe because it's unmaintained, or maybe it just hasn't needed changes), but that might be adaptable into a suitable format. |
hey thanks for the update for version 0.0.11.
I'm seeing some weird behavior at times. I am connecting to direwolf over tcpkiss and there are times
when I send a message to aioax25, and I the debugging output shows that the packet is added to the send queue.
Then it never goes out
When I then send a message to direwolf from my radio, kiss gets that message and then sends it to aprsd, and then I see
the queued up messages in aioax25 go out to direwolf and then out to RF finally.
Is there some reason you can think of that the messages get stuck in the queue and don't go to direwolf?
then 2 minutes later since aprsd didn't get an ack, it sends it again. It doesn't actually go out to direwolf and RF until direwolf gets a packet from RF to kiss to aprsd.
The text was updated successfully, but these errors were encountered: