Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#8586 closed Bugs (duplicate)

Boost Thread .join() causes exception. Intel C++ 13.1.1. Windows XP SP3

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

Description (last modified by viboes)

Hello, sorry for my bad english.

I just compiled a test example:

#include <boost/thread/thread.hpp>
#include <iostream>

void hello_world()
{
    std::cout << "Hello from thread!" << std::endl;
}

int main()
{
    boost::thread my_thread(&hello_world);
    my_thread.join();
}

And when my_thread.join(); calls I get an exception.

Boost 1.53.0: One error: http://i.imgur.com/J2zpjQ0.png Boost 1.52.0: Two errors: http://i.imgur.com/CekLb8O.png Boost 1.51.0: No errors. Boost 1.48.0: No errors.

I use Intel C++ Compiler 13.1.1. Windows XP SP3. I compile Boost: call bjam toolset="intel" ---build-type=complete threading=multi link=static runtime-link=static

Change History (18)

comment:1 by viboes, 9 years ago

Description: modified (diff)
Owner: changed from Anthony Williams to viboes
Status: newassigned

comment:2 by viboes, 9 years ago

Could you report the stack from where the exception is thrown?

comment:3 by viboes, 9 years ago

Does it works for Intel 12.x?

in reply to:  3 comment:4 by Alexey <lakmus@…>, 9 years ago

Replying to viboes:

Does it works for Intel 12.x?

Hello, I compiled this example on Intel 12.0.1 too, same results for all four versions of boost I used before:

Thread_Boost1.53.0_ICC13.1.1.exe - bug
Thread_Boost1.52.0_ICC13.1.1.exe - bug
Thread_Boost1.51.0_ICC13.1.1.exe - works fine
Thread_Boost1.48.0_ICC13.1.1.exe - works fine
Thread_Boost1.53.0_ICC12.0.1.exe - bug
Thread_Boost1.52.0_ICC12.0.1.exe - bug
Thread_Boost1.51.0_ICC12.0.1.exe - works fine
Thread_Boost1.48.0_ICC12.0.1.exe - works fine

It's ok if I provide executable files for all results? You can grab it here: http://rghost.ru/46127334. I tried to debug Thread_Boost1.53.0_ICC13.1.1.exe in OllyDBG and that what I got: http://i.imgur.com/VyDtVL1.png. I hope it helps. Please tell me if you need more information from me.

comment:5 by viboes, 9 years ago

No the executables are of any use. However the fact that both version match the results mean that the problem should come from an evolution on Boost 1.52 that doesn't works correctly with Intel compiler.

I was expecting a symbolic stack :( This is a must to take care of a crash.

Could you tell me if adding a sleep on the thread function avoid the crash?

in reply to:  5 ; comment:6 by Alexey <lakmus@…>, 9 years ago

Replying to viboes:

No the executables are of any use. However the fact that both version match the results mean that the problem should come from an evolution on Boost 1.52 that doesn't works correctly with Intel compiler.

I was expecting a symbolic stack :( This is a must to take care of a crash.

I tried to get call stack and what I got:

  1. When I attach to process after exception - http://i.imgur.com/ke7ze5v.png
  2. When I start to debug process from beginning - http://i.imgur.com/uvFO9k8.png

I'm sorry if it's might be not helpful, I use Visual Studio very rare, so I'm not very experienced in it.

Could you tell me if adding a sleep on the thread function avoid the crash?

I tried to add this code

boost::this_thread::sleep_for(boost::chrono::milliseconds(10000));

after "Hello from thread!" message, but no difference, still crashes.

in reply to:  6 ; comment:7 by viboes, 9 years ago

Replying to Alexey <lakmus@…>:

Replying to viboes:

No the executables are of any use. However the fact that both version match the results mean that the problem should come from an evolution on Boost 1.52 that doesn't works correctly with Intel compiler.

I was expecting a symbolic stack :( This is a must to take care of a crash.

I tried to get call stack and what I got:

  1. When I attach to process after exception - http://i.imgur.com/ke7ze5v.png

Thanks for this execution context. Could you show the complete symbolic stack?

  1. When I start to debug process from beginning - http://i.imgur.com/uvFO9k8.png

I'm sorry if it's might be not helpful, I use Visual Studio very rare, so I'm not very experienced in it.

Could you tell me if adding a sleep on the thread function avoid the crash?

I tried to add this code

boost::this_thread::sleep_for(boost::chrono::milliseconds(10000));

after "Hello from thread!" message, but no difference, still crashes.

OK. At lest we know it is around the thread destruction.

in reply to:  7 ; comment:8 by Alexey <lakmus@…>, 9 years ago

Replying to viboes:

Thanks for this execution context. Could you show the complete symbolic stack?

I'm not sure where is complete symbolic stack in MSVS, but I managed to dig this windows when I loaded pdb information in debugger:

http://i.imgur.com/SBGlCOp.png

http://i.imgur.com/Ys8taGg.png

Is this helpful?

in reply to:  8 comment:9 by viboes, 9 years ago

Replying to Alexey <lakmus@…>:

Replying to viboes:

Thanks for this execution context. Could you show the complete symbolic stack?

I'm not sure where is complete symbolic stack in MSVS, but I managed to dig this windows when I loaded pdb information in debugger:

http://i.imgur.com/SBGlCOp.png

http://i.imgur.com/Ys8taGg.png

Is this helpful?

Not too much :(

comment:10 by viboes, 9 years ago

I don't reach to reproduce the error. Please, could you try defining BOOST_THREAD_DONT_USE_ATOMIC?

in reply to:  10 comment:11 by Alexey <lakmus@…>, 9 years ago

Replying to viboes:

I don't reach to reproduce the error. Please, could you try defining BOOST_THREAD_DONT_USE_ATOMIC?

Still receive an error.

comment:12 by viboes, 9 years ago

Could you try dynamic allocation?

int main()
{
    boost::thread* my_thread = new boost::thread(&hello_world);
    my_thread->join();
    delete my_thread;
}

and also

int main()
{
    boost::thread my_thread(&hello_world);
    boost::this_thread::sleep_for(boost::chrono::milliseconds(10000));
    my_thread.join();
}

in reply to:  12 comment:13 by Alexey <lakmus@…>, 9 years ago

Replying to viboes:

int main()
{
    boost::thread* my_thread = new boost::thread(&hello_world);
    my_thread->join();
    delete my_thread;
}

Still error.

int main()
{
    boost::thread my_thread(&hello_world);
    boost::this_thread::sleep_for(boost::chrono::milliseconds(10000));
    my_thread.join();
}

Error after 10 sec. With BOOST_THREAD_DONT_USE_ATOMIC both results are the same too.

comment:14 by viboes, 9 years ago

Summary: Boost Thread .join() causes exceptionBoost Thread .join() causes exception. Intel C++ 13.1.1. Windows XP SP3

comment:15 by viboes, 9 years ago

Isn't this a duplicate of #7666?

comment:16 by viboes, 9 years ago

Resolution: duplicate
Status: assignedclosed

comment:17 by viboes, 9 years ago

With which options was built Boost? Please show the result of bjam with -d2 option

bjam toolset="intel" ---build-type=complete threading=multi link=static runtime-link=static -d2

And your program?

What is the size of boost::detail::thread_data_base on your program? And in a Boost.Thread test?

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

comment:18 by viboes, 9 years ago

I suspect that this is related to an ABI incompatibility.

Note: See TracTickets for help on using tickets.