-
Notifications
You must be signed in to change notification settings - Fork 22
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
Strange segfault with ctypes #15
Comments
That does seem very bizarre. That line “function(self, user_data)” in Do the dbussy_examples scripts run OK? |
@ldo Installing it with As for the example scripts, Let me know if you need any more information. |
I just ran your example script 100 times in a row on my Debian Unstable system, and it worked fine. I added some debug messages, just to guard against silent aborts, thus:
And they all appeared OK. |
That's interesting. I at least get an I'm able to replicate it again on an armv6 Raspberry Pi 2 B (also running Arch Linux ARM). I'll let you know in a few days when I narrow it down some more. |
I used the following test loop to run your modified script:
and when I stick a “| wc -l” on the end, I count exactly 200 lines of output, as expected. My main machine is a Core i7-3770, which is about 6 years old now. Does it work OK without that |
By the way, as of this moment, the SHA-256 sums for the
Can you check you get the same answers? |
Commenting out As for file integrity, I get the same SHA256-sums:
Hardware-wise, I was originally running the code on an ODROID XU4 but I tested again on an Raspberry Pi 2 Model B with a fresh installation of Python 3.7.1. Both are armv6/7 and running Arch Linux ARM. The Raspberry Pi 2 is infuriatingly slow to use so I suspect that may have something to do with it. The only feature shared by both physical devices and my VM is slow single-core performance. Just to test, I spun up a brand new 512MB Ubuntu 18.04 virtual machine through Vultr, installed |
According to the docs, Is there an issue with doing a heavy |
Oddly enough, replacing the On the Raspberry Pi 2, no
|
By the way, the docs for The docs also say that |
You're right, it appears that
I'm not discounting the possibility of a Python or dbus packaging issue in Arch Linux ARM so I will check that out later. I was hoping that setting the |
Yeah, worth trying some other distro on that same Raspberry π, maybe. |
I think the root cause of the segfault and the other bizarre errors is libdbus never being notified that you're no longer interested in receiving a reply. It still tries to run a callback function that may no longer exist either because the event loop has shut down or because Properly handling the
I'll let it run for a few hours and see if it crashes again. |
The only place where the By the way, I see a reference circularity between |
Here is a script to test the timeout mechanism with
This is meant to run against the
whereas making the timeout too short produces the expected error return from libdbus:
Is your code different in some way from this? |
Not particularly, no. I get identical outputs on my problem device when using My previous fix only "worked" by coincidence, as far as I can understand, since a restart yielded a crash 30 hours later. I recompiled dbus with debugging symbols and narrowed the segfault down to the I'm working on getting a reproducible virtual machine started so you can actually see this problem occur yourself. |
Hmmm ... are you keeping a reference to the Another possibility is that this is an architecture-dependent bug in |
We've had similar issues in our systems (also armhf) which I've tried debugging with valgrind:
The SegFault is seen when trying to introspect a service that is not present on the system bus (yet). This retry mechanism is performed every 50ms. Moving down the line, the SegFault occurs here:
The plugindbus acts as a wrapper which uses What helped was adding a small delay here:
Before this change we would get a segfault more or less every 5 mins, after this change it's still running, 72 hrs later. Maybe it helps someone. |
Hi! I've also got a segmentation fault when running a I've bumped to 1.2.1 & now I've got this error:
I'll debug this more & come back with any insights. |
I also had some segmentation faults, but they were all gone as soon as I was careful enough to keep a reference to tasks I created. The snippet of code in the issue description is not keeping a ref to the task. This is also true when cancelling a task. Either wait for it or keep a reference long enough. The task will be cancelled only at the next cycle. task.cancel()
try:
await task
except asyncio.CancelledError:
pass |
The app sometimes exits immediately with a segfault. This reference suggests it is a startup race condition in dbussy: ldo/dbussy#15 (comment)
I had a sometimes segfault on my first call via dbussy (on armhf). It appears to be mitigated by a delay before that call per #15 (comment). |
I've run into a strange bug (that may be related to #13) sometimes reproducible by the following test case:
It specifically needs Python 3.7.1 for
asyncio.create_task
andasyncio.run
and triggers about 50% of the time on my armv7l server:On other platforms only the following occurs (again with Python 3.7.1):
Similar code is part of a much larger application and it doesn't segfault about 30% of the time but with occasional startup errors like:
And:
I've just somewhat figured out how to use the
ravel
module from the source code and the examples repository, so is this just me misusing it?The text was updated successfully, but these errors were encountered: