[Boost-bugs] [Boost C++ Libraries] #12475: boost::fast_pool_allocator causes a deadlock on Windows 7

Subject: [Boost-bugs] [Boost C++ Libraries] #12475: boost::fast_pool_allocator causes a deadlock on Windows 7
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-09-21 13:31:33


#12475: boost::fast_pool_allocator causes a deadlock on Windows 7
------------------------------+-------------------------
 Reporter: dictoon@… | Owner: cnewbold
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: pool
  Version: Boost 1.61.0 | Severity: Showstopper
 Keywords: |
------------------------------+-------------------------
 When invoked from a DLL, Boost.Wave's C++ lexer causes the application to
 hang on Windows 7 (and only on Windows 7) and to crash when interrupted
 with CTRL+C on other Windows versions.

 Here is a minimal test program in two parts, a DLL and an EXE, that
 reproduces the problem:

 ==== DLL

 {{{#!cpp
 #include <boost/wave.hpp>
 #include <boost/wave/cpplexer/cpp_lex_token.hpp>
 #include <boost/wave/cpplexer/cpp_lex_iterator.hpp>

 __declspec(dllexport) void foo() {
     typedef boost::wave::cpplexer::lex_token<> token_type;
     typedef boost::wave::cpplexer::lex_iterator<token_type>
 lex_iterator_type;
     typedef boost::wave::context<std::string::iterator, lex_iterator_type>
 context_type;

     std::string s = "\n";
     context_type ctx(s.begin(), s.end());
     auto first = *ctx.begin();
 }
 }}}

 ==== EXE

 {{{#!cpp
 #include <stdio.h>

 __declspec(dllimport) void foo();

 int main() {
     foo();

     fprintf(stderr, "Press CTRL+C to terminate...\n");
     while (true) {}

     return 0;
 }
 }}}

 On Windows 7, this program will hang at startup, before entering
 {{{main()}}}. On other versions of Windows, the program will start and
 print the message, but pressing CTRL+C to terminate it will cause a crash.

 ----

 A deeper investigation reveals that the problem is actually caused by
 Boost's {{{fast_pool_allocator}}}. Here is another minimal example that
 triggers the same bug as the program above:

 ==== DLL

 {{{#!cpp
 #include <boost/pool/pool_alloc.hpp>
 #include <list>

 typedef std::list<
     int,
     boost::fast_pool_allocator<int>
> container;

 static container last;

 __declspec(dllexport) void foo() {}
 }}}

 ==== EXE

 //Same as in the previous program.//

 The symptoms of this program should be exactly the same as those of the
 previous one.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12475>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC