Ace128 has asked for the wisdom of the Perl Monks concerning the following question:

Well, I must use some kind of thread here, but using that I get this warning - "mysqlPP has no driver CLONE() function so is unsafe threaded". Now, this aint good, and the application crasches. I also get this just before it crashes:

thread failed to start: DBD::mysqlPP::dr connect failed: handle 1 is owned by thread 27448c not current thread 44e153c (handles can't be shared between threads and your driver may need a CLONE method added) at C:\Perl\site\lib/DBI.pm line 596.

Ideas how to solve this? Apparently, the DBD::mysql works fine, but as I understand it DBD::mysqlPP is better?

Update: Wierd, seems it works with DBD::mysqlPP too! Hmm... Seems like some collition with "require" other scripts... and creating new db objects...

Thanks, Ace
  • Comment on mysqlPP has no driver CLONE() function so is unsafe threaded

Replies are listed 'Best First'.
Re: mysqlPP has no driver CLONE() function so is unsafe threaded
by BrowserUk (Patriarch) on Aug 02, 2005 at 03:17 UTC
    Ideas how to solve this?

    That really depends upn what "this" is. Ie. What are you currently trying to achieve by sharing a DB handle?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
      Seems like a missed DB handle was created at a place it shouldn't be at...

        It's not clear to me from the above whether you have solved your problem or not?

        The basic gist of the problem (from reading the error message you posted), is that your code created a db handle in one thread and then attempted to use from another.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
        "Science is about questioning the status quo. Questioning authority".
        The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
Re: mysqlPP has no driver CLONE() function so is unsafe threaded
by jZed (Prior) on Aug 02, 2005 at 14:46 UTC
    Apparently, the DBD::mysql works fine, but as I understand it DBD::mysqlPP is better?
    Where did you get that idea? DBD::mysqlPP has the ability to be installed without compilation but other than that I don't think it has any advantages over DBD::mysql. DBD::mysql is much faster and has more capabilities (recent ones with true prepare). DBD::mysqlPP was last updated over two and half years ago while DBD::mysql was updated over a dozen times in that period. One of the maintainers of DBD::mysql works for MySQL AB. I'm not knocking DBD::mysqlPP - it's a great hack for situations in which the other can't be installed (a situation that was much more common a few years ago) but for production work, I'd definitely recommend DBD::mysql, especially when using newer versions of MySQL.