Operating System - HP-UX
1822438 Members
2802 Online
109642 Solutions
New Discussion юеВ

Segmentation fault (core dumped); what is it?

 
dong_1
Contributor

Segmentation fault (core dumped); what is it?

I 'm working with HP-UX 11.00. I have met the following error:
Segmentation fault (core dumped)
What is it? Can you help me to resolve it?.
Thanks
Best Regards.
8 REPLIES 8
Patrick Wallek
Honored Contributor

Re: Segmentation fault (core dumped); what is it?

It means a program had a problem and abnormally terminated and generated a core dump. You can see what program did this by doing:

# file core

The core file is generated in whatever directory you were in when you started the program.
Steven E. Protter
Exalted Contributor

Re: Segmentation fault (core dumped); what is it?

If your application consistently produces core dumps, consider recompiling or relinking it.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Hein van den Heuvel
Honored Contributor

Re: Segmentation fault (core dumped); what is it?

[SEP, I'm not aiming to go against you in particular. It's just that I happen to disagree with two replies in a row that happen to be yours. I value you input and help in general!]

SEP wrote: "If your application consistently produces core dumps, consider recompiling or relinking it."


I suppose a binary could experience bit-rot and go bad over time? If that can happen then recompile can create a fresh image for a few more executions. But more likely a recompile will recreate the exact same image.
Actually... just check that with 'diff'!

Admittedly, the core dump may be a consequence of badly generated code, and a new compiler may just do a better job. Could happen. Unlikely, but it could happen. Or it could pick up a fixed library module. Could happen (if you applied patches since the last build)

In my experience core dumps are 99% sure to be application program bugs/weaknesses. Programs that do not have enough 'defense' against unhandled conditions like 'more data then yesterday', 'file not found', 'not enough shmmax', 'bad timing', 'insuffficient system resources'...

You have to check what the program was trying to do at the time of the problem.

It may also help to try to understand the differences in circumstances on times the program fails versus when it works. It does seem to work some times does it?!. Is it trying to server more sockets? Does it have to deal with a larger input file? You'll need pretty deep application knowledge to understand what migth be wrong, or to rule out and application prolem and refocus on a compiler/library/kernel problem.

Good luck!
Hein.
Jim Butler
Valued Contributor

Re: Segmentation fault (core dumped); what is it?

segmentation faults - ahhh - how fun they are..
do you also get a bus error before?

If so, you may be missing a required file, or library.

Are you compiling, or simply running an app?
if you are just running an app that should run, have you recently played with the kernel? has the app grown in size? If you answered yes to either of these.. you may have an issue in the kernel.

so basically, it could be anything -
good luck
Man The Bilge Pumps!
Mark Grant
Honored Contributor

Re: Segmentation fault (core dumped); what is it?

Most of the time you are writing to a region of memory you haven't actually allocated either at compile time or through malloc. I do this a lot :)
Never preceed any demonstration with anything more predictive than "watch this"
Leigh Reamy
Advisor

Re: Segmentation fault (core dumped); what is it?

Here's my two cents, for whatever it's worth.
Have you tried running a tusc against it at execution time? That way you can see what happens just before time of death.

Also, I believe you can run adb or q4 against the core file just like you would do on a system core dump analysis <=not sure how much info you can get really but... Let me know if this helps.

cheers,
leigh
Well. Now THAT'S interesting!
Jeff Schussele
Honored Contributor

Re: Segmentation fault (core dumped); what is it?

Hi,

If the cause is SIGSEGV, then what is happening is that the program is trying to cross a memory limit or boundary that it can't.
This could be an overflow of one of the max?siz kernel parms or it could indicate an exhaustion of swap or even a ulimit ceiling being hit.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Kenneth Platz
Esteemed Contributor

Re: Segmentation fault (core dumped); what is it?

A segmentation fault occurs when your program attempts to access memory that it doesn't have access to. This can occur either because it attempts to access a pointer that has not been properly initialised, or you could be walking off the end of an array.

From personal experience, in most cases you can get a basic stack trace from "gdb", even if your program hasn't been compiled with debugging enabled. (However, if your program has been stripped, all bets are off). This will at least help you isolate whether the error is occurring within your code or within a library.
I think, therefore I am... I think!