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

Segmentation Fault After Closing SequenceReader #88

Closed
jessrosenfield opened this issue Dec 23, 2019 · 7 comments
Closed

Segmentation Fault After Closing SequenceReader #88

jessrosenfield opened this issue Dec 23, 2019 · 7 comments
Labels
bug norepro Cannot Reproduce

Comments

@jessrosenfield
Copy link

I cannot reliably reproduce this error, but I have been getting segmentation faults every now and then on single-end adapter-match and paired-end insert-match trimming. Upon adding faulthandler.enable() to atropos/commands/__init__.py I was able to get this output after a couple reruns of the following command (using a self-built docker image w/ a ubuntu 16.04 base on an ec2 instance with 32 cpus). I hope this information is still useful to have on hand despite the absence of the docker image and input files used (I've left off the -o, -p, -pe1, and -pe2 args).

/usr/local/bin/atropos trim \
       -a AGATCGGAAGAGCACACGTCTGAACTCCAGTCA \
       -A AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGT \
       --no-cache-adapters \
       --no-default-adapters \
       -T 32 \
       --aligner insert \
       --preserve-order

The trace indicates the error is occurring here: https://github.com/jdidion/atropos/blob/1.1/atropos/io/seqio.py#L93

        stderr:
            Fatal Python error: Segmentation fault

            Thread 0x00007fd7bb834700 (most recent call first):
              File "/usr/lib/python3.5/threading.py", line 293 in wait
              File "/usr/lib/python3.5/multiprocessing/queues.py", line 229 in _feed
              File "/usr/lib/python3.5/threading.py", line 862 in run
              File "/usr/lib/python3.5/threading.py", line 914 in _bootstrap_inner
              File "/usr/lib/python3.5/threading.py", line 882 in _bootstrap

            Current thread 0x00007fd7bf81b700 (most recent call first):
              File "/usr/local/lib/python3.5/dist-packages/atropos-1.1.21-py3.5-linux-x86_64.egg/atropos/io/seqio.py", line 93 in close
              File "/usr/local/lib/python3.5/dist-packages/atropos-1.1.21-py3.5-linux-x86_64.egg/atropos/io/seqio.py", line 463 in close
              File "/usr/local/lib/python3.5/dist-packages/atropos-1.1.21-py3.5-linux-x86_64.egg/atropos/commands/base.py", line 358 in finish
              File "/usr/local/lib/python3.5/dist-packages/atropos-1.1.21-py3.5-linux-x86_64.egg/atropos/commands/base.py", line 283 in __next__
              File "/usr/local/lib/python3.5/dist-packages/atropos-1.1.21-py3.5-linux-x86_64.egg/atropos/commands/multicore.py", line 507 in enqueue_all
              File "/usr/local/lib/python3.5/dist-packages/atropos-1.1.21-py3.5-linux-x86_64.egg/atropos/commands/multicore.py", line 291 in __call__
              File "/usr/local/lib/python3.5/dist-packages/atropos-1.1.21-py3.5-linux-x86_64.egg/atropos/util/__init__.py", line 727 in run_interruptible
              File "/usr/local/lib/python3.5/dist-packages/atropos-1.1.21-py3.5-linux-x86_64.egg/atropos/commands/multicore.py", line 267 in run
              File "/usr/local/lib/python3.5/dist-packages/atropos-1.1.21-py3.5-linux-x86_64.egg/atropos/commands/trim/__init__.py", line 719 in run_parallel
              File "/usr/local/lib/python3.5/dist-packages/atropos-1.1.21-py3.5-linux-x86_64.egg/atropos/commands/trim/__init__.py", line 598 in __call__
              File "/usr/local/lib/python3.5/dist-packages/atropos-1.1.21-py3.5-linux-x86_64.egg/atropos/commands/base.py", line 332 in run
              File "/usr/local/lib/python3.5/dist-packages/atropos-1.1.21-py3.5-linux-x86_64.egg/atropos/commands/__init__.py", line 136 in run_command
              File "/usr/local/lib/python3.5/dist-packages/atropos-1.1.21-py3.5-linux-x86_64.egg/atropos/commands/__init__.py", line 71 in execute
              File "/usr/local/lib/python3.5/dist-packages/atropos-1.1.21-py3.5-linux-x86_64.egg/atropos/commands/__init__.py", line 219 in execute_cli
              File "/usr/local/lib/python3.5/dist-packages/atropos-1.1.21-py3.5-linux-x86_64.egg/EGG-INFO/scripts/atropos", line 23 in main
              File "/usr/local/lib/python3.5/dist-packages/atropos-1.1.21-py3.5-linux-x86_64.egg/EGG-INFO/scripts/atropos", line 26 in <module>
              File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1504 in run_script
              File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 719 in run_script
              File "/usr/local/bin/atropos", line 4 in <module>
@jdidion
Copy link
Owner

jdidion commented Dec 24, 2019

Thanks for reporting this @jessrosenfield. What version of Atropos are you using?

@jessrosenfield
Copy link
Author

jessrosenfield commented Dec 24, 2019 via email

@jdidion
Copy link
Owner

jdidion commented Dec 25, 2019

Thanks @jessrosenfield. Do you know if it fails on the same line of code every time? That line is simply setting a variable to None and is only ever called by a single thread, so I can't see how it would cause a SegmentationFault.

My suspicion is that this is instead an out-of-memory error. Since you said you are running this in a Docker container, can you check that the Docker engine is configured to allocate a sufficient amount of memory to the container? Try 32 GB - that should be overkill, but once you figure out whether that is the fix you can start scaling back, perhaps using a profiler to determine the peak usage.

@jdidion jdidion added bug norepro Cannot Reproduce labels Dec 25, 2019
@jessrosenfield
Copy link
Author

jessrosenfield commented Dec 30, 2019 via email

@jessrosenfield
Copy link
Author

jessrosenfield commented Dec 30, 2019 via email

@siddharthab
Copy link

I was able to inspect the stack trace in the core dump and was able to trace it to a bug in python 3.5.2 (default on ubuntu 16.04). This bug has been fixed from python 3.5.3 onwards.

This issue can be closed.

@jdidion
Copy link
Owner

jdidion commented Jan 10, 2020

Thank you @siddharthab! I will make a note of this on the readme so that others avoid 3.5.2.

Starting from atropos 2.0, python 3.6 will be required at a minimum, so this won't be an issue anymore.

@jdidion jdidion closed this as completed Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug norepro Cannot Reproduce
Projects
None yet
Development

No branches or pull requests

3 participants