I'm working on a variscite board with a yocto distribution and python 2.7.3.
I get sometimes a Bus error message from the python interpreter.
My program runs normally at least some hours or days before the error ocours.
But when I get it once, I get it directly when I try to restart my program.
I have to reboot before the system works again.
My program uses only a serial port, a bit usb communication and some tcp sockets.
I can switch to another hardware and get the same problems.
I also used the python selftest with
python -c "from test import testall"
And I get errors for these two tests
test_getattr (test.test_builtin.BuiltinTest) ... ERROR test_nameprep
(test.test_codecs.NameprepTest) ... ERROR
And the selftest stops always at
test_callback_register_double (ctypes.test.test_callbacks.SampleCallbacksTestCase) ... Segmentation
fault
But when the systems runs some hours the selftests stops earlier at
ctypes.macholib.dyld
Bus error
I checked the RAM with memtester, it seems to be okay.
How I can find the cause for the problems?
Bus errors are generally caused by applications trying to access memory that hardware cannot physically address. In your case there is a segmentation fault which may cause dereferencing a bad pointer or something similar which leads to accessing a memory address which physically is not addressable. I'd start by root causing the segmentation fault first as the bus error is the secondary symptom.
A year later I found the indirect cause for the problems.
I wrote a crc16 module which used:
from ctypes import c_ushort
...
value = c_ushort(crcValue >>8 ) ...
In case of a BUS-Error this was the problematic part.
I don't assume that the c_ushort() function itself causes the problem, it's only the function which shows that there is something broken.
The problem gone after upgrading the system to Linux version 3.14.38-6QP+g8740b9f (test#Yocto) (gcc version 4.9.2 (GCC) )
Related
I am using a Raspberry Pi 400 with a Bosch BME688 sensor to collect data to pass to the BME Ai studio for training. I used the pi3g github library to collect data. When running the examples everything works fine but when using the bmerawdata.py it results in a segmentation fault. I've already done what is suggested in the issue for the segmentation fault and i fixed the constants in the library that changed from the 1.0.x version to the 2.2.0.0 of the bsec library.
The first issue that i encountered was that executing the bmerawdata.py under sudo would give me different results from the execution without sudo. After removing the bme68x library and reinstalling it it seems like the super user execution and the normal user execution produce the same result. But after a couple of cycles the program now crashes with a segmentation fault.
If anyone could help that'd be appreciated
Lately I've had this problem when running my lambdas on aws.
I have checked that the lambda does not run, the lambda starts but does not run.
I tried to increase the memorySize of the lambda but it is not the problem. I leave you an image of the output in cloudwatch.
Thanks in advance.
Error: Runtime exited with error: signal: segmentation fault (core dumped) Runtime.ExitError
One big reason for this core dumped error is when your lambda reaches the maximum memory allowed.
You may experience a case where the graph does not show it, and this is still the case.
Check your lambda logic or logic runs from a third party dependency. There may be a memory usage collision which causes segmentation fault (core dumped) crash
Segmentation fault (core dumped)" is the error that Linux prints when
a program exits with a SIGSEGV signal and you have core creation
enabled. This means some program has crashed.
In this case python interpreter has crashed unexpectedly. There are
only a few reasons this can happen:
You're using a third-party extension module written in C, and that
extension module has crashed.
You're (directly or indirectly) using
the built-in module ctypes, and calling external code that crashes.
There's something wrong with your Python installation.
You've discovered a bug in Python or most probably one of the python's library you are using that you should report.
Things you can try to fix
If you have updated the libraries you are using check by downgrading them one by one
If you are using serverless, upgrade it to latest version
If you are using node, npm upgrade them to latest version
I’m currently in the process of porting software from Python 2.7 to Python 3.7, and I’m seeing something that I have no idea how to address. When I type “python –m project.main” to run the software, about 50% of the time nothing happens and a fresh command prompt line prints after a few seconds with no error message or traceback whatsoever. The other half of the time, the program runs perfectly. There doesn’t appear to be any discernable pattern of success vs failure
To try and gather further information, I tried out Python 3’s “faulthandler” package, but most of the time I still see no error message. Once in a while, it does print a cryptic “Windows fatal exception: access violation” with accompanying traceback (but no further details), but again there seems to be no pattern as to when the message prints among the failed runs.
As background, the software builds a QApplication (PyQt5), and we’re running on Windows 10 with Anacdona 3.7. As I mentioned, we recently upgraded from Python 2.7, and never saw anything like this. Most of the migration has gone relatively smoothly – like I said, when the program does run, it works fine.
Has anyone else encountered anything like this? The apparent randomness of the failures is driving me crazy.
I'm getting a segfault ("Illegal operation (core dumped)") for a python program that I've run every week without fault for ages. I'm also running Ubuntu on Nitrous. I recall dealing with these yonks ago when coding in C, and I haven't had to deal with them very much recently.
Importing the library urllib3 seems to be causing the problem. Does anyone know a fix?
Also, can someone advise or link to the best workflow for diagnosing these problems in future?
Thanks!
"Illegal operation"
This usually means that you are running code compiled for a more capable processor (e.g. Haswell) on a less capable one (e.g. Ivy Bridge).
Importing the library urllib3 seems to be causing the problem.
On my Ubuntu machine, import urllib3 loads libssl.so.1.0.0, libcrypto.so.1.0.0 and _ssl.x86_64-linux-gnu.so. These crypto libraries are very likely to be compiled with AVX, AVX2, etc. instructions which your processor may not support.
best workflow for diagnosing these problems
Your first step should be to find out which instruction is causing the SIGILL. To do so, run:
gdb python
(gdb) run
>>> import urllib3 # do whatever is necessary to reproduce SIGILL
(gdb) x/i $pc
(gdb) info sym $pc
The last two commands above should give you the instruction that is causing the SIGILL, and the library in which that instruction is used. Once you know what that instruction is, you can verify that your processor doesn't support it, and contact the distributor of the "guilty" library to get a different compilation (one without using instructions that are not supported by your CPU).
When I try to run a python script I get Illegal instruction and that's it, it doesn't give any more details so I have no idea what's going on, is there a way to find out what is causing the Illegal instruction error?
Also, I run the code using sudo I don't get any output, the program just exits.
UPDATE:
The script I'm running is the simple-agent script from bluez:
https://github.com/pauloborges/bluez/blob/master/test/simple-agent
Also, I ran line by line like #buratino said and I got the error in the second line:
from gi.repository import GObject
Like #Notlikethat said, the Illegal instruction error happens when the code being executed was compiled for a different architecture, Raspberry Pi uses ARM.
That said, I found out that GObject seemed to be causing the problem. Anyway, I uninstalled every bluetooth related package I had installed and reinstall them using the raspbian repository and now the Illegal instruction is gone and the script executes correctly.
Why did this happen? Well, I have a Raspberry Pi Zero which means I don't have an Ethernet port, before I bought a WiFi dongle I installed a few packages by downloading them on my computer and storing the .deb in the SD card, of course this means I have to manually check that I'm downloading the right version of the package, I must've messed up in one of them.
Lesson learned, never try to manually install packages, let apt-get do all the work!