List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:July 11 2014 8:05pm
Subject:Re: Problem with attempt to share a Connection between threads
View as plain text  
On 7/11/2014 13:44, Damien Kick wrote:
>
> $ ./zeros.og
> Segmentation fault: 11 (core dumped)
> $ ./zeros.og
> Exec time (in seconds): 18.1346
> $ ./zeros.og
> Segmentation fault: 11 (core dumped)
> $ ./zeros.og
> Segmentation fault: 11 (core dumped)
> $ ./zeros.og
> Exec time (in seconds): 19.5771
> $ gdb zeros.og

Classic symptom of a race condition.

> void my::work(
>     const std::string& db_name,
>     const std::string& server,
>     const std::string& username,
>     const std::string& password)
> {
>     assert(mysqlpp::Connection::thread_aware());
>     mysqlpp::Connection cxn(
>         db_name.c_str(), server.c_str(), username.c_str(),

Thank you for rewriting this as connection-per-thread.  It greatly 
simplifies diagnosis.

> (gdb) bt
> #0  0x00000001000b88de in my_stat ()
> #1  0x0000000000000000 in ?? ()
> (gdb)

So, either the stack is so trashed by this point that MySQL++'s fault in 
the matter is obscured, or MySQL++ is not at fault.

What happens when you run it under valgrind --tool=helgrind?

     http://valgrind.org/docs/manual/hg-manual.html

A regular Valgrind run (memcheck) may also be enlightening.  Because it 
catches the first incorrect memory access -- rather than the one that 
finally steps over the process's memory bounds, causing a segmentation 
fault -- its core dumps often give a stack traces from the time just 
before the first damage occurs.
Thread
Problem with attempt to share a Connection between threadsDamien Kick10 Jul 2014
  • Re: Problem with attempt to share a Connection between threadsWarren Young11 Jul 2014
    • Re: Problem with attempt to share a Connection between threadsDamien Kick11 Jul 2014
      • Re: Problem with attempt to share a Connection between threadsWarren Young11 Jul 2014
        • Re: Problem with attempt to share a Connection between threadsDamien Kick11 Jul 2014
          • Re: Problem with attempt to share a Connection between threadsWarren Young11 Jul 2014
            • Re: Problem with attempt to share a Connection between threadsDamien Kick11 Jul 2014
              • Re: Problem with attempt to share a Connection between threadsDamien Kick11 Jul 2014
                • Re: Problem with attempt to share a Connection between threadsWarren Young11 Jul 2014
              • Re: Problem with attempt to share a Connection between threadsWarren Young11 Jul 2014
                • Re: Problem with attempt to share a Connection between threadsDamien Kick11 Jul 2014
                  • Re: Problem with attempt to share a Connection between threadsWarren Young11 Jul 2014
                    • Re: Problem with attempt to share a Connection between threadsDamien Kick11 Jul 2014
                      • Re: Problem with attempt to share a Connection between threadsAdrian Cornish11 Jul 2014
  • Re: Problem with attempt to share a Connection between threadsChris Frey13 Jul 2014
Re: Problem with attempt to share a Connection between threadsDamien Kick11 Jul 2014
  • Re: Problem with attempt to share a Connection between threadsWarren Young11 Jul 2014