Core Dump of a process in Red Hat Linux 5.9

Hello All,

I am new joiner of this forum.I am new to Linux shell scripting.
At present I have identified 1 application which stalls very frequently (PID is say xyz) and I am not having much information in its application log to identify the root cause of stalling. I need to take the core dump in order to analyze it further.
I think I require some shell script in order to achieve the same.Preferably I want to do it through GCORE utility of GDB.

Can any one help me out in this regard?
I am using Red Hat Enterprise Linux server release 5.9
Kernel version is 2.6.18

Regards

Just an obnoxious question: are you forced to use this obsolete version of RH? My first remark would be, unfortunately, to upgrade the install so you have access to the latest versions of the various tools.

1 Like

You can try sending the stalled process a signal to force it to dump core.
You need to be root to do this if your account is not running the process.
where xyz == pid of process

kill -s SIGSEGV xyz

If you have seen other core dumps by the account the process runs under then you are good to go. Otherwise check back here and a red hat person can step you through setting up core dumps.

1 Like

As I mentioned my post that my process is hanging.I need to trace out the reason of hanging.
So I require something which dumps continuously until the hang occurs.I can not predict when the process gets hang.
Regards

Yes.I am forced to used the latest version due to dependencies of some application.
I need to have some sort of way to take the core dump when it stalls.
Can u highlight in this regard.

Before you take a core dump on RHEL, you typically have to modify your shell's ulimits and also /etc/security/limits.conf. You would also typically edit /etc/sysctl.conf and configure where to put the core file and the core file naming convention.

1 Like

But I can not predict when my application stalls?It is not definite?Can you tell me the procedure (step by step) in gcore to take the core dump.I have tested the following and it is dumping in running condition.
The following commands are executed to take the dump.

1) Ulimit �c (To check the limit of dump file which will be created)
In normal system it yields �0�. Means no dump file will be created.
2) Ulimit �c unlimited (to make the volume of dump file as unlimited)
You should get �unlimited� as output if you again type ��ulimit �c�� command in $ prompt.
3) gdb --pid = �10008� (10008 is the PID of WEBFGSERVER in linux system where WEBFGSERVER is running)
You will be redirected to gdb prompt.
4) Typed the following in gdb prompt.
gdb> gcore. It will take 45 secs to 1 minute to create the memory dump. When you are redirected to gdb> type the following.
5) gdb> quit
6) It will create a file named core.10008 in the directory you are in.
Is there any thing wrong in it.If not then how the above steps can be used to core dump immediately after the process stalls?

Have you tried it?

Yes.It is dumping memory.But in normal running condition.Not in stalled condition.

What happens when you try and do that in stalled condition?

I was not able to make the core dump in stalled condition and the stalled condition of the process for which I need core dump can not be predicted or determined or simulated.So It was not able to hit

kill -s SIGSEGV 10008.
And thus I was not able to make any core dump at the time when the process stalls.
Which I actually in need.

Why not?

What prevented you from doing so?

What, exactly, did you do, what exactly happened, and what exactly did you want to happen?

Actually the process running in Production System on 24/7 basis.I have another customized process which monitors whether other process are in stalled stae or not?It actually send some request to other process and if it gets the response from other process with in a configured time period(in seconds) then it declares the other process as alive.If not then it declares the other process is stalled and it restart the process.In this way before I type the earlier mentioned commands, to grab the dump, the process restarts and also it is unpredictable when the process stalls.That is the difficulty.So I need so tool to monitor the status of the periodically and if it did not get any response then it will assume that the process is stalled and triggers the GCORE dump.

And this customized process can't do the coredump?

No.Thats the tragedy. What is the way out then?

---------- Post updated 08-26-15 at 12:16 PM ---------- Previous update was 08-25-15 at 03:41 PM ----------

Is there any way out in this situastion?

First you will have to find a way to discover when the process is "frozen". How does this existing tool work? Do you have any code for it?

No I do not have any code for that.All I know is that the process which is responsible for monitoring other process (like monitoring a message exchange we call it Hello Message with in a particular time interval with the process which its required to be monitored) send some hello message to the monitored process and if it did not get any response from with in a predefined time period, it declare the process as dead,

You will need to know more than that, and we can't really tell from here.

Can u please tell what are the inputs required?

How to check if it's frozen, or how to communicate with it in general, or failing that, what it actually is.