OpenImageIO: Segfault with jpeg2000 threading

https://github.com/OpenImageIO/oiio/blob/5767c62394872b89d3b39a1c303a4378945fc895/src/jpeg2000.imageio/jpeg2000input.cpp#L235-L242

I am reliably getting segfaults for this set of code. If I comment it out, the issue goes away:

received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffafa4d700 (LWP 123835)]
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007fffe0619d8f in opj_codec_set_threads () from /tmp/rez_context_2Z5wW6/LD_LIBRARY_PATH/libopenjp2.so.7
#2  0x00007fffeab7c86c in OpenImageIO_v2_4::Jpeg2000Input::open (this=0x7ffdd06c0de0, name=..., p_spec=...) at /scratch/dev/OpenImageIO/src/jpeg2000.imageio/jpeg2000input.cpp:241
#3  0x00007fffeaa62f01 in OpenImageIO_v2_4::ImageInput::valid_file (this=0x7ffdd06c0de0, filename=...) at /scratch/dev/OpenImageIO/src/libOpenImageIO/imageinput.cpp:97
#4  0x00007fffeaa851fa in OpenImageIO_v2_4::ImageInput::create (filename=..., do_open=false, config=<optimized out>, ioproxy=ioproxy@entry=0x0, plugin_searchpath=...) at /scratch/dev/OpenImageIO/src/libOpenImageIO/imageioplugin.cpp:743
#5  0x00007fffeaa86bc3 in OpenImageIO_v2_4::ImageInput::create (filename=..., do_open=true, config=0x40, plugin_searchpath=...) at /scratch/dev/OpenImageIO/src/libOpenImageIO/imageioplugin.cpp:618
#6  0x00007fffeaaf9666 in OpenImageIO_v2_4::pvt::ImageCacheFile::open (this=this@entry=0x7ffdd064b040, thread_info=thread_info@entry=0x7ffdd06ca260) at /scratch/dev/OpenImageIO/src/libtexture/imagecache.cpp:499

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 40 (23 by maintainers)

Most upvoted comments

https://www.itu.int/net/ITU-T/sigdb/speimage/ImageForm-s.aspx?val=10100803 Click on J2KP4files.zip

That’s what we use for CI

Try wrapping the calls with a lock_guard to see if that helps.

If you are not familiar with these: https://en.cppreference.com/w/cpp/thread/lock_guard

Hmmm… now I’m not sure if CI does it! But that’s the set I test locally.