Bug 143634
Summary: | zombie process or segmentation fault in command spawned in popen() | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 2.1 | Reporter: | Isabel Lin <isabel_lin2003> |
Component: | kernel | Assignee: | Jim Paradis <jparadis> |
Status: | CLOSED WONTFIX | QA Contact: | Brian Brock <bbrock> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 2.1 | CC: | peterm, riel |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | i686 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2006-09-14 20:17:45 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Isabel Lin
2004-12-23 03:18:14 UTC
If sscanf doesn't return 0, you forgot to call pclose (fp), so that can explain the zombies. With that fixc, I certainly don't see any zombies nor crashes. I already tried the code before with plose(fp) if sscanf() doesn't return 2 and still see the same zombie. The only workaround is to use fopen() and fclose() since the "cat /proc/12345/stat" is underneath opening the file of interest. The reason I am opening the bug is find out why popen() would behave that way. Another thing I observed is that printf() after the zombie occurred doesn't print any error on the stdout. fp = popen(filename, "r"); if (fp == NULL){ printf("error in popen(): errno=%d(%s)\n", errno, strerror(errno)); <=== continue; } memset(buffer, 0, sizeof(buffer)); if (fgets(buffer, sizeof(buffer)-1, fp)) { if ((n=sscanf(buffer, "%*d %*s %c %*d %*d %*d %*d %*d %*u % *u %*u %*u %*u %*d %*d %*d %*d %*d"\ " %*d %*u %*u %*d %*u %u %*u", &stat, &size)) !=2 ) { printf("sscanf for \"%s\" returned n=%d\n", buffer, n); <=== pclose(fp); continue; } Since this issue is beyond the scope of the current support status of RHEL2.1, I am closing it as WONTFIX. |