Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#263 closed defect (fixed)

After a very high number of fork/system/popen calls

Reported by: dcs Owned by: bird
Priority: normal Milestone: libc-0.6.6
Component: libc-backend Version:
Severity: normal Keywords:
Cc:

Description

On my sever with a "cron" type process running fork/system/popens very frequently. The end result is that after so long any program that uses LIBC065 will fail to start with a "LIBC Error: Couldn't register process in shared memory!" Anything that is already started or does not use LIBC065 just sails along merrily. Although the ones that do use it may hang when you try and shutdown.

On my laptop I can reproduce the first type by using "ps" but if I change it to a "hello world" program I get the "nothing will shut down" problem. I think the problem has been around for a long time as I have *never* had uptime on the server of more than three weeks - I think LIBC065 has just made it worse - I never saw that libc error message before 65 came along.

The following program shows the problem:

#include <os2.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <sys/time.h> #include <errno.h>

int main(int argc, char argv) {

char psline[256], temp[128]; char ps_string[] = "hw.exe";

long count;

FILE *ptr;

for(count = 1;; count++) {

ptr = popen(ps_string, "r");

if ( ptr == NULL ) {

int local_errno = errno; printf("\npopen(%s read) failed: %s\n", ps_string, strerror(local_errno)); exit(0);

}

fgets(psline, 80, ptr); /* read header line */

while( fgets(temp, 80, ptr) != NULL ); /* read away rest of popen pipe */ pclose(ptr); printf("\r%ld %s", count, psline);

}

}

and

#include <os2.h> #include <string.h> #include <stdio.h> #include <stdlib.h>

int main(int argc, char argv) {

printf("Hello World");

}

It usually blows around 60,000. Suspect 65535 problem?

I complied the above with EMX and got bored with it at 70,000+

Change History (5)

comment:1 Changed 7 years ago by dcs

Could this be related to #217?

comment:2 Changed 6 years ago by bird

  • Milestone set to libc-0.6.6

Looks like a leak in the shared program manager heap (sharedpm.c).

comment:3 Changed 6 years ago by bird

  • Component changed from baselayout to libc-backend
  • Priority changed from highest to normal
  • Severity changed from blocker to normal

comment:4 Changed 6 years ago by bird

  • Resolution set to fixed
  • Status changed from new to closed

Was leaking the pTerm member of grand children where their immediate parent wasn't a kLibC process. In the popen test case the shell is always used to execute the command line given as the first parameter, and the shell is typically not using kLibC.

Fixed in r3851, r3852 and r3853.

comment:5 Changed 6 years ago by bird

Not related to #217 as far as I can tell.

Note: See TracTickets for help on using tickets.