Merge lp:~jontai/openvista-gtm-integration/bug446635 into lp:openvista-gtm-integration

Proposed by Jon Tai
Status: Merged
Merged at revision: not available
Proposed branch: lp:~jontai/openvista-gtm-integration/bug446635
Merge into: lp:openvista-gtm-integration
Diff against target: 54 lines
2 files modified
mumps/MSCZJOB.m (+2/-2)
mumps/MSCZJOBU.m (+15/-6)
To merge this branch: bzr merge lp:~jontai/openvista-gtm-integration/bug446635
Reviewer Review Type Date Requested Status
jeff.apple Approve
Review via email: mp+14183@code.launchpad.net
To post a comment you must log in.
Revision history for this message
jeff.apple (jeff-apple) wrote :

I don't know what routine DDS does or when it's called, so I can't say much. Joel would have to comment.
I was hoping that instead of putting this information in ^TMP, we would put it in ^XTMP with an expiration data of, say, an hour. Then it would get cleared up by the ^XTMP cleanup daemon. ^XTMP is made specifically for these kinds of things. Perhaps that's beyond the scope of what we want right now, though.

review: Abstain
98. By Jon Tai

clean up ^TMP("MSCZJOB") in GETJOB^MSCZJOBU -- killing just one PID's subscript is not enough

99. By Jon Tai

move cleanup logic into JOBEXAM; only clean up data for processes that no longer exist

Revision history for this message
Jon Tai (jontai) wrote :

> I don't know what routine DDS does or when it's called, so I can't say much.
> Joel would have to comment.
> I was hoping that instead of putting this information in ^TMP, we would put it
> in ^XTMP with an expiration data of, say, an hour. Then it would get cleared
> up by the ^XTMP cleanup daemon. ^XTMP is made specifically for these kinds of
> things. Perhaps that's beyond the scope of what we want right now, though.

DDS is the screenman routine, AFAIK. Recall that MSCZJOB is the screenman frontend, MSCZJOBU are the utilities, and MSCZJOBS is the %SS clone. ^TMP("MSCZJOB") is where the processes dump their data to. This data is aggregated into ^TMP("MSCZJOB1") by JOBEXAM^MSCZJOBU (actually the real work is done by GETJOB^MSCZJOBU).

After looking at and experimenting with Joel's fix, it does clean up ^TMP("MSCZJOB1"), but it doesn't adequately clean up ^TMP("MSCZJOB"). I fixed this in the latest revision of the branch by moving the cleanup of ^TMP("MSCZJOB") into GETJOB^MSCZJOBU, but the problem with this fix is that it can be too aggressive -- if another process just ran INTRPT^MSCZJOBU but hasn't had a chance to retrieve the results with JOBEXAM^MSCZJOBU yet, the data will be gone. (Moving the data into ^XTMP and relying on an external cleanup routine would suffer from the same race, although rarely).

To solve the race condition, I've moved the cleanup code for ^TMP("MSCZJOB") one more time, this time into JOBEXAM^MSCZJOBU. It only cleans up a process' data if that process no longer exists, so there should never be a race. On the downside, there will always be a little bit of data left in ^TMP("MSCZJOB"), but it will not accumulate forever.

100. By Jon Tai

update 1st line of routines

Revision history for this message
jeff.apple (jeff-apple) wrote :

> DDS is the screenman routine, AFAIK. Recall that MSCZJOB is the screenman
> frontend, MSCZJOBU are the utilities, and MSCZJOBS is the %SS clone.
> ^TMP("MSCZJOB") is where the processes dump their data to. This data is
> aggregated into ^TMP("MSCZJOB1") by JOBEXAM^MSCZJOBU (actually the real work
> is done by GETJOB^MSCZJOBU).
>
> After looking at and experimenting with Joel's fix, it does clean up
> ^TMP("MSCZJOB1"), but it doesn't adequately clean up ^TMP("MSCZJOB"). I fixed
> this in the latest revision of the branch by moving the cleanup of
> ^TMP("MSCZJOB") into GETJOB^MSCZJOBU, but the problem with this fix is that it
> can be too aggressive -- if another process just ran INTRPT^MSCZJOBU but
> hasn't had a chance to retrieve the results with JOBEXAM^MSCZJOBU yet, the
> data will be gone. (Moving the data into ^XTMP and relying on an external
> cleanup routine would suffer from the same race, although rarely).
>
> To solve the race condition, I've moved the cleanup code for ^TMP("MSCZJOB")
> one more time, this time into JOBEXAM^MSCZJOBU. It only cleans up a process'
> data if that process no longer exists, so there should never be a race. On
> the downside, there will always be a little bit of data left in
> ^TMP("MSCZJOB"), but it will not accumulate forever.

