Repository: pytorch/audio

Issue #185: Segfault in sox_find_format when running test suite under pytest
Created: 2019-07-30T19:28:40Z
On 2d82a1e
pytest test

It crashes during test_legacy with
#0  0x00007fff16d147b0 in ?? ()
#1  0x00007fffa44a1434 in sox_find_format () from /usr/lib/x86_64-linux-gnu/libsox.so.3
#2  0x00007fffa44a1847 in ?? () from /usr/lib/x86_64-linux-gnu/libsox.so.3
#3  0x00007fffa4753035 in torch::audio::read_audio_file (file_name=..., output=...,·
    ch_first=<optimized out>, nframes=0, offset=0, si=<optimized out>, ei=0x0, ft=0x0)
    at torchaudio/torch_sox.cpp:114
#4  0x00007fffa477a7df in pybind11::detail::argument_loader<std::string const&, at::Tensor, bool, long, long, sox_signalinfo_t*, sox_encodinginfo_t*, char const*>::call_impl<int, int (*&)(std::string const&, at::Tensor, bool, long, long, sox_signalinfo_t*, sox_encodinginfo_t*, char const*), 0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul, pybind11::detail::void_type> (f=<optimized out>, this=0x7fffffff7750)
    at /private/home/ezyang/Dev/audio-env/lib/python3.7/site-packages/torch/include/pybind11/cast.h:1931
#5  pybind11::detail::argument_loader<std::string const&, at::Tensor, bool, long, long, sox_signalinfo_t*, sox_encodinginfo_t*, char const*>::call<int, pybind11::detail::void_type, int (*&)(std::string const&, at::Tensor, bool, long, long, sox_signalinfo_t*, sox_encodinginfo_t*, char const*)>(int (*&)(std::string const&, at::Tensor, bool, long, long, sox_signalinfo_t*, sox_encodinginfo_t*, char const*)) && (
    f=<optimized out>, this=<optimized out>)
    at /private/home/ezyang/Dev/audio-env/lib/python3.7/site-packages/torch/include/pybind11/cast.h:1908
#6  void pybind11::cpp_function::initialize<int (*&)(std::string const&, at::Tensor, bool, long, long, sox_signalinfo_t*, sox_encodinginfo_t*, char const*), int, std::string const&, at::Tensor, bool, long, long, sox_signalinfo_t*, sox_encodinginfo_t*, char const*, pybind11::name, pybind11::scope, pybind11::sibling, char [34]>(int (*&)(std::string const&, at::Tensor, bool, long, long, sox_signalinfo_t*, sox_encodinginfo_t*, char const*), int (*)(std::string const&, at::Tensor, bool, long, long, sox_signalinfo_t*, sox_encodinginfo_t*, char const*), pybind11::name const&, pybind11::scope const&, pybind11::sibling const&, char const (&) [34])::{lambda(pybind11::detail::function_call&)#3}::operator()(pybind11::detail::function_call&) const (
    __closure=<optimized out>, call=...)

This seems to only happen when you run multiple tests together. I'm working on a minimal reproducer.

Duplicate issue #255: Double free or memory corruption in SoxEffectsChain
Created: 2019-08-24T08:28:48Z
I've started using SoxEffectsChain for doing audio data augmentation within the data loader:
sox = torchaudio.sox_effects.SoxEffectsChain()
sox.append_effect_to_chain('pitch', random.uniform(-2, 2) * 100)
sox.append_effect_to_chain('rate', target_sample_rate)
sox.append_effect_to_chain('channels', 1)
signal = sox.sox_build_flow_effects()[0][0]
After training for ~1k iteration I've received:
double free or corruption (!prev)

and the app is crashed because RuntimeError: DataLoader worker (pid 66) is killed by signal: Aborted.
My Docker container is running with --ipc=host and there's enough memory (it's p3.8xlarge). Without augmentations / SoxEffectsChain it works ok. I'll try to get a crash dump.

Closing comment (2019-08-27T21:35:00Z): Related to #185 ?

In #117 where the tests were fixed, it was show that if all the test are run on the same process, it will call torchaudio.initialize_sox() and torchaudio.shutdown_sox() repeatedly which is not allowed. Those functions can only be called once per process.