question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Segmentation fault on librosa.load()

See original GitHub issue

Description

Segfault when running librosa.load(librosa.util.example_audio_file())

Steps/Code to Reproduce

# minimal_reproducible_example.py
import librosa

filename = librosa.util.example_audio_file()
y, sr = librosa.load(filename)

Expected Results

python should exit without Segmentation fault: 11

Actual Results

$ python3 minimal_reproducible_example.py 
Segmentation fault: 11

Versions

Darwin-18.7.0-x86_64-i386-64bit
Python 3.7.4 (default, Jul  9 2019, 18:13:23) 
[Clang 10.0.1 (clang-1001.0.46.4)]
NumPy 1.16.4
SciPy 1.1.0
librosa 0.7.0

I’ve narrowed it down to the call to resampy.resample. Other res_types do not give a seg fault error eg fft, scipy, polyphase.

Furthermore, the segfault does not appear during or immediately after running resampy.resample. The error happens upon program exit. The beginning of the error looks like:

Process:               Python [3702]
Path:                  /usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python
Identifier:            Python
Version:               3.7.4 (3.7.4)
Code Type:             X86-64 (Native)
Parent Process:        bash [1543]
Responsible:           Python [3702]
User ID:               502

Date/Time:             2019-10-02 11:47:04.306 -0700
OS Version:            Mac OS X 10.14.6 (18G95)
Report Version:        12
Anonymous UUID:        ***


Time Awake Since Boot: 15000 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [3702]

VM Regions Near 0:
--> 
    __TEXT                 000000010e763000-000000010e765000 [    8K] r-x/rwx SM=COW  /usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   _dynfunc.cpython-37m-darwin.so	0x000000011a0347df closure_dealloc + 31
1   org.python.python             	0x000000010e7aade7 meth_dealloc + 87
2   org.python.python             	0x000000010e7b80d9 tupledealloc + 93
3   org.python.python             	0x000000010e7b9d35 subtype_dealloc + 892
4   org.python.python             	0x000000010e7a0da2 free_keys_object + 127
5   org.python.python             	0x000000010e7a2d56 dict_dealloc + 188
6   org.python.python             	0x000000010e7a5284 odict_dealloc + 124
7   org.python.python             	0x000000010e7a2d18 dict_dealloc + 126
8   org.python.python             	0x000000010e7b9dd5 subtype_dealloc + 1052
9   org.python.python             	0x000000010e7a0da2 free_keys_object + 127
10  org.python.python             	0x000000010e7a3169 dict_tp_clear + 9
11  org.python.python             	0x000000010e8540b9 collect + 1948
12  org.python.python             	0x000000010e85390c _PyGC_CollectNoFail + 55
13  org.python.python             	0x000000010e829c78 PyImport_Cleanup + 1516
14  org.python.python             	0x000000010e83442b Py_FinalizeEx + 116
15  org.python.python             	0x000000010e852743 pymain_main + 5042
16  org.python.python             	0x000000010e852f80 _Py_UnixMain + 56
17  libdyld.dylib                 	0x00007fff58d733d5 start + 1

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x000000011cd4ef70  rbx: 0x000000011d058fa0  rcx: 0x0000000000000000  rdx: 0x00007ff49fa412c0
  rdi: 0x000000011d058fa0  rsi: 0x000000010e9cd000  rbp: 0x00007ffee149c160  rsp: 0x00007ffee149c150
   r8: 0x000000000000003f   r9: 0x00007ff49fa0df10  r10: 0x000007ff49fa412c  r11: 0x0000000000000352
  r12: 0x000000011d189520  r13: 0x000000010e7b807c  r14: 0x00007ff49d408480  r15: 0x000000000000000e
  rip: 0x000000011a0347df  rfl: 0x0000000000010282  cr2: 0x0000000000000000
  
Logical CPU:     2
Error Code:      0x00000006
Trap Number:     14

I suppose I can go with polyphase for now since it is fastest. Unless you have a quick fix or recommendation?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
lostanlencommented, Oct 3, 2019

i’m glad it’s solved! this is the second numba installation-related issue this month (see #993)

PSA to anyone reading this: installing librosa via a miniconda distribution (conda install -c conda-forge librosa) considerably reduces the probability of this type of problem.

2reactions
areeves87commented, Oct 3, 2019

related numba/numba#4323

Turns out I had an old version of numba installed:

pip3 show numba
Name: numba
Version: 0.40.1
Summary: compiling Python code using LLVM
Home-page: http://numba.github.com
Author: Anaconda, Inc.
Author-email: numba-users@continuum.io
License: BSD
Location: /usr/local/lib/python3.7/site-packages
Requires: llvmlite, numpy
Required-by: resampy, librosa, fastparquet

Upgrading to the latest version 0.45.1 resolved the segfault issue. Now when I run my minimal_reproducible_example.py I get:

$ python3 minimal_reproducible_example.py 
61.458866
2
Vorbis
False

No Segmentation fault: 11

I recommend editing the code block under “Versions” in the issue template to include a print out of the version of numba installed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Segmentation Fault" in matplotlib running example Librosa ...
Finally, I've solved this issue by installing these packages: sudo apt-get install tk-dev libpng-dev libffi-dev dvipng texlive-latex-base and reinstalling ...
Read more >
Troubleshooting — librosa 0.10.0.dev0 documentation
This warning is most often triggered by loading files encoded with mp3 format, which are not supported by libsndfile prior to version 1.1....
Read more >
Source code for librosa.core.audio
See :ref:`ioformats` for alternate loading methods. ... y.shape[axis])) fft = get_fftlib() # Pad out the signal to support full-length auto-correlation.
Read more >
Source code for librosa.core.audio
[docs]def load( path, *, sr=22050, mono=True, offset=0.0, duration=None, dtype=np.float32, res_type="kaiser_best", ): """Load an audio file as a floating ...
Read more >
Changelog — librosa 0.10.0.dev0 documentation
#1479 Accept pre-constructed audioread objects in librosa.load . Brian McFee ... #1298 fixed a dimension calculation error in librosa.stream documentation.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found