List:MySQL++« Previous MessageNext Message »
From:Drew M. Date:June 3 2006 7:44pm
Subject:Re: Segmention fault with several connections
View as plain text  
It would appear that the issue isn't so much multiple mysqlpp::Connections
coexisting, but an issue with the assignment operator. The stack trace you
provided indicates that your program isn't even getting to your declaration
of b. I tried running the code you provided with a few modifications to get
it to compile, and the code hung. However, by commenting out the two
assignment lines (con= ...) it ran and exited fine.

It appears to me that using an assignment operator on mysqlpp::Connection is
a behavior which hasn't been accounted for. A few minutes of poking around
leads me to suspect that the issue is actually with Lockable (which is
inherited by Connection). In any case, I think the most expedient thing for
you to do is not use the =operator. You should be able to supply whatever
arguments you need directly to the constructor.

-Drew


On 6/2/06, Tomas Fischer < tomas_fischer99@stripped> wrote:
>
> Hi,
>
> isn't it possible to create several
> mysqlpp::Connections? Both of them use same db, host,
> user. Code below doesn't work.
>
> class A {
>   A() {
>     mysqlpp::Connection con;
>     con= mysqlpp::Connection::Connection(...);
>   }
> };
>
> class B {
>   B() {
>     mysqlpp::Connection con;
>     con= mysqlpp::Connection::Connection(...);
>   }
> };
>
> int main() {
>   A a;
>   B b;
>   return 0;
> }
>
> Using g++ 4.0.4
> mysql++: Version: 2.0.7-2+b1 (Debian).
>
> It doesn't matter if con are objects or pointers.
>
> Best regards,
> Tomas.
>
>
> gdb trace-back:
> #0  0x080498e9 in
> mysqlpp::Connection::OptionInfo::operator= ()
> #1  0x08049974 in std::__copy<false,
>
>
> std::random_access_iterator_tag>::copy<std::_Deque_iterator<mysqlpp::Connection::OptionInfo,
> mysqlpp::Connection::OptionInfo const&,
> mysqlpp::Connection::OptionInfo const*>,
> std::_Deque_iterator<mysqlpp::Connection::OptionInfo,
> mysqlpp::Connection::OptionInfo&,
> mysqlpp::Connection::OptionInfo*> >
>     ()
> #2  0x08049a4c in
> std::__copy_aux<std::_Deque_iterator<mysqlpp::Connection::OptionInfo,
> mysqlpp::Connection::OptionInfo const&,
> mysqlpp::Connection::OptionInfo const*>,
> std::_Deque_iterator<mysqlpp::Connection::OptionInfo,
> mysqlpp::Connection::OptionInfo&,
> mysqlpp::Connection::OptionInfo*> > ()
> #3  0x08049af0 in std::__copy_normal<false,
> false>::copy_n<std::_Deque_iterator<mysqlpp::Connection::OptionInfo,
> mysqlpp::Connection::OptionInfo const&,
> mysqlpp::Connection::OptionInfo const*>,
> std::_Deque_iterator<mysqlpp::Connection::OptionInfo,
> mysqlpp::Connection::OptionInfo&,
> mysqlpp::Connection::OptionInfo*> > ()
> #4  0x08049b9c in
> std::copy<std::_Deque_iterator<mysqlpp::Connection::OptionInfo,
> mysqlpp::Connection::OptionInfo const&,
> mysqlpp::Connection::OptionInfo const*>,
> std::_Deque_iterator<mysqlpp::Connection::OptionInfo,
> mysqlpp::Connection::OptionInfo&,
> mysqlpp::Connection::OptionInfo*> > ()
> #5  0x0804c8ed in
> std::deque<mysqlpp::Connection::OptionInfo,
> std::allocator<mysqlpp::Connection::OptionInfo>
> >::operator= ()
> #6  0x0804ca5f in mysqlpp::Connection::operator= ()
> #7  0x0804caf2 in A::A ()
> #8  0x08048afb in main ()
>
>
> __________________________________________________
> Do You Yahoo!?
> Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz
> gegen Massenmails.
> http://mail.yahoo.com
>
> --
> MySQL++ Mailing List
> For list archives: http://lists.mysql.com/plusplus
> To unsubscribe:    http://lists.mysql.com/plusplus?unsub=1
>
>

Thread
Segmention fault with several connectionsTomas Fischer2 Jun
  • Re: Segmention fault with several connectionsDrew M.3 Jun
    • Re: Segmention fault with several connectionsTomas Fischer3 Jun
    • Re: Segmention fault with several connectionsWarren Young26 Jun