My program runs well when I open only one model file. But when I try to open multiple files (with different vulkan instance and thread), my program might crash in this place. I checked the arguments of the function, but they seemed to have no any problem.
The GDB backtrace is here:
Thread 83 "VulkanRenderer" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffebfdff700 (LWP 50908)]
0x00007fffe35b7053 in ?? () from /usr/lib/nvidia-375/libnvidia-glcore.so.375.39
(gdb) bt
#0 0x00007fffe35b7053 in ?? () from /usr/lib/nvidia-375/libnvidia-glcore.so.375.39
#1 0x00007fffe35e1a7e in ?? () from /usr/lib/nvidia-375/libnvidia-glcore.so.375.39
#2 0x00007fffe35e3102 in ?? () from /usr/lib/nvidia-375/libnvidia-glcore.so.375.39
#3 0x00007ffff78ca4ed in VulkanCommandBuffer::SetDescriptorSet(vk::PipelineBindPoint, VulkanPipelineLayout*, unsigned int, unsigned int, VulkanDescriptorSet**, unsigned int, unsigned int*) () from
How can I fix this crash bug?
Are the commands being sent to the same queue or different queues. Also where is the output going? Is it the same window for both instances?
Related
I am simulating customers with threads sitting at and then leaving tables. My current data structure for the table is a list that holds thread pointers.
list<intptr_t> table;
void * customer(void* vargp){
intptr_t tid;
tid = (intptr_t)vargp;
//enter table
table.push_back(tid);
//do actions at table
//leave table
table.remove(tid);
}
I am having an intermittent segmentation fault that I am pretty sure comes from two threads trying to remove themselves from the table at the same time. Using gdb, this is the backtrace I found:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x2aaacf005700 (LWP 44705)]
0x00000000004032db in std::_List_const_iterator<long>::operator++ (this=0x2aaacf004e10) at /usr/include/c++/4.8.2/bits/stl_list.h:235
235 _M_node = _M_node->_M_next;
Missing separate debuginfos, use: debuginfo-install glibc-2.17-324.el7_9.x86_64 libgcc-4.8.5-44.el7.x86_64 libstdc++-4.8.5-44.el7.x86_64
(gdb) bt
#0 0x00000000004032db in std::_List_const_iterator<long>::operator++ (this=0x2aaacf004e10) at /usr/include/c++/4.8.2/bits/stl_list.h:235
Python Exception <type 'exceptions.ValueError'> Cannot find type std::_List_const_iterator<long>::_Node:
Python Exception <type 'exceptions.ValueError'> Cannot find type std::_List_const_iterator<long>::_Node:
#1 0x0000000000402c6b in std::__distance<std::_List_const_iterator<long> > (__first=, __last=) at /usr/include/c++/4.8.2/bits/stl_iterator_base_funcs.h:82
Python Exception <type 'exceptions.ValueError'> Cannot find type std::_List_const_iterator<long>::_Node:
Python Exception <type 'exceptions.ValueError'> Cannot find type std::_List_const_iterator<long>::_Node:
#2 0x0000000000402386 in std::distance<std::_List_const_iterator<long> > (__first=, __last=) at /usr/include/c++/4.8.2/bits/stl_iterator_base_funcs.h:118
#3 0x0000000000401d31 in std::list<long, std::allocator<long> >::size (this=0x606430 <table3>) at /usr/include/c++/4.8.2/bits/stl_list.h:874
#4 0x0000000000401295 in customer (vargp=0xd) at project2.cc:129
#5 0x00002aaaab4f6ea5 in start_thread () from /lib64/libpthread.so.0
#6 0x00002aaaab8099fd in clone () from /lib64/libc.so.6
From this, I am pretty sure my problem lies with the remove() function, but I don't know how to fix it. Does anyone have a solution for this?
Never modify an object in one thread when another thread is, or might be, accessing it unless you are using an object that is specifically documented to permit that type of concurrency.
I've a function as follwing:
void function()
{
// open tcp port
}
Sorry but I can't post my source code here.
It work fine when I call this function from main, and when I try to move this function into a dll, it work okay on window and linux, but got crash on arm (signal 11 (Segmentation fault) - core dumped),
I tried to use gdb but the backtrace are insufficient information for me to trace.
Thread 5 "xxx" received signal SIGSEGV, Segmentation fault.
[Switching to LWP 23448]
0x00000000600c3cf9 in ?? ()
(gdb) bt
#0 0x00000000600c3cf9 in ?? ()
#1 0x0000000000000000 in ?? ()
Is there anyone have experience in this case ?
Thank you all in advance!
I faced with crash of my application when it stops. Gdb shows following stack (app is built with -g -O0):
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x00007f254ea99700 in ?? ()
#2 0x0000000000000000 in ?? ()
Short investigation has shown that crash happens during stopping a thread which is started the same way as many others in the app:
// mListener is std::thread and member of class UA
std::thread thr(&UA::run, this);
mListener = std::move(thr);
Then I ran gdb on app before stopping and saw the difference between stacks of thread caused crash and other threads.
All threads looks like:
...
#8 0x000000000043a70a in std::thread::_Impl<std::_Bind_simple<std::_Mem_fn<void (UI::Keyboard::*)()> (UI::Keyboard*)> >::_M_run() (this=0xa88fd0)
at /usr/include/c++/4.9/thread:115
#9 0x00007fb6055c3970 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#10 0x00007fb6083ff0a4 in start_thread (arg=0x7fb604042700) at pthread_create.c:309
#11 0x00007fb604d3304d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
But 'wrong' thread always looks different:
#0 sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
#1 0x000000000043317d in Semaphore::wait (this=0x7fb5fc0009e8) at /home/vadius/workspace/iPhone/core/src/Core/env/Semaphore.h:28
#2 0x0000000000432564 in SIP::UA::run (this=0x7fb5fc000980) at /home/vadius/workspace/iPhone/core/src/SIP/UA.cpp:132
#3 0x0000000000000000 in ?? ()
I assume that when thread exits from worker method (SIP::UA::run) it goes to code placed in nullptr.
My question is:
1. Am I right and stack of 'bad' thread is wrong?
2. What can be reason of such behavior and how to avoid it?
Debian jessie x64 /
GCC 4.9 /
Compile flags: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -DDEBUG -g -O0")
The giveaway is the "address". 432564 is "C%d". The bytes in a normal address are usually not all ASCII. This is a stack buffer overflow.
I am trying to read a stream of EXRs from one pipe, process them and write the results into a different pipe. This this case they are named pipes but they could just as well be stdin and stdout.
My problem occurs when the pipe runs dry. OpenEXR doesn't like trying to read nothing and crashes with the following stack trace.
(gdb) run in.exr out.exr
Starting program: /Users/jon/Library/Developer/Xcode/DerivedData/compressor-abhdftqzleulxsfkpidvcazfowwo/Build/Products/Debug/compressor in.exr out.exr
Reading symbols for shared libraries +++++++++......................................................................................................... done
Reading symbols for shared libraries ............ done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
terminate called throwing an exception
Program received signal SIGABRT, Aborted.
0x00007fff90957ce2 in __pthread_kill ()
(gdb) backtrace
#0 0x00007fff90957ce2 in __pthread_kill ()
#1 0x00007fff866f27d2 in pthread_kill ()
#2 0x00007fff866e3a7a in abort ()
#3 0x00007fff8643c7bc in abort_message ()
#4 0x00007fff86439fcf in default_terminate ()
#5 0x00007fff844d61cd in _objc_terminate ()
#6 0x00007fff8643a001 in safe_handler_caller ()
#7 0x00007fff86439fed in unexpected_defaults_to_terminate ()
#8 0x00007fff8643a040 in __cxxabiv1::__unexpected ()
#9 0x00007fff8643aefe in __cxa_call_unexpected ()
#10 0x0000000100008cfb in exr::ReadEXR (pixelBuffer=#0x7fff5fbfee00, is=#0x7fff5fbfeef8) at /Users/jon/Development/compressor/compressor/exr.cpp:47
#11 0x0000000100001c39 in main (argc=4, argv=0x7fff5fbffaa8) at /Users/jon/Development/compressor/compressor/main.cpp:79
I would really like OpenEXR to block the thread until more data becomes available but if there was some method of checking manually to see whether there is more data that would do, so long as it was somewhat robust.
Thanks.
The solution to this problem is indeed to extend Imf::Istream and implement it to block when the input pipe runs dry.
For this specific problem some considerations need to be made like pipes aren't seekable and d o not know their position, they can be worked around however.
I'm coding a game for Mac in c++, and I'm getting a SIGABRT, and the console prints the following:
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::bad_lexical_cast> >'
what(): bad lexical cast: source type value could not be interpreted as target
Program received signal: “SIGABRT”.
So, I'm doing a bad lexical_cast. But the problem is that I can't know where, because the call stack is as follows:
#0 0x7fff85fb629a in mach_msg_trap
#1 0x7fff85fb690d in mach_msg
#2 0x7fff81f58932 in __CFRunLoopRun
#3 0x7fff81f57dbf in CFRunLoopRunSpecific
#4 0x7fff88dba7ee in RunCurrentEventLoopInMode
#5 0x7fff88dba5f3 in ReceiveNextEventCommon
#6 0x7fff88dba4ac in BlockUntilNextEventMatchingListInMode
#7 0x7fff84f85e64 in _DPSNextEvent
#8 0x7fff84f857a9 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
#9 0x7fff84f4b48b in -[NSApplication run]
#10 0x7fff84f441a8 in NSApplicationMain
#11 0x1000ef759 in os_gameMainLoop at main-osx.mm:22
#12 0x10009a97d in main at words.cpp:18
That´s not the right stack.
What's match_msg_trap?
Whay am I getting this call stack?
Do I have any way to get a good call stack on the crash?
Thanks!
The debugger stopped in the wrong thread. Try t a a bt in GDB to see backtraces for all the threads.
mach_msg_trap is where threads park while they are waiting for a message to come in. So, you are looking at a thread that isn't running. Mach is the name of the message-passing interface on OS X.