Merge lp:~jeff-apple/openvista-gtm-integration/zombie into lp:openvista-gtm-integration

Proposed by jeff.apple on 2010-12-02
Status: Merged
Merged at revision: 145
Proposed branch: lp:~jeff-apple/openvista-gtm-integration/zombie
Merge into: lp:openvista-gtm-integration
Diff against target: 73 lines (+14/-6)
3 files modified
mumps/ZISTCPS.m (+6/-3)
src/libopenvista/gtmserver.c (+7/-2)
src/libopenvista/openvista.xc.in (+1/-1)
To merge this branch: bzr merge lp:~jeff-apple/openvista-gtm-integration/zombie
Reviewer Review Type Date Requested Status
Jon Tai 2010-12-02 Approve on 2010-12-04
Review via email: mp+42436@code.launchpad.net
To post a comment you must log in.
Jon Tai (jontai) wrote :

I ran four simulated CPRS clients against the RPC broker simultaneously. All they do is log in, log out, and repeat. Before this fix, a zombie would appear within a few minutes -- sometimes one or two minutes, but no more than five minutes. After the fix, it's been 12 hours without a single zombie.

I'll merge this as soon as #683878 merges.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mumps/ZISTCPS.m'
2--- mumps/ZISTCPS.m 2009-06-05 20:09:12 +0000
3+++ mumps/ZISTCPS.m 2010-12-02 00:27:56 +0000
4@@ -1,4 +1,4 @@
5-%ZISTCPS ;ISF/RWF MSC/JDA - DEVICE HANDLER TCP/IP SERVER CALLS ;22APR2009
6+%ZISTCPS ;ISF/RWF MSC/JDA - DEVICE HANDLER TCP/IP SERVER CALLS ;01DEC2010
7 ;;8.0;KERNEL;**78,118,127,225,275,388,MSC**;Jul 10, 1995
8 Q
9 ;
10@@ -69,8 +69,11 @@
11 U NIO S NIO("ZISTCP",0)=$KEY D LOG("Have port.")
12 ;Start Listening
13 W /LISTEN(1) S NIO("ZISTCP",1)=$KEY D LOG("Start Listening. "_NIO("ZISTCP",1))
14- N ZC,ZR,IDX,DESC
15+ N ZC,ZR,IDX,DESC,LDESC
16 S ZC="ZSHOW ""D"":ZR"
17+ X ZC
18+ ; Find the listener file descriptor. The child must close it.
19+ S LDESC="" F IDX=1:1:$O(ZR("D",""),-1) S:(ZR("D",IDX)["listener")&(ZR("D",IDX)["PORT="_SOCK) LDESC=$P($P(ZR("D",IDX),"DESC=",2)," ",1) Q:LDESC'=""
20 ;Wait for connection
21 LG2 S %A=0,EXIT=0 F D Q:%A!EXIT
22 . U NIO:(SOCKET="listener")
23@@ -91,7 +94,7 @@
24 S DESC="" F IDX=1:1:$O(ZR("D",""),-1) S:ZR("D",IDX)[NIO("SOCK") DESC=$P($P(ZR("D",IDX),"DESC=",2)," ",1) Q:DESC'=""
25 I DESC="" D LOG("Can not find file descriptor!") G LG2
26 ;spawn child process
27- S SPAWNID=$&openvista.gtmserver(DESC,"GTMLNCH^%ZISTCPS")
28+ S SPAWNID=$&openvista.gtmserver(DESC,LDESC,"GTMLNCH^%ZISTCPS")
29 L +^TMP("ZISTCPS",SPAWNID)
30 S ^TMP("ZISTCPS",SPAWNID)=RTN
31 L -^TMP("ZISTCPS",SPAWNID)
32
33=== modified file 'src/libopenvista/gtmserver.c'
34--- src/libopenvista/gtmserver.c 2009-04-23 04:45:12 +0000
35+++ src/libopenvista/gtmserver.c 2010-12-02 00:27:56 +0000
36@@ -26,7 +26,7 @@
37 #define RETRY_EINTR(x) for(;;) if ((x)!=EINTR) break
38 #define SEND_PID (write(fds[1], &grandchild_id, sizeof(int)))
39
40-xc_long_t gtmserver(int count, int connfd, const char *cmd) {
41+xc_long_t gtmserver(int count, int connfd, int listen_fd, const char *cmd) {
42 int fds[2];
43 int child_id;
44 int grandchild_id;
45@@ -49,6 +49,7 @@
46 }
47 if (child_id==0) {
48 /* In child */
49+ RETRY_EINTR(close(listen_fd));
50 RETRY_EINTR(result=close(fds[0]) );
51 if (result != 0) {
52 perror("child close()");
53@@ -102,7 +103,11 @@
54 perror("parent close(fds[0])");
55 }
56 kill(child_id, SIGKILL);
57- waitpid(child_id, &status, 0);
58+ while(child_id!=waitpid(child_id, &status, 0)) {
59+ // Just keep trying this until it works. We could get interrupted in
60+ // the syscall, which leaves the zombie around.
61+ }
62+
63 return ret_val;
64 }
65 }
66
67=== modified file 'src/libopenvista/openvista.xc.in'
68--- src/libopenvista/openvista.xc.in 2009-07-08 04:08:14 +0000
69+++ src/libopenvista/openvista.xc.in 2010-12-02 00:27:56 +0000
70@@ -1,2 +1,2 @@
71 @GTM_DIST@/libopenvista.so
72-gtmserver: xc_long_t gtmserver(I:xc_long_t, I:xc_char_t*)
73+gtmserver: xc_long_t gtmserver(I:xc_long_t, I:xc_long_t, I:xc_char_t*)

Subscribers

People subscribed via source and target branches