Languages and Scripting

ProC programs crash on 11.23

 
SOLVED
Go to solution
dictum9
Super Advisor

ProC programs crash on 11.23

It's hp-ux version 11.23 on Itenium 2620.

ProC programs randomly crash on the OpenDir call. Any idea why that is? Is there a patch for this?

26 REPLIES 26
Steven E. Protter
Exalted Contributor
Solution

Re: ProC programs crash on 11.23

Shalom,

One would have to see the core dumps (perhaps take a look at them), and perhaps the code to get an idea.

Perhaps use a debugger such as gdb to get some idea whats wrong with the programs.

I will venture to guess, wildly that there is likely a problem with the code. recompile or code changes need to be made.

To hope to get lucky with a patch, search the ITRC patch database for some form of the call (opendir).

I can't see how anyone will be able to recommend a specific patch unless they had the same symptoms and fixed them with a patch.

hint: More information required to help with this.

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
dictum9
Super Advisor

Re: ProC programs crash on 11.23

More info:

Pro*C/C++: Release 9.2.0.2.0
HP-UX 11.23
Itanium rx2620
A. Clay Stephenson
Acclaimed Contributor

Re: ProC programs crash on 11.23

Is OpenDir() actually the standard function opendir() or is it something else? This is rather standard debugging so add the -g flag (which I assume is passed from the ProC pre-compiler to the C/C++ compiler) and execute your program and allow it to die. Then do a stack trace and you should see the culprit.

Since you seem to be asking for psychic help, given the wealth of data that you have supplied, Miss Cleo says that what a pointer once pointed to as valid data no longer is. Perhaps a local string variable that should be declared static --- but contrary to her vast audience, I find that Miss Cleo is often wrong.
If it ain't broke, I can fix that.
dictum9
Super Advisor

Re: ProC programs crash on 11.23

opendir it is.

dictum9
Super Advisor

Re: ProC programs crash on 11.23

----Quote----

No, there is no core dump because it does not "crash". Instead it exits "gracefully". The program calls opendir() which would normally return a pointer to the directory structure and all the files in that directory. The program loops (sleeping for 5 seconds each time) looking in the directory for a file. Most of the time, the opendir() call is successful, but every once in a while it will return NULL and the program exits "gracefully" when that happens i.e. it just stops running.

Today we made a change to the program to re-try access to this directory if it fails, for up to 5 times. That band-aid may or may not be a work around to the problem, as GAR mentioned this morning it may be related to a memory leak, in which case the program will likely still quit running.

----end quote----
James R. Ferguson
Acclaimed Contributor

Re: ProC programs crash on 11.23

Hi:

Just out of curiosity, what is the latest standard patch bundle that you have applied?

Regards!

...JRF...
A. Clay Stephenson
Acclaimed Contributor

Re: ProC programs crash on 11.23

Oh, that's a horse of a different color. A NULL pointer returned by opendir() is not entirely unexpected and when that happens, you then need to check the value of the extern variable errno which should indicate the reason. A common problem might be that your process has reached maxdsiz and thus malloc() failed. Note: when you use the word "crash" in describing program behavior that does not normally mean that a function returned a result I was not expecting (but should have been or at least had meaningful error messages output before exiting).

PHKL_31500 does have a fix for a problem with opendir() but I don't think it fits your problem and you should read the installation instructions carefully before installing --- although I suspect it is already installed on your system.
If it ain't broke, I can fix that.
Sandman!
Honored Contributor

Re: ProC programs crash on 11.23

To reiterate what Clay has said a simple and probably generic fix would be to add exception handling to your Pro*C program. It can be like the one below:

if (!opendir("Some_Dir_Name"))
perror("Error");
dictum9
Super Advisor

Re: ProC programs crash on 11.23

J. Ferguson,

The system was installed in the fall of 2006. I ran a custom patch install with swainv.

C.Stephenson,

Yes, I have PHKL_31500.

Sandman!,

Good idea.