I've run into a bug that I'm having a very difficult time locating that I'm hoping you can provide some guidance on.
I have a test that is producing the following error:
I suspect an XS module I'm using is doing something bad. I've done a fair bit of research into this and tried these approaches at isolating the bug:*** glibc detected *** perl: corrupted double-linked list
1) set the MALLOC_CHECK_ environment variable. There was some success here as the error changed to this:
2) I tried to run this under gdb to hopefully get a stack trace so I can find the offending function. I have done this in the past to debug seg faults successfully:*** glibc detected *** perl: realloc(): invalid pointer
This time I got no additional information. The invalid pointer error is still thrown (assuming MALLOC_CHECK_ is set, otherwise it's the linked list error) with no additional stack trace information. I'm assuming this is due to a lack of debugging symbols.> gdb perl (gdb) set args <args> (gdb) run
3) I have tried to run this under valgrind. Initially, I got a valgrind error that VG_N_SEGMENTS was too low. I recompiled valgrind with a higher limit here. The code now passes entirely every time I run it under valgrind.
So I seem to have no additional useful information from my limited C debugging skill set.
Can any kind monk offer some guidance on what next steps I might take to debug this issue? I would offer code but it's far too complex without being able to localize the issue, so I apologize on that front.
Thanks in advance for your time, it's much appreciated :)
EDIT: I suppose some version information would be good. This is red hat enterprise linux 10 and perl 5.12.2. I can give any other information that would be useful.
EDIT2: Make that SUSE Linux Enterprise Server 10 (x86_64). Not sure where I got red hat from as the last time I did anything with that was years ago in school.
############################################################################
I managed to resolve the issue and wanted I'd post the details here just in case it may be useful to someone else.
As it turned out, the problem was my assumption that an XS module was at fault. I was basing this on the error and that the problem was occurring pretty close to some of my own XS code. Turns out the problem was a simple perl side issue.
The clue that I missed was that the code was taking significantly longer to execute than it should have and that I was getting some output that mentioned a memory wrap after the error from above.
The real issue was a bad (very large) loop variable outside the XS code that was causing the process to allocate all its memory, resulting in perl throwing the memory error above.
I am unclear on why the code would complete under valgrind. I do know that once I realized the issue and started watching memory, the process was consuming upwards of 50G of memory. I am also unclear why I didn't get any point of failure information from gdb...although once you're out of memory I suppose all bets are off.
Thanks to all for the great insights, especially the information about MALLOC_CHECK_ values and the valgrind options. I appreciate it!
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |