delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/08/05/05:28:31

From: TYann AT vet DOT com DOT au (Trevor Yann)
Subject: Re: spawn problems (windows 98?)
5 Aug 1998 05:28:31 -0700 :
Message-ID: <3.0.5.32.19980805215906.007d7a30.cygnus.cygwin32.developers@mail.mel.cybec.com.au>
References: <3 DOT 0 DOT 5 DOT 32 DOT 19980804165143 DOT 007de820 AT mail DOT mel DOT cybec DOT com DOT au>
Mime-Version: 1.0
To: cygwin32-developers AT cygnus DOT com

I have written a test program (below) that shows the problem sometimes. The
test program is run with a parameter specifying the number of processes to
spawn. I have been running it with 10 or 20. Only about one run in 10 shows
the problem. I have the strace output from one of the runs where the
problem occurred.

I have tried the cygwinb19.dll.gz from ftp.cygnus.com/private/home/cgf and
could not get the problem to occur. I did get an access violation reported
several times. I have the strace output from one of the runs where the
access violation was reported.

Each of the strace output files are just under 40k when gzipped, so I will
not send them to the mailing list.

btw after running my test program about 10 times with the new dll, the
following message was output each time the bash prompt was redisplayed:
Couldn't decommit stack memory 0xE5E0000(33583104) for read of /dev/conin,
err 0

------ test program ------

#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <sys/wait.h>
#include <signal.h>

typedef void SigHandler ();

static void
set_signal_handler (sig, handler)
     int sig;
     SigHandler *handler;
{
  struct sigaction act, oact;

  act.sa_handler = handler;
  act.sa_flags = 0;
  sigemptyset (&act.sa_mask);
  sigemptyset (&oact.sa_mask);
  sigaction (sig, &act, &oact);
  return;
}

/* sigchld_handler () flushes at least one of the children that we are
   waiting for.  It gets run when we have gotten a SIGCHLD signal. */
static void
sigchld_handler (sig)
     int sig;
{
  int status;
  pid_t pid;

  pid = waitpid ((pid_t)-1, &status, WUNTRACED | WNOHANG);
}

/* Set the handler to run when the shell receives a SIGCHLD signal. */
static void
set_sigchld_handler ()
{
  set_signal_handler (SIGCHLD, sigchld_handler);
}

int main(int argc, char** argv)
{
    int count = argc > 1 ? atoi(argv[1]) : 0;

    /* if there is a non-zero count, then spawn some processes,
       otherwise exit immediately */
    if (count > 0)
    {
	int i;
	pid_t last_pid;

	set_sigchld_handler ();

	for (i = 0; i < count; i++)
	{
	    last_pid = spawnl(_P_NOWAIT, argv[0], argv[0], NULL);
	}
    }

    return 0;
}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019