Core dump in the application


 
Thread Tools Search this Thread
Top Forums Programming Core dump in the application
# 1  
Old 09-16-2009
Core dump in the application

Hi,
I am facing an issue with the core dump, i am not exactly able to figure out why and where i am getting it and how should i resolve it
Please find the dbx run on the core
reading symbolic information ...
Segmentation fault in realloc_y at 0x900000000046980 ($t1)
0x900000000046980 (realloc_y+0x4fc) 90100000 stw r0,0x0(r16)
(dbx) where
realloc_y(??, ??, ??) at 0x900000000046980
realloc_y_heap(??, ??) at 0x9000000000475a0
sqlrlc(??, ??, ??, ??) at 0x800000000d6c764
sqlcopydfn(??, ??, ??, ??, ??) at 0x800000000d86250
sqlrdf(??, ??, ??, ??, ??, ??) at 0x800000000d865cc
sqlatm(??, ??, ??, ??, ??, ??, ??) at 0x800000000d88d74
sqlnst(??, ??, ??) at 0x800000000d82574
sqlcmex(??, ??, ??, ??, ??) at 0x800000000d74d18
sqlcxt(??, ??, ??, ??) at 0x800000000d74374
unnamed block $b297, line 7956 in "b_pc.c"
SelectSequenceActivity(??), line 7956 in "b_pc.c"
ProcessTravelDealRecord(pTravelDealRecord = 0x000000010007c290), line 5602 in "test.c"
ParseMainSec(??), line 818 in "a.c"
ParseBatch(??), line 192 in "a.c"
ProcessBatch(pBatch = 0x09001000a0003898), line 3198 in "test.c"
main(argc = 0, argv = (nil)), line 1108 in "test.c"

Please Advice
Regards
mad_man12
# 2  
Old 09-16-2009
Are you malloc'ing a large block of memory and then realloc'ing it to reduce or increase the size of this block of memory?

Can you show us the source for b_pc.c?

What OS are you on?
# 3  
Old 09-16-2009
Your heap is almost certainly being corrupted.

Most likely causes are writing too many bytes into a malloc'd/realloc'd/new'd/etc block, freeing a block multiple times, accessing a block after it's been freed.

Your best approach is to use some sort of memory debug/corruption detection tool. The best tool I know of is something like IBM's (originally Rational) Purify. IIRC, "realloc_y" is an indication you're running on AIX. I don't know for certain the Purify is available for AIX, but it probably is, and it'd probably be a good test case for a demo of Purify to see what it can do.

There are also others tools that provide similar memory-checking capabilities.
# 4  
Old 09-17-2009
Attaching file a_pc.txt

Thanks for the responses,
I have looked in the code but couldn't figure out the problem area
I am not having rational purifier.
Murphy i am attaching the file a_pc.c

Is there somewhere you see the bug is.

Regards
# 5  
Old 09-17-2009
These sure look questionable to me:
Code:
    vBase_Prod_Old[strlen(vBase_Prod_Old)] = '\0'; 
    vbase_prod[strlen(vbase_prod)] = '\0';

Those were the only variables using of heap memory I noted in that code, and that code snippet tells me someone's trying everything they can think of to patch over the problem. I'd make sure every possible use of strcpy() or similar is changed to an equivalent strncpy() to make sure the buffers those variables point to aren't overwritten.

I'd probably also convert them to stack variables:

Code:
    #define PROD_STR_LEN 32
       .
       .
       .
    char vbase_prod[ PROD_STR_LEN ];
       .
       .
       .
    strncpy( vbase_prod, some_source_str, sizeof( vbase_prod ) - 1 );
    vbase_prod[ sizeof( vbase_prod ) - 1 ] = '\0';
       .
       .
       .

There's a good chance that even doing all that won't work - I didn't see anything in that code that ensures the heap is being corrupted in the code you provided - it could be getting corrupted somewhere else in your application. ANYWHERE else in your application.

So, if the problem persists after that, go to your boss and explain to him that he can keep paying you and however many others are working on this problem $X per hour, or he can just pay for a real memory checking tool. Guess which one is going to be cheaper.

Look at it this way: would you expect someone to fix a car using only two screwdrivers and a pair of pliers? There are tools that make jobs easier, faster, and cheaper. A LOT easier, faster, and cheaper.
# 6  
Old 09-18-2009
Thanks achenle

Hi Achenle,

I tried the below code changes and I am trying more on it to see if there is anywhere else the cause of the problem.

I am looking at the possible use of MALLOCDEBUG

Thanks a lot for your inputs and yes i am surely going to reply my BOSS as mentioned by you:-)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

core dump

Hi guys, just want to know which core file pattern is best to set for core dumps: 1) per-process file name pattern or 2) global file name pattern. I will really appreciate an explanation why the chosen one is better. Thanks a lot guys. (2 Replies)
Discussion started by: cjashu
2 Replies

2. Programming

core dump

how to view core dumped file using gdb and how to extract information from the coredumped file.can we get similar information from the other utilites like strace or ptrace. (2 Replies)
Discussion started by: Manabhanjan
2 Replies

3. AIX

core dump

My application gives core dump. When i am debugging with dbx getting instructions below: pthdb_session.c, 818: 695445 PTHDB_INTERNAL (internal error) pthreaded.c, 1941: PTHDB_INTERNAL (internal error) Illegal instruction (illegal opcode) in . at 0x0 warning: Unable to access address 0x0... (1 Reply)
Discussion started by: bapi
1 Replies

4. UNIX for Advanced & Expert Users

Core Dump

Hello all, Iam new to unix while executing java program which finely working in windows know iam testing with unix ,but in unix while executing iam getting core dump, my application is in client server environment and it is menu drivrn application on clicking options no problem but after some time... (1 Reply)
Discussion started by: vinp
1 Replies

5. UNIX for Dummies Questions & Answers

Core dump in HP-UX..

Hi All I am new for this forum. I have a core file by using gdb and bt cmd I got the function name but I want to the exact cause of the core dump because of I can not reproduse the binary so if any one know the cmd plz plz plz let me know. (0 Replies)
Discussion started by: gyanusoni
0 Replies

6. UNIX for Advanced & Expert Users

core dump

Hi All, i am new to this forum.i want detail of reading the core file and trace the problem because of what the program get crashed.please help me.if any body knows any website or tutoril plese let me know. sudhir (6 Replies)
Discussion started by: sudhir patnaik
6 Replies

7. UNIX for Dummies Questions & Answers

core dump

I've got a core dump in my weblogic home directory, which i have tried to debug by initiating savecore from /etc/init.d/savecore start but savecore failed to create the two files, that is vmcore.n and vmunix.n. savecore is enable on my server to save vmcore and vmunix in /var/crash/hostname 1)... (4 Replies)
Discussion started by: hassan2
4 Replies

8. UNIX for Dummies Questions & Answers

core dump

Hi , Working on AIX 4.3. An internal error from my apps engine suddenly causes the engine to die. During this time i do notice a core file being dumped in the directory from where I try to re-start my engine. Q is how does one read this core file, or I should say 'what is this core file'? thnx (2 Replies)
Discussion started by: buRst
2 Replies

9. UNIX for Dummies Questions & Answers

core dump

does any one have read a core dump? is there any reader for that? or may i know what is the use of that core which takes sometimes memory in GBs? :) (6 Replies)
Discussion started by: sskb
6 Replies

10. UNIX for Dummies Questions & Answers

help, what is the difference between core dump and panic dump?

help, what is the difference between core dump and panic dump? (1 Reply)
Discussion started by: aileen
1 Replies
Login or Register to Ask a Question