From 52cd995d98f6acc3aac239ce963cdf6672e6419d Mon Sep 17 00:00:00 2001 From: "wtc%netscape.com" Date: Thu, 31 Jan 2002 02:03:57 +0000 Subject: [PATCH] Bugzilla bug 119340: backed out the fix. We are still seeing the "selfserv process not detectable" errors on Linux and I don't have time to get to the bottom of it. Modified files: cmd/selfserv/selfserv.c tests/common/init.sh tests/ssl/ssl.sh git-svn-id: svn://10.0.0.236/trunk@113271 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/security/nss/cmd/selfserv/selfserv.c | 31 +------------------- mozilla/security/nss/tests/ssl/ssl.sh | 20 ++----------- 2 files changed, 3 insertions(+), 48 deletions(-) diff --git a/mozilla/security/nss/cmd/selfserv/selfserv.c b/mozilla/security/nss/cmd/selfserv/selfserv.c index 818b60f4ea6..185aa92a56f 100644 --- a/mozilla/security/nss/cmd/selfserv/selfserv.c +++ b/mozilla/security/nss/cmd/selfserv/selfserv.c @@ -141,15 +141,6 @@ static int requestCert; static int verbose; static SECItem bigBuf; -static const char *pidFile; -/* - * On Linux, the first thread we create writes its pid to a file. - * (See bug 119340 for why we do this.) - */ -#ifdef LINUX -static PRInt32 threadIndex; -#endif - static PRThread * acceptorThread; static PRLogModuleInfo *lm; @@ -429,27 +420,6 @@ thread_wrapper(void * arg) { perThread * slot = (perThread *)arg; -#ifdef LINUX /* bug 119403 */ - if (pidFile && PR_AtomicIncrement(&threadIndex) == 1) { - char *pidFile2; - FILE *tmpfile; - - pidFile2 = PORT_Alloc(PORT_Strlen(pidFile) + 3); - if (pidFile2 == NULL) { - return; /* failed */ - } - strcpy(pidFile2, pidFile); - strcat(pidFile2, ".2"); - tmpfile=fopen(pidFile2,"w+"); - - if (tmpfile) { - fprintf(tmpfile,"%d",getpid()); - fclose(tmpfile); - } - PORT_Free(pidFile2); - } -#endif /* LINUX */ - slot->rv = (* slot->startFunc)(slot->a, slot->b, slot->c); /* notify the thread exit handler. */ @@ -1414,6 +1384,7 @@ main(int argc, char **argv) char * cipherString= NULL; const char * dir = "."; char * passwd = NULL; + const char * pidFile = NULL; char * tmp; char * envString; PRFileDesc * listen_sock; diff --git a/mozilla/security/nss/tests/ssl/ssl.sh b/mozilla/security/nss/tests/ssl/ssl.sh index ed8e34e1444..06b672fdfc7 100755 --- a/mozilla/security/nss/tests/ssl/ssl.sh +++ b/mozilla/security/nss/tests/ssl/ssl.sh @@ -141,29 +141,13 @@ wait_for_selfserv() ######################################################################## kill_selfserv() { - # Bug 119340: This is an inelegant but more reliable way to ensure - # that a multithreaded process on Linux has been completely killed. - # Recall that each thread is a process on Linux. Instead of killing - # the primary thread, we kill the first thread created by selfserv and - # let the thread manager take care of terminating the other threads in - # selfserv. The assumption we rely on is that the primary thread is - # the last one to go because it's the parent of the thread manager. - # - # On Linux, the first thread created by selfserv writes its pid to the - # {SERVERPID}.2 file. - if [ "${OS_ARCH}" = "Linux" ]; then - ${KILL} `cat ${SERVERPID}.2` - else - ${KILL} `cat ${SERVERPID}` - fi + ${KILL} `cat ${SERVERPID}` wait `cat ${SERVERPID}` if [ ${fileout} -eq 1 ]; then cat ${SERVEROUTFILE} fi + ${SLEEP} #FIXME linux waits 30 seconds - find a shorter way (sockets free) rm ${SERVERPID} - if [ "${OS_ARCH}" = "Linux" ]; then - rm ${SERVERPID}.2 - fi } ########################### start_selfserv #############################