I don't see anything wrong with this.

By the way ^XTMP is required to have an expiration (ie cleanup) date. Setting that ahead an hour would keep the cleanup task from removing it too early in an realistic case.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'mumps/MSCZJOB.m'
--- mumps/MSCZJOB.m 2009-06-26 21:06:41 +0000
+++ mumps/MSCZJOB.m 2009-10-29 18:19:10 +0000
@@ -1,10 +1,10 @@
1MSCZJOB ;GFT,JDS/MSC;26JUN20091MSCZJOB ;GFT,JDS,JKT/MSC;29OCT2009
2 ;;8.0;KERNEL;**MSC**2 ;;8.0;KERNEL;**MSC**
3 W !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!3 W !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
4 N MSC4 N MSC
5DDS ;5DDS ;
6 S DDSFILE=3.081,DR="[MSCZJOBEXAM]",DDSPARM="S"6 S DDSFILE=3.081,DR="[MSCZJOBEXAM]",DDSPARM="S"
7 D ^DDS Q7 D ^DDS K ^TMP("MSCZJOB1",$J) Q
8 ;8 ;
9UNLOCK(D0) ;FROM FIELD 2, PAGE 3: UNLOCK THE LOCK9UNLOCK(D0) ;FROM FIELD 2, PAGE 3: UNLOCK THE LOCK
10 N X,R,N S R=$G(@MSC@(MSCJOBID,"L",D0)) I R'["^" Q ;CAN'T SEE IT10 N X,R,N S R=$G(@MSC@(MSCJOBID,"L",D0)) I R'["^" Q ;CAN'T SEE IT
1111
=== modified file 'mumps/MSCZJOBU.m'
--- mumps/MSCZJOBU.m 2009-06-26 22:50:57 +0000
+++ mumps/MSCZJOBU.m 2009-10-29 18:19:10 +0000
@@ -1,4 +1,4 @@
1MSCZJOBU ;RHL,JDS,JKT/MSC;26JUN20091MSCZJOBU ;RHL,JDS,JKT/MSC;29OCT2009
2 ;;8.0;KERNEL;**MSC**2 ;;8.0;KERNEL;**MSC**
3 ;3 ;
4 ; JOB EXAM UTILITIES FOR GT.M4 ; JOB EXAM UTILITIES FOR GT.M
@@ -31,13 +31,22 @@
31 . N %ZG,%ZRO D NEWZGZRO^ZCD(INSTANCE)31 . N %ZG,%ZRO D NEWZGZRO^ZCD(INSTANCE)
32 . S Y("B",INSTANCE)=%ZG32 . S Y("B",INSTANCE)=%ZG
33 ;33 ;
34 ; get a list of all mumps processes
35 N PIDS D PIDS(.PIDS)
36 N PID S PID=""
37 ;
38 ; clean up data in ^TMP("MSCZJOB") for processes that no longer exist
39 F S INSTANCE=$O(Y("B",INSTANCE)) Q:INSTANCE="" D
40 . F S PID=$O(^|Y("B",INSTANCE)|TMP("MSCZJOB",PID)) Q:PID="" D
41 . . I '$D(PIDS(PID)) K ^|Y("B",INSTANCE)|TMP("MSCZJOB",PID)
42 ;
43 ; consolidate data from ^TMP("MSCZJOB") into XARY
34 I $G(ONEPID) D GETJOB(ONEPID) Q44 I $G(ONEPID) D GETJOB(ONEPID) Q
35 ; for each mumps process, search each OpenVista instance for the latest job exam data45 F S PID=$O(PIDS(PID)) Q:PID="" D GETJOB(PID)
36 D PIDS(.XARY) ; XARY is doing double-duty; here it's an array
37 N PID S PID=""
38 F S PID=$O(XARY(PID)) Q:PID="" D GETJOB(PID)
39 Q46 Q
40GETJOB(PID) ;47GETJOB(PID) ; private, to be called from JOBEXAM only
48 ; search each OpenVista instance for the latest job exam data
49 ; for PID and merge it into XARY
41 N SORTDATE50 N SORTDATE
42 F S INSTANCE=$O(Y("B",INSTANCE)) Q:INSTANCE="" D51 F S INSTANCE=$O(Y("B",INSTANCE)) Q:INSTANCE="" D
43 . N H S H=$G(^|Y("B",INSTANCE)|TMP("MSCZJOB",PID,0)) Q:H=""52 . N H S H=$G(^|Y("B",INSTANCE)|TMP("MSCZJOB",PID,0)) Q:H=""

Subscribers

People subscribed via source and target branches