Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#8508 closed Bugs (worksforme)

Created thread segfaults when memory is scarce

Reported by: anonymous Owned by: viboes
Milestone: To Be Determined Component: thread
Version: Boost 1.53.0 Severity: Problem
Keywords: Cc:

Description

The following code will segfault in the created thread if memory is scarce:

#include <boost/thread/thread.hpp>

void thread_main()
{
}

int main(void)
{
        boost::thread t(thread_main);
        t.join();
}

This was run in GDB with ulimit -v 150000 applied beforehand. You'll have to experiment with the exact value.

GDB output:

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7ffff69d5700 (LWP 2913)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff69d5700 (LWP 2913)]
0x00007ffff7bd593e in boost::detail::get_once_per_thread_epoch() () from /usr/lib/libboost_thread.so.1.53.0

Backtrace:

#0  0x00007ffff7bd593e in boost::detail::get_once_per_thread_epoch() () from /usr/lib/libboost_thread.so.1.53.0
#1  0x00007ffff7bcf3b2 in ?? () from /usr/lib/libboost_thread.so.1.53.0
#2  0x00007ffff7bcf689 in boost::detail::set_current_thread_data(boost::detail::thread_data_base*) ()
   from /usr/lib/libboost_thread.so.1.53.0
#3  0x00007ffff7bcf9ff in ?? () from /usr/lib/libboost_thread.so.1.53.0
#4  0x00007ffff6be5dd2 in start_thread () from /usr/lib/libpthread.so.0
#5  0x00007ffff6edfced in clone () from /usr/lib/libc.so.6

Change History (5)

comment:1 by viboes, 9 years ago

Owner: changed from Anthony Williams to viboes
Status: newassigned

Please, could you try with trunk?

comment:2 by viboes, 9 years ago

I suspect that I don't set the limit correctly. I have do

ulimit -v 200

and no error is signaled on trunk.

BTW, what -v do on your system. It set the virtual memory on mine. Could you send me the result of ulimit -a?

Last edited 9 years ago by viboes (previous) (diff)

comment:3 by viboes, 9 years ago

Resolution: worksforme
Status: assignedclosed

If you don't help me I can not help you.

comment:4 by anonymous, 9 years ago

Hello,

I have encounter the same problem with:

ulimit -Sd 450000 -Sm 450000 -Sv 450000 ; gdb ./bin/a.out

Using boost lib 1.53.0 an CXX_FLAGS="-march=corei7 -O2 -pipe"

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff34f4700 (LWP 31454)]
0x00007ffff75363eb in boost::detail::get_once_per_thread_epoch() () from /usr/lib64/libboost_thread.so.1.53.0
(gdb) where
#0  0x00007ffff75363eb in boost::detail::get_once_per_thread_epoch() () from /usr/lib64/libboost_thread.so.1.53.0
#1  0x00007ffff7534b48 in void boost::call_once<void (*)()>(boost::once_flag&, void (*)()) () from /usr/lib64/libboost_thread.so.1.53.0
#2  0x00007ffff75310e7 in boost::detail::set_current_thread_data(boost::detail::thread_data_base*) () from /usr/lib64/libboost_thread.so.1.53.0
#3  0x00007ffff7531159 in ?? () from /usr/lib64/libboost_thread.so.1.53.0
#4  0x00007ffff59a2ec6 in start_thread () from /lib64/libpthread.so.0
#5  0x00007ffff5ca2dfd in clone () from /lib64/libc.so.6

Some advice or patch indication would be awesome.

Regards,

comment:5 by anonymous, 9 years ago

FYI not reproducible on this rev, getting well SIGABRT.

URL : http://svn.boost.org/svn/boost/trunk Racine du dépôt : http://svn.boost.org/svn/boost UUID du dépôt : b8fc166d-592f-0410-95f2-cb63ce0dd405 Révision : 85324

Note: See TracTickets for help on using tickets.