Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

tracking "stack smashing detected"

by manoj123 (Initiate)
on Oct 27, 2009 at 13:09 UTC ( #803429=perlquestion: print w/replies, xml ) Need Help??
manoj123 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, Am a perl newbie working around an existing perl codebase which works with MySQL DB. My script execution is aborted with "*** stack smashing detected ***: perl terminated" error. I know it is hard to suggest a fix without the code. I am looking for ways to track to the source of the problem. Tried by commenting lines of code and push method on an array seem to be the source but the error log (below) confuses me.
*** stack smashing detected ***: perl terminated ======= Backtrace: ========= /lib/[0xb0a90b] /lib/[0xb0a8c0] /usr/local/lib/perl/5.8.8/auto/DBD/mysql/[0xfc75f4] /usr/local/lib/perl/5.8.8/auto/DBD/mysql/ +[0xfb489a] /usr/local/lib/perl/5.8.8/auto/DBD/mysql/ +nd_param+0x1fe)[0xfc43de]
Any suggestions welcome

Replies are listed 'Best First'.
Re: tracking "stack smashing detected"
by almut (Canon) on Oct 27, 2009 at 13:59 UTC
    I am looking for ways to track to the source of the problem. (...) but the error log (below) confuses me.

    The error message simply means that glibc's stack protection routines fired due to a corruption of the (C level) stack. Unfortunately, the reasons for this happening are manifold, and detailed knowledge of the internals right down to the assembly level might be required to succesfully debug such things. It could be a buffer overflow, mismatching ABIs (binary interfaces) of the libraries involved, etc. As the last stack frame reported for is just an address (without a name), it's likely that the stack (typically function call return address) has already been messed up before that point, which means you'd have to start looking from mysql_bind_ph...

    OTOH, unless you're already familiar with tools such as gdb and valgrind (or would like to learn using them), I'd suggest you try approaching the problem at a somewhat higher level first — maybe you don't need to spend your time debugging things that someone else may already have fixed...   In other words, try upgrading or reinstalling the components involved, check if compatible libs are being loaded (for example, if the MySQL shared lib ( that the Perl binding DBD/mysql/ loads is the one that it was originally linked against), etc.

Re: tracking "stack smashing detected"
by mje (Curate) on Oct 27, 2009 at 13:14 UTC

    When I last got this I found the problem with valgrind.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://803429]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2017-01-22 14:10 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (187 votes). Check out past polls.