This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Python 2.7 crashes in Linux environment
Type: crash Stage: resolved
Components: Interpreter Core Versions: Python 2.7
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: HuyK, louielu, ncoghlan
Priority: normal Keywords:

Created on 2017-05-26 01:48 by HuyK, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python_crashes.png HuyK, 2017-05-26 01:48 Captured picture about coredump message
weather_station.py HuyK, 2017-05-26 02:37 Python application
Messages (4)
msg294520 - (view) Author: HuyK (HuyK) Date: 2017-05-26 01:48
Hi all,

I have a python script to run  as a Weather Station application. The python script runs on Raspberry Pi 3 board. It gets weather data from OpenWeatherMap website and sends result to a remote touch-screen device via COM port to display

It uses two main libraries to handle the task:
https://pypi.python.org/pypi/ftd2xx
https://github.com/csparpa/pyowm

I got the python script just exits without any error after sometimes. Checking the return code with the command "echo $?" in Pi's console window and got 139 which means a Segmentation Fault

We tried to generate coredump system when the python script crashes and we got this:
"Core was generated by 'python weather_station.py'
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0005b614 in complex_subtype_from_string (type=0x746150, v=0x72616843) at ../Objects/complexobject.c:1075"

I tried to update to Python 2.7.13 but the crashes still happens.

My question is if the segmentation fault related to complexobject.c has been reported and fixed?

Best regards,
HuyK
msg294525 - (view) Author: Louie Lu (louielu) * Date: 2017-05-26 02:30
Hi Huyk, which version of Python does the error message generated?

Also, could you try to provide a minimum reproduce python script and upload it? it will be more easy to debug this problem if we can reproduce this.
msg294527 - (view) Author: HuyK (HuyK) Date: 2017-05-26 02:37
Hi Louie Lu,

You will need a touch-screen device running corresponding firmware in order to run the python application. FYI, I tried to run only weather data fetching or only COM port communication but the crash did not happen. It happens when I run both tasks.
Anyway, I attach the python script for your reference.
First, I got the issue with 2.7.9. And after updating to 2.7.13, I still get the crash issue

Thanks,
HuyK
msg294528 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2017-05-26 02:52
Hi HuyK, thanks for the issue report, and in particular the pointers to the key external libraries the script uses.

It seems ftd2xx relies on ctypes to wrap an external library, which means that this report falls under the general policy of "triggering a segfault with ctypes is assumed to be a bug in the usage of ctypes, rather than a bug in ctypes itself". 

If you'd like to investigate further before filing a bug report with the ftd2xx authors, you may want to try out the Python 2.7 backport of Python 3's faulthandler library: https://faulthandler.readthedocs.io/

That should be able to give you a Python traceback at the point where the segfault occurs, rather than trying to reverse engineer that information from the core dump.
History
Date User Action Args
2022-04-11 14:58:46adminsetgithub: 74663
2017-05-26 02:52:54ncoghlansetstatus: open -> closed

nosy: + ncoghlan
messages: + msg294528

resolution: third party
stage: resolved
2017-05-26 02:37:33HuyKsetfiles: + weather_station.py

messages: + msg294527
2017-05-26 02:30:11louielusetnosy: + louielu
messages: + msg294525
2017-05-26 01:48:32HuyKcreate