imaris / ImarisWriterTest

Apache License 2.0
1 stars 3 forks source link

Segmentation fault for the example ImarisWriterTest.cxx #1

Closed ruanxt closed 4 years ago

ruanxt commented 4 years ago

Dear authors, I'm interested in trying ImarisWriter to convert tiff files to imaris files. I tried the ImarisWriter examples. I'm able to compile the package and the example code. However, when I ran the code, it throws an error:

$./ImarisWriterTestRelease -sizex 400 -sizey 400 -sizez 100 -sizet 1 -sizec 1 -type 16bit -threads 8 -outputpath out -randseed 33 -compression 31 img.ims

Starting writer test  using 8 thread(s)
Input block size XYZCT: 256 256 8 1 1
Segmentation fault (core dumped)

Then, I used gdb to debug it, here is the detailed info for the error:

$gdb --args ./ImarisWriterTestRelease -sizex 400 -sizey 400 -sizez 100 -sizet 1 -sizec 1 -type 16bit -threads 8 -outputpath out -randseed 33 -compression 31 img.ims
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>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./ImarisWriterTestRelease...done.
(gdb) run
Starting program: /home/debug/bin/ImarisWriterTest/application/ImarisWriterTestRelease -sizex 400 -sizey 400 -sizez 100 -sizet 1 -sizec 1 -type 16bit -threads 8 -outputpath out -randseed 33 -compression 31 img.ims
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Starting writer test  using 8 thread(s)
Input block size XYZCT: 256 256 8 1 1
[New Thread 0x7ffff590e700 (LWP 33740)]
[New Thread 0x7ffff510d700 (LWP 33741)]
[New Thread 0x7ffff490c700 (LWP 33742)]
[New Thread 0x7fffe7fff700 (LWP 33743)]
[New Thread 0x7fffe6df4700 (LWP 33744)]
[New Thread 0x7fffe61ef700 (LWP 33745)]
[New Thread 0x7fffe57ec700 (LWP 33746)]
[New Thread 0x7fffe4be7700 (LWP 33747)]
[New Thread 0x7fffd7fff700 (LWP 33748)]
[New Thread 0x7fffd71f8700 (LWP 33749)]

Thread 3 "ImarisWriterTes" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff510d700 (LWP 33741)]
0x00007ffff7b3d118 in bpWriterCompressor::WriteDataBlock(void const*, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) ()
   from /home/debug/bin/ImarisWriter/release/lib/libbpImarisWriter96.so
(gdb) backtrace
#0  0x00007ffff7b3d118 in bpWriterCompressor::WriteDataBlock(void const*, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) ()
   from /home/debug/bin/ImarisWriter/release/lib/libbpImarisWriter96.so
#1  0x00007ffff7b3d212 in bpWriterCompressor::StartWriteDataBlock(bpMemoryHandle, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, std::function<void ()>)::{lambda(void const*, unsigned long)#1}::operator()(void const*, unsigned long) const () from /home/debug/bin/ImarisWriter/release/lib/libbpImarisWriter96.so
#2  0x00007ffff7b3dfe9 in std::_Function_handler<void (void const*, unsigned long), bpWriterCompressor::StartWriteDataBlock(bpMemoryHandle, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, std::function<void ()>)::{lambda(void const*, unsigned long)#1}>::_M_invoke(std::_Any_data const&, void const*&&, unsigned long&&) () from /home/debug/bin/ImarisWriter/release/lib/libbpImarisWriter96.so
#3  0x00007ffff7b5611b in std::function<void (void const*, unsigned long)>::operator()(void const*, unsigned long) const () from /home/debug/bin/ImarisWriter/release/lib/libbpImarisWriter96.so
#4  0x00007ffff7b55665 in bpWriterThreads::cImpl::StartWrite(bpMemoryHandle, std::function<void (void const*, unsigned long)>, std::function<void ()>)::{lambda()#3}::operator()() const ()
   from /home/debug/bin/ImarisWriter/release/lib/libbpImarisWriter96.so
#5  0x00007ffff7b56857 in std::_Function_handler<void (), bpWriterThreads::cImpl::StartWrite(bpMemoryHandle, std::function<void (void const*, unsigned long)>, std::function<void ()>)::{lambda()#3}>::_M_invoke(std::_Any_data const&) ()
   from /home/debug/bin/ImarisWriter/release/lib/libbpImarisWriter96.so
#6  0x00007ffff7aa13e0 in std::function<void ()>::operator()() const () from /home/debug/bin/ImarisWriter/release/lib/libbpImarisWriter96.so
#7  0x00007ffff7b34012 in bpThreadPool::cImpl::TreadLoop() () from /home/debug/bin/ImarisWriter/release/lib/libbpImarisWriter96.so
#8  0x00007ffff7b33783 in bpThreadPool::cImpl::Run(std::function<void ()>, std::function<void ()>, bool)::{lambda()#1}::operator()() const () from /home/debug/bin/ImarisWriter/release/lib/libbpImarisWriter96.so
#9  0x00007ffff7b38961 in void std::__invoke_impl<void, bpThreadPool::cImpl::Run(std::function<void ()>, std::function<void ()>, bool)::{lambda()#1}>(std::__invoke_other, bpThreadPool::cImpl::Run(std::function<void ()>, std::function<void ()>, bool)::{lambda()#1}&&) () from /home/debug/bin/ImarisWriter/release/lib/libbpImarisWriter96.so
#10 0x00007ffff7b37c00 in std::__invoke_result<bpThreadPool::cImpl::Run(std::function<void ()>, std::function<void ()>, bool)::{lambda()#1}>::type std::__invoke<bpThreadPool::cImpl::Run(std::function<void ()>, std::function<void ()>, bool)::{lambda()#1}>(std::__invoke_result&&, (bpThreadPool::cImpl::Run(std::function<void ()>, std::function<void ()>, bool)::{lambda()#1}&&)...) () from /home/debug/bin/ImarisWriter/release/lib/libbpImarisWriter96.so
#11 0x00007ffff7b3a29e in decltype (__invoke((_S_declval<0ul>)())) std::thread::_Invoker<std::tuple<bpThreadPool::cImpl::Run(std::function<void ()>, std::function<void ()>, bool)::{lambda()#1}> >::_M_invoke<0ul>(std::_Index_tuple<0ul>)
    () from /home/debug/bin/ImarisWriter/release/lib/libbpImarisWriter96.so
#12 0x00007ffff7b3a22c in std::thread::_Invoker<std::tuple<bpThreadPool::cImpl::Run(std::function<void ()>, std::function<void ()>, bool)::{lambda()#1}> >::operator()() ()
   from /home/debug/bin/ImarisWriter/release/lib/libbpImarisWriter96.so
#13 0x00007ffff7b3a1bc in std::thread::_State_impl<std::thread::_Invoker<std::tuple<bpThreadPool::cImpl::Run(std::function<void ()>, std::function<void ()>, bool)::{lambda()#1}> > >::_M_run() ()
   from /home/debug/bin/ImarisWriter/release/lib/libbpImarisWriter96.so
#14 0x00007ffff7376d80 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#15 0x00007ffff76816db in start_thread (arg=0x7ffff510d700) at pthread_create.c:463
#16 0x00007ffff6a20a3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Could you please have a look and see how to resolve this issue? Thanks in advance!

ruanxt commented 4 years ago

I figured out the issue, it is because the output directory does not exist.