title: C++ Boost read_json crash and I had #define BOOST_SPIRIT_THREADSAFE
body: <p>Recently other people upgraded our boost library, now I see this coredump when a read_json function is called heavily. Never seen this before. And I have #define BOOST_SPIRIT_THREADSAFE in the code, that's why this didn't happen before. Really need help!Thanks!</p>
  
  <p>Program terminated with signal 11, Segmentation fault.</p>
  
  <pre><code>    #0  0x00007f062ce0d094 in std::mem_fun1_t&lt;int, boost::spirit::classic::impl::grammar_helper_base&lt;boost::spirit::classic::grammar&lt;boost::property_tree::json_parser::json_grammar&lt;boost::property_tree::basic_ptree&lt;std::string, std::string, std::less&lt;std::string&gt; &gt; &gt;, boost::spirit::classic::parser_context&lt;boost::spirit::classic::nil_t&gt; &gt; &gt;, boost::spirit::classic::grammar&lt;boost::property_tree::json_parser::json_grammar&lt;boost::property_tree::basic_ptree&lt;std::string, std::string, std::less&lt;std::string&gt; &gt; &gt;, boost::spirit::classic::parser_context&lt;boost::spirit::classic::nil_t&gt; &gt;*&gt;::operator() (this=0x7f06120f4c90, __p=0x7f05f813faa0, __x=0x7f06120f4df0) at /usr/lib/gcc/x86_64-spcdn-linux-gnu/4.5.2/../../../../include/c++/4.5.2/bits/stl_function.h:605
              in /usr/lib/gcc/x86_64-spcdn-linux-gnu/4.5.2/../../../../include/c++/4.5.2/bits/stl_function.h
      #0  0x00007f062ce0d094 in std::mem_fun1_t&lt;int, boost::spirit::classic::impl::grammar_helper_base&lt;boost::spirit::classic::grammar&lt;boost::property_tree::json_parser::json_grammar&lt;boost::property_tree::basic_ptree&lt;std::string, std::string, std::less&lt;std::string&gt; &gt; &gt;, boost::spirit::classic::parser_context&lt;boost::spirit::classic::nil_t&gt; &gt; &gt;, boost::spirit::classic::grammar&lt;boost::property_tree::json_parser::json_grammar&lt;boost::property_tree::basic_ptree&lt;std::string, std::string, std::less&lt;std::string&gt; &gt; &gt;, boost::spirit::classic::parser_context&lt;boost::spirit::classic::nil_t&gt; &gt;*&gt;::operator() (this=0x7f06120f4c90, __p=0x7f05f813faa0, __x=0x7f06120f4df0) at /usr/lib/gcc/x86_64-spcdn-linux-gnu/4.5.2/../../../../include/c++/4.5.2/bits/stl_function.h:605
      #1  0x00007f062ce0c66e in std::binder2nd&lt;std::mem_fun1_t&lt;int, boost::spirit::classic::impl::grammar_helper_base&lt;boost::spirit::classic::grammar&lt;boost::property_tree::json_parser::json_grammar&lt;boost::property_tree::basic_ptree&lt;std::string, std::string, std::less&lt;std::string&gt; &gt; &gt;, boost::spirit::classic::parser_context&lt;boost::spirit::classic::nil_t&gt; &gt; &gt;, boost::spirit::classic::grammar&lt;boost::property_tree::json_parser::json_grammar&lt;boost::property_tree::basic_ptree&lt;std::string, std::string, std::less&lt;std::string&gt; &gt; &gt;, boost::spirit::classic::parser_context&lt;boost::spirit::classic::nil_t&gt; &gt;*&gt; &gt;::operator() (this=0x7f06120f4c90, __x=@0x7f06001446e0) at /usr/lib/gcc/x86_64-spcdn-linux-gnu/4.5.2/../../../../include/c++/4.5.2/backward/binders.h:154
      #2  0x00007f062ce0b87e in std::for_each&lt;std::reverse_iterator&lt;__gnu_cxx::__normal_iterator&lt;boost::spirit::classic::impl::grammar_helper_base&lt;boost::spirit::classic::grammar&lt;boost::property_tree::json_parser::json_grammar&lt;boost::property_tree::basic_ptree&lt;std::string, std::string, std::less&lt;std::string&gt; &gt; &gt;, boost::spirit::classic::parser_context&lt;boost::spirit::classic::nil_t&gt; &gt; &gt;**, std::vector&lt;boost::spirit::classic::impl::grammar_helper_base&lt;boost::spirit::classic::grammar&lt;boost::property_tree::json_parser::json_grammar&lt;boost::property_tree::basic_ptree&lt;std::string, std::string, std::less&lt;std::string&gt; &gt; &gt;, boost::spirit::classic::parser_context&lt;boost::spirit::classic::nil_t&gt; &gt; &gt;*, std::allocator&lt;boost::spirit::classic::impl::grammar_helper_base&lt;boost::spirit::classic::grammar&lt;boost::property_tree::json_parser::json_grammar&lt;boost::property_tree::basic_ptree&lt;std::string, std::string, std::less&lt;std::string&gt; &gt; &gt;, boost::spirit::classic::parser_context&lt;boost::spirit::classic::nil_t&gt; &gt; &gt;*&gt; &gt; &gt; &gt;, std::binder2nd&lt;std::mem_fun1_t&lt;int, boost::spirit::classic::impl::grammar_helper_base&lt;boost::spirit::classic::grammar&lt;boost::property_tree::json_parser::json_grammar&lt;boost::property_tree::basic_ptree&lt;std::string, std::string, std::less&lt;std::string&gt; &gt; &gt;, boost::spirit::classic::parser_context&lt;boost::spirit::classic::nil_t&gt; &gt; &gt;, boost::spirit::classic::grammar&lt;boost::property_tree::json_parser::json_grammar&lt;boost::property_tree::basic_ptree&lt;std::string, std::string, std::less&lt;std::string&gt; &gt; &gt;, boost::spirit::classic::parser_context&lt;boost::spirit::classic::nil_t&gt; &gt;*&gt; &gt; &gt; (__first=..., __last=..., __f=...) at /usr/lib/gcc/x86_64-spcdn-linux-gnu/4.5.2/../../../../include/c++/4.5.2/bits/stl_algo.h:4185
      #3  0x00007f062ce0aa88 in boost::spirit::classic::impl::grammar_destruct&lt;boost::spirit::classic::grammar&lt;boost::property_tree::json_parser::json_grammar&lt;boost::property_tree::basic_ptree&lt;std::string, std::string, std::less&lt;std::string&gt; &gt; &gt;, boost::spirit::classic::parser_context&lt;boost::spirit::classic::nil_t&gt; &gt; &gt; (self=0x7f06120f4df0) at /usr/include/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp:324
      #4  0x00007f062ce09c5f in boost::spirit::classic::grammar&lt;boost::property_tree::json_parser::json_grammar&lt;boost::property_tree::basic_ptree&lt;std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::less&lt;std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; &gt;, boost::spirit::classic::parser_context&lt;boost::spirit::classic::nil_t&gt; &gt;::~grammar (this=0x7f06120f4df0, __in_chrg=&lt;optimized out&gt;) at /usr/include/boost/spirit/home/classic/core/non_terminal/grammar.hpp:52
      #5  0x00007f062ce093f7 in boost::property_tree::json_parser::json_grammar&lt;boost::property_tree::basic_ptree&lt;std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::less&lt;std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; &gt;::~json_grammar (this=0x7f06120f4df0, __in_chrg=&lt;optimized out&gt;) at /usr/include/boost/property_tree/detail/json_parser_read.hpp:162
      #6  0x00007f062ce0987f in boost::property_tree::json_parser::read_json_internal&lt;boost::property_tree::basic_ptree&lt;std::string, std::string, std::less&lt;std::string&gt; &gt; &gt; (stream=..., pt=..., filename="") at /usr/include/boost/property_tree/detail/json_parser_read.hpp:310
      #7  0x00007f062ce08eb6 in boost::property_tree::json_parser::read_json&lt;boost::property_tree::basic_ptree&lt;std::string, std::string, std::less&lt;std::string&gt; &gt; &gt; (stream=..., pt=...) at /usr/include/boost/property_tree/json_parser.hpp:45
  </code></pre>