Skip to content
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

Seg Faults with Python in Linux for moduleobject.c Not Found #159

Closed
1 of 5 tasks
danyeaw opened this issue Dec 16, 2019 · 9 comments
Closed
1 of 5 tasks

Seg Faults with Python in Linux for moduleobject.c Not Found #159

danyeaw opened this issue Dec 16, 2019 · 9 comments
Assignees
Labels
Area: Python bug Something isn't working OS: Ubuntu

Comments

@danyeaw
Copy link

danyeaw commented Dec 16, 2019

Describe the bug
In the GitHub Actions ubuntu-latest runner, I am getting a segmentation fault while running some of my Python tests using Pytest. The tests all pass fine locally, all pass fine using Azure Pipelines, and all pass with macOS and Windows on GitHub Actions. I have tried both Python 3.7 and 3.8, I get the segmentation faults for both cases. Update on 2020-04-07, the issue is fixed in Python 3.8, but is still there in Python 3.7.

The errors happen with multiple versions of Pytest, including 4.x and 5.x releases. When running the tests with gdb, I am getting the error Objects/moduleobject.c: No such file or directory.

I first posted this bug on the CommunityForum, and filing an Issue here was the recommendation.

Virtual environments affected

  • macOS 10.15
  • Ubuntu 16.04 LTS
  • Ubuntu 18.04 LTS
  • Windows Server 2016 R2
  • Windows Server 2019

Expected behavior
No segmentation faults

Actual behavior
I have created a minimal reproducible example.

This is the output when I ran xvfb-run pytest through gdb on the GitHub Actions CI on the Gaphor project, which is where I first found the issue:

(Gaphor) runner@fv-az76:~/work/gaphor/gaphor$ gdb -ex r --args python -m pytest                                 
GNU gdb (Ubuntu 8.2-0ubuntu1~18.04) 8.2
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

Starting program: /home/runner/work/gaphor/gaphor/.venv/bin/python -m pytest
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Detaching after fork from child process 7738]
[Detaching after fork from child process 7740]
[Detaching after fork from child process 7741]
[Detaching after fork from child process 7742]
============================================= test session starts ==============================================
platform linux -- Python 3.8.0, pytest-5.3.0, py-1.8.0, pluggy-0.13.1
rootdir: /home/runner/work/gaphor/gaphor, inifile: pytest.ini, testpaths: gaphor, tests, docs
plugins: xvfb-1.2.0, cov-2.8.1
collecting ... [New Thread 0x7fffe1493700 (LWP 7755)]
[New Thread 0x7fffe0c92700 (LWP 7756)]
[Detaching after fork from child process 7757]
collecting 224 items                                                                                           
Thread 1 "python" received signal SIGSEGV, Segmentation fault.
PyModule_GetState (m=0x0) at Objects/moduleobject.c:565
565     Objects/moduleobject.c: No such file or directory.
@danyeaw
Copy link
Author

danyeaw commented Jan 7, 2020

Is there anything I can do further to help troubleshoot this?

@danyeaw
Copy link
Author

danyeaw commented Feb 2, 2020

@kaylangan Thanks for adding this to the backlog 👍

@danyeaw
Copy link
Author

danyeaw commented Apr 6, 2020

@maxim-lobanov Please let me know if I can provide any additional information to help resolve this. Thanks!

@maxim-lobanov
Copy link
Contributor

maxim-lobanov commented Apr 7, 2020

Hello @danyeaw !
Could you please try to rerun your build and confirm that issue is still actual?
I am asking because I just forked your repository (minimal reproducible example) for investigation and run test build. It passed successfully.

@danyeaw
Copy link
Author

danyeaw commented Apr 7, 2020

@maxim-lobanov Thanks for taking a look. It looks like my minimal reproducible example is no longer failing, but the original issue still exists: gaphor/gaphor#289
I can try to update my example to get it to fail again if digging through the gaphor repo is too difficult.

@maxim-lobanov
Copy link
Contributor

@danyeaw , Yes, please.
If you can update your repro project, it would be great.
Am I right that only Python 3.7 is affected now?

@danyeaw
Copy link
Author

danyeaw commented Apr 7, 2020

@maxim-lobanov Ok, repo updated. Yes, it looks like it now is only with Python 3.7. I updated the description above to reflect that as well.

@maxim-lobanov
Copy link
Contributor

@danyeaw , I have tried to investigate the issue deeper. Unfortunately, I didn't find the root cause but found that issue reproduces on both AzDO and GitHub images and only with Python 3.7.
I have looked at how we build Python 3.7 for Ubuntu environment and didn't find something suspicious (we use the same code for 3.7 and 3.8)

Do you have a chance to run this code on local Ubuntu environment with Python 3.7 and check if it works as expected?
I wonder if it can be related to any project dependencies that are not fully compatible for Python 3.7.

@danyeaw
Copy link
Author

danyeaw commented Apr 17, 2020

@maxim-lobanov Yes, all tests passed fine locally, and with Azure Pipelines before upgrading to GitHub Actions in Python 3.7 and Python 3.8. Since the issue seems to be fixed in Python 3.8 which is the main environment we are using to develop the app, I think we can go ahead and close this issue even if the problem still exists in earlier Python versions.

Thanks for your help trying troubleshoot this.

@danyeaw danyeaw closed this as completed Apr 17, 2020
hinerm added a commit to imagej/pyimagej that referenced this issue Nov 17, 2021
That may fix the intermittant segfaulting, based on
actions/runner-images#159
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Python bug Something isn't working OS: Ubuntu
Projects
None yet
Development

No branches or pull requests

6 participants