- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: ProC programs crash on 11.23
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2007 01:44 AM
07-25-2007 01:44 AM
ProC programs randomly crash on the OpenDir call. Any idea why that is? Is there a patch for this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2007 01:49 AM
07-25-2007 01:49 AM
SolutionOne 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
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2007 02:13 AM
07-25-2007 02:13 AM
Re: ProC programs crash on 11.23
Pro*C/C++: Release 9.2.0.2.0
HP-UX 11.23
Itanium rx2620
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2007 02:21 AM
07-25-2007 02:21 AM
Re: ProC programs crash on 11.23
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2007 02:53 AM
07-25-2007 02:53 AM
Re: ProC programs crash on 11.23
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2007 06:04 AM
07-25-2007 06:04 AM
Re: ProC programs crash on 11.23
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----
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2007 06:30 AM
07-25-2007 06:30 AM
Re: ProC programs crash on 11.23
Just out of curiosity, what is the latest standard patch bundle that you have applied?
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2007 06:58 AM
07-25-2007 06:58 AM
Re: ProC programs crash on 11.23
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.
- Tags:
- errno
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2007 07:32 AM
07-25-2007 07:32 AM
Re: ProC programs crash on 11.23
if (!opendir("Some_Dir_Name"))
perror("Error");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2007 08:32 AM
07-25-2007 08:32 AM
Re: ProC programs crash on 11.23
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2007 08:46 AM
07-25-2007 08:46 AM
Re: ProC programs crash on 11.23
#include
#include
#include
#include
#include
#define assign_errno(x) ((errno != 0) ? errno : (x))
int process_dir(char *dirname)
{
int cc = 0;
DIR *dp = NULL;
dp = opendir(dirname);
if (dp != NULL)
{
/* normal processing goes here */
closedir(dp); /* If you miss this step you have an instant memory leak */
}
else
{
cc = assign_errno(255);
(void) fprintf(stderr,"Can't open directory \"%s\"; status %d.\n",dirname,cc);
(void) fflush(stderr);
}
return(cc);
} /* process_dir */
------------------------------------------
You now will have an integer exit code that means something and an error message on stderr that means something.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2007 03:53 AM
07-26-2007 03:53 AM
Re: ProC programs crash on 11.23
I haven't yet tried the above code to get the error code, but I will.
Here is the output from the log file. A couple of scenarios were looked at:
(1) The directory was renamed to another name, and
(2) the permissions of the directory were set to 000
The corresponding messages given in the log file on dev were:
****** Start of qms1108a Report ******
Start time: 14:27:1 7/18/2007
Error Opening the /apps/qms/data/hnstest directory
stat() error on /apps/qms/data/hnstest: No such file or directory
qms1108a STOPPED
End time: 14:28:6 7/18/2007
****** End of qms1108a Report ******
****** Start of qms1108a Report ******
Start time: 14:34:32 7/18/2007
Error Opening the /apps/qms/data/hnstest directory
stat() error on /apps/qms/data/hnstest: Permission denied
qms1108a STOPPED
End time: 14:34:32 7/18/2007
****** End of qms1108a Report ******
However, when the actual crash happened, no data was logged.
****** Start of qms1108a Report ******
Start time: 11:31:19 7/23/2007
Error opening the /apps/qms/data/hnstest directory
qms1108a STOPPED
End time: 11:31:19 7/23/2007
****** End of qms1108a Report ******
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2007 03:54 AM
07-26-2007 03:54 AM
Re: ProC programs crash on 11.23
==============================================================
Here is the actual code with opendir() and closedir(). Are they properly matched?
==============================================================
if ((dirp = opendir(path)) == NULL)
{
while (dirp == NULL && sleep_count < 5)
{
fprintf(log_file,"OPENDIR error:%s, sleep count %d, sleep interval %d\n", strerror(errno), sleep_count, sleep_seconds);
fflush(log_file);
sleep(sleep_seconds);
dirp = opendir(path);
sleep_count++;
if (sleep_seconds < 5)
{
sleep_seconds++;
}
}
if (dirp == NULL)
{
fprintf(log_file,"Error opening the %s directory\n", path);
fprintf(log_file, "stat() error on %s: %s\n", path,
strerror(errno));
fflush(log_file);
return(-1);
}
}
while ((dp = readdir(dirp)) != NULL)
{
if (dp->d_name[0] != '.')
{
sprintf(infile, "%s/%s", path, dp->d_name);
ret_stat = stat(infile, &filstat_ret);
if (ret_stat >= 0)
{
strcpy(filstat_buf[file_count].filename,dp->d_name);
filstat_buf[file_count].lmodt = filstat_ret.st_mtime;
file_count++;
}
else
return(-1);
}
}
filstat_buf[file_count].filename[0] = '\0';
j = file_count;
for (i=0; i < j; i++)
{
for (k=0; k < j-i-1; k++)
{
if (filstat_buf[k].lmodt > filstat_buf[k+1].lmodt)
{
strcpy(filstat_tmp.filename,filstat_buf[k].filename);
filstat_tmp.lmodt = filstat_buf[k].lmodt;
strcpy(filstat_buf[k].filename,filstat_buf[k+1].filename);
filstat_buf[k].lmodt = filstat_buf[k+1].lmodt;
strcpy(filstat_buf[k+1].filename,filstat_tmp.filename);
filstat_buf[k+1].lmodt = filstat_tmp.lmodt;
}
}
}
closedir(dirp);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2007 04:13 AM
07-26-2007 04:13 AM
Re: ProC programs crash on 11.23
In reflection of the additional information, I would take the following steps:
1) Test the code on another system, see if the results are consistent.
2) Take a look at the general patch level of the system and consider bringing it up to July 2007 or the previous QPK.
Is it possible to see a snip of the debug information to be sure its really an opendir call its crashing on.
Sorry there was no core dump, that would have made it easy. Are you sure core dumps are enabled on core dumps on the system in question?
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2007 04:52 AM
07-26-2007 04:52 AM
Re: ProC programs crash on 11.23
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2007 07:06 AM
07-26-2007 07:06 AM
Re: ProC programs crash on 11.23
while ((dp = readdir(dirp)) != NULL)
{
if (dp->d_name[0] != '.')
{
.
.
.
}
else
{
closedir(dirp); /* need to add this one */
return(-1);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2007 06:56 AM
07-27-2007 06:56 AM
Re: ProC programs crash on 11.23
There are a few places in the script where this was necessary, I need to confirm that they all were addressed.
Still unable to capture the error code.
Need to monitor memory usage for specific processes without glance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2007 07:27 AM
07-27-2007 07:27 AM
Re: ProC programs crash on 11.23
In the absence of 'glance' (the best tool!) you could craft a simple script to monitor the virtual size of a process thusly:
# cat ./watch
#!/usr/bin/sh
typeset WHO=$1
while true
do
{ date; UNIX95= ps -C ${WHO} -o comm= -o vsz= ;}|xargs
sleep 30
done
...run as :
# ./watch processname
If I were to monitor 'init' you would see output like:
Fri Jul 27 15:26:29 EDT 2007 init 344
Fri Jul 27 15:26:59 EDT 2007 init 344
See the manpages for 'ps'.
Regards!
...JRF...
- Tags:
- PS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2007 07:33 AM
07-27-2007 07:33 AM
Re: ProC programs crash on 11.23
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2007 01:59 AM
07-30-2007 01:59 AM
Re: ProC programs crash on 11.23
When running the UNIX95 command to monitor the memory usage of a process, what do the first two fields (numbers) on the line mean?
UNIX95= ps -e -o vsz -o pid -o args | sort -k1nr
15564 14395 /apps/qms/bin/qms1108a /bin/ON1108 /apps/qms/fims/upload /data/hnstest
^^^^^ ^^^^^
1860 14016 /apps/qms/bin/qms1108wrc /bin/ON1108wrc /data/hnswrc
1256 925 sh /apps/qms/bin/qms1109_IRU.sh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2007 02:32 AM
07-30-2007 02:32 AM
Re: ProC programs crash on 11.23
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2007 03:52 AM
07-30-2007 03:52 AM
Re: ProC programs crash on 11.23
Is there a kernel variable I can tune, or is this strictly a code issue?
The memory leak doesn't seem to be fixed.
18892 14395 /apps/qms/bin/qms1108a /bin/ON1108 /apps/qms/fims/upload /data/hnstest
1860 14016 /apps/qms/bin/qms1108wrc /bin/ON1108wrc /data/hnswrc
1256 925 sh /apps/qms/bin/qms1109_IRU.sh
Mon Jul 30 10:47:04 EDT 2007
18892 14395 /apps/qms/bin/qms1108a /bin/ON1108 /apps/qms/fims/upload /data/hnstest
1860 14016 /apps/qms/bin/qms1108wrc /bin/ON1108wrc /data/hnswrc
1256 925 sh /apps/qms/bin/qms1109_IRU.sh
Mon Jul 30 10:47:34 EDT 2007
1860 14016 /apps/qms/bin/qms1108wrc /bin/ON1108wrc /data/hnswrc
1256 925 sh /apps/qms/bin/qms1109_IRU.sh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2007 04:13 AM
07-30-2007 04:13 AM
Re: ProC programs crash on 11.23
> The program crashed again today. The memory usage got as high as 18892 in 1K blocks. After restart, it's growing again. Is there a kernel variable I can tune, or is this strictly a code issue? The memory leak doesn't seem to be fixed.
Why do you believe that you have a memory leak? Usually, you would see the memory utiliztion for the processs grow until your program fails calling 'malloc' with an error of ENOMEM. With such a failure, the call will also return a NULL pointer.
In all your posts, I don't see evidence of continued memory growth nor any 'errno'. As already noted by others, you need to capture and test for non-zero 'errno' after every system call.
For the heap (data) (governed by 'malloc'), the kernel parameter 'maxdsiz' and 'madsiz_64bit' are the fences for the maximum data size of 32-bit and of 64-bit processes respectively.
Regards!
...JRF...
- Tags:
- maxdsiz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2007 07:10 AM
07-30-2007 07:10 AM
Re: ProC programs crash on 11.23
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2007 03:38 PM
07-30-2007 03:38 PM
Re: ProC programs crash on 11.23
If you think you have a memory leak, you can use wdb's leak detection commands.
(gdb) set heap-check on
run it
(gdb) info leaks
- Tags:
- leak