Opened 6 years ago

#12475 new Bugs

boost::fast_pool_allocator causes a deadlock on Windows 7

Reported by: dictoon@… Owned by: Chris Newbold
Milestone: To Be Determined Component: pool
Version: Boost 1.61.0 Severity: Showstopper
Keywords: Cc:

Description

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

#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

#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

#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.

Attachments (1)

DxDiag.txt (41.9 KB ) - added by dictoon@… 6 years ago.
DxDiag output on a Windows 7 where the bug occurs

Download all attachments as: .zip

Change History (1)

by dictoon@…, 6 years ago

Attachment: DxDiag.txt added

DxDiag output on a Windows 7 where the bug occurs

Note: See TracTickets for help on using tickets.