(Message p:33)
Return-Path: owner-postgres
Received: from localhost.Berkeley.EDU (localhost.Berkeley.EDU [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.9/8.6.3) with SMTP id MAA03811 for postgres-redist; Wed, 12 Oct 1994 12:23:46 -0700
Resent-From: POSTGRES mailing list <postman@postgres.Berkeley.EDU>
Resent-Message-Id: <199410121923.MAA03811@nobozo.CS.Berkeley.EDU>
X-Authentication-Warning: nobozo.CS.Berkeley.EDU: Host localhost.Berkeley.EDU didn't use HELO protocol
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: owner-postman
Received: from obelix.icce.rug.nl (root@obelix.icce.rug.nl [129.125.14.129]) by nobozo.CS.Berkeley.EDU (8.6.9/8.6.3) with ESMTP id MAA03801 for <postgres@postgres.berkeley.edu>; Wed, 12 Oct 1994 12:23:44 -0700
Received: from basil.icce.rug.nl (root@localhost) by obelix.icce.rug.nl (8.6.9/8.6.9) with UUCP id TAA30469 for postgres@postgres.berkeley.edu; Wed, 12 Oct 1994 19:30:31 +0100
Received: by basil.icce.rug.nl (NX5.67e/R&A-1.5(basil#5))
    id AA00292; Wed, 12 Oct 94 17:02:51 +0100
Date: Wed, 12 Oct 94 17:02:51 +0100
From: tom@basil.icce.rug.nl (Tom R.Hageman)
Message-Id: <9410121602.AA00292@basil.icce.rug.nl>
Received: by NeXT.Mailer (1.100)
Received: by NeXT Mailer (1.100)
To: POSTGRES mailing list <postgres@postgres.Berkeley.EDU>
Subject: [4.2] regression test (fstest) failure
Resent-To: postgres-redist@postgres.Berkeley.EDU
Resent-Date: Wed, 12 Oct 94 12:23:46 -0700
Resent-XMts: smtp

Well, I've nearly finished my port of postgres 4.2 to NeXTSTEP except for a  
small (yeah:-) nit.

It --sometimes, not always-- fails to pass the regression test, with the  
following error message:

#
# - relative prmdir
#
prmdir relative_dir \
	|| exit 1
p_rmdir: p_errno=1, relative_dir: Error 0
the Inversion file system test causes an error

Symptoms:
- When run repeatedly it failed 70 out of 500 times on my machine (33MHz m68k).   
- On a slower machine it seems to fails more often.
- When I add "sleep 1" before the prmdir the test runs fine.

All this suggests a timing problem (in postmaster?) so I added some code to  
block SIGCHLD signals when a request is being handled in  
postmaster/postmaster.c.  This didn't help (although it should prevent the  
occasional postmaster hangups that I was experiencing.  It is a good idea  
anyway since the SIGCHLD handler manipulates (and frees) global  
datastructures...) so now I'm stumped.

Any ideas?

BTW this is plain 4.2 with aoki's postmaster patches applied.

Thanks in advance,
Tom.

FYI here are my changes to the postmaster:

*** %postmaster.c	Fri Sep  9 01:55:25 1994
--- postmaster.c	Sat Oct  8 15:23:48 1994
*************** ServerLoop(serverFd)
*** 354,357 ****
--- 354,358 ----
      int		nSockets, nSelected, status, newFd;
      PortNode	*prev, *curr;
+     int		orgsigmask = sigblock(0);	/* XXX[TRH] portability */
  

      nSockets = ServerSock + 1;
*************** ServerLoop(serverFd)
*** 360,363 ****
--- 361,365 ----
  

      for (;;) {
+ 	sigsetmask(orgsigmask);			/* XXX[TRH] portability */
  	newFd = -1;
  	bcopy((char *) &basemask, (char *) &rmask, sizeof(fd_set));
*************** ServerLoop(serverFd)
*** 372,375 ****
--- 374,385 ----
  	    return(STATUS_ERROR);
  	}
+ 	/* [TRH  8-Oct-94]
+ 	 * To avoid race conditions, block SIGCHLD signals while we are
+ 	 * handling the request. (both reaper() and ConnCreate()
+ 	 * manipulate the BackEnd list, and reaper() calls free() which is
+ 	 * usually non-reentrant.)
+ 	 */
+ 	sigblock(sigmask(SIGCHLD));		/* XXX[TRH] portability */
+ 

  	if (DebugLvl > 1) {
  	    fprintf(stderr, "%s: ServerLoop: %d sockets pending\n",

--
__/__/__/__/  Tom Hageman   <tom@basil.icce.rug.nl>   [NeXTMail accepted]
  __/ __/_/
 __/__/__/          "...to baldly go where no one has gone before."
__/  _/_/                                             -- star trek TNG

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU"

   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================
