Re: [U2] UD: Phantoms {Unclassified}
The reason I asked about what you're doing exactly Bill, is that it's not strictly necessary to wake up a phantom every minute to decide if there is anything to do. You can also write routines that poke the phantom to wakeup right now. Will ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms {Unclassified}
If processes are putting things in a queue for a phantom to process and you use PAUSE, the processes can use WAKE to signal the phantom that it has something to do. This way, the cycle time can be much longer, reducing the number of periodic checks. The result is better response time on items that are processed and better performance overall since unnecessary cycles are eliminated. Dean Armbruster System Analyst 757-989-2839 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of fft2...@aol.com Sent: Thursday, April 08, 2010 3:27 PM To: u2-users@listserver.u2ug.org Subject: Re: [U2] UD: Phantoms {Unclassified} The reason I asked about what you're doing exactly Bill, is that it's not strictly necessary to wake up a phantom every minute to decide if there is anything to do. You can also write routines that poke the phantom to wakeup right now. Will ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
Dan, what version of UniData are you running. I reported a similar bug several years ago and it was fixed in version 6.1.7. With that bug, it happened when the process was killed, and then even logging out wasn't sufficient; any process reusing the UDTNO of the killed process could no longer PAUSE until UniData was restarted. Dean Armbruster System Analyst 757-989-2839 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dan McGrath Sent: Wednesday, April 07, 2010 6:45 PM To: U2 Users List Subject: Re: [U2] UD: Phantoms Further to that, you can break PAUSE for an entire session by using the break key to kill it while active. To reproduce: At ecl, type in PAUSE and press enter. Use the break key to kill it. ECL should look like this now: :PAUSE BREAK: Enter Qreturn to Quit. Any other character to continueQ : Now, do a LIST.PAUSED. You will see your session is still listed as paused. Run PAUSE again. It will return straight away. Issue a WAKE for your paused session to remove it from the paused list. Run PAUSE again. It will return straight away. Run Bills test program. It will report 0 seconds as the time taken. PAUSE will now not work again in your session, time to log out. :( -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dan McGrath Sent: Thursday, 8 April 2010 8:34 AM To: U2 Users List Subject: Re: [U2] UD: Phantoms Bill, I get similar results to your test program. INPUT PauseTime FOR I = 1 TO 10 StartTime = TIME() PAUSE PauseTime StopTime = TIME() CRT Total time taken is : OCONV(StopTime - StartTime, 'MTS'): CRT , expected : OCONV(PauseTime, 'MTS') NEXT I Run from ECL Input = 5, Times taken: 6,10,10,10,10,10... Input = 10, first time taken was 8, the next 9 where all 10. ... So, clearly PAUSE aligns itself to a 10 second boundary and can only operate on that. Given this, PAUSE works correctly for any 10 second increment, AFTER the first pause statement. Something like this should be added to the document, because according to the manuals 'PAUSE 5' should work, but in practice, it will actually running a 'PAUSE 10' with the first PAUSE statement pausing for an undefined period. Regards, Dan -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Thursday, 8 April 2010 3:38 AM To: U2 Users List Subject: Re: [U2] UD: Phantoms Well. I have to apologize for disparaging PAUSE. I ran tests by: PauseTime = 30 StartTime = TIME() PAUSE PauseTime StopTime = TIME() CRT Starting at : OCONV(StartTime, 'MTS') CRT Stopping at : OCONV(StopTime, 'MTS') CRT Total time taken is : OCONV(StopTime - StartTime, 'MTS') ...and the total time taken was rarely the PauseTime. So I ran the test with SLEEP and it worked properly. So I replaced SLEEP with PAUSE in our background service program and it wakes up every minute on the exact second. So, I guess, my test program wasn't working. Don't know why though. :-( Bill Bill Haskett said the following on 4/7/2010 10:02 AM: Dean: I ran some tests on PAUSE and it never seemed granular enough to properly work when the time it wakes up important. In other words, I'd pause for 30 and it would pause for sometimes 26 seconds, sometimes 28 seconds, sometimes 23 seconds, sometimes 25 seconds, but never over 30 seconds. SLEEP, however, always seemed to be on time. PAUSE was also cool in that I could find out which lines were paused with the LIST.PAUSE command. I could also WAKE the process from another line. Our UD service program wakes up every minute on the minute. I figure out how many seconds until the next minute then, per Wally's suggestion, I loop for that many seconds then SLEEP 1. This has been hitting the wake-up on the minute over quite a few machines for the past week or two. It appears PAUSE wouldn't come close to waking up at the right time. Anyway, directing my attention to a previously unused BASIC statement is always fun. Thanks, Bill dean.armbrus...@ferguson.com said the following on 4/7/2010 7:59 AM: As an alternative to SLEEP, use PAUSE. A process in PAUSE will return the call stack via PORT.STATUS. SLEEP, CALLC, PCPERFORM, and waiting on a record lock are some of most common conditions which will not return a call stack via PORT.STATUS. Dean Armbruster System Analyst 757-989-2839 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wally Terhune Sent: Friday, April 02, 2010 2:05 PM To: U2 Users List Subject: Re: [U2] UD: Phantoms Not sure. We do use signaling to 'interrupt' the running process
Re: [U2] UD: Phantoms
I tested it in UniData 7.2.5 and the problem I described exists. -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of dean.armbrus...@ferguson.com Sent: Friday, 9 April 2010 7:34 AM To: u2-users@listserver.u2ug.org Subject: Re: [U2] UD: Phantoms Dan, what version of UniData are you running. I reported a similar bug several years ago and it was fixed in version 6.1.7. With that bug, it happened when the process was killed, and then even logging out wasn't sufficient; any process reusing the UDTNO of the killed process could no longer PAUSE until UniData was restarted. Dean Armbruster System Analyst 757-989-2839 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dan McGrath Sent: Wednesday, April 07, 2010 6:45 PM To: U2 Users List Subject: Re: [U2] UD: Phantoms Further to that, you can break PAUSE for an entire session by using the break key to kill it while active. To reproduce: At ecl, type in PAUSE and press enter. Use the break key to kill it. ECL should look like this now: :PAUSE BREAK: Enter Qreturn to Quit. Any other character to continueQ : Now, do a LIST.PAUSED. You will see your session is still listed as paused. Run PAUSE again. It will return straight away. Issue a WAKE for your paused session to remove it from the paused list. Run PAUSE again. It will return straight away. Run Bills test program. It will report 0 seconds as the time taken. PAUSE will now not work again in your session, time to log out. :( -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dan McGrath Sent: Thursday, 8 April 2010 8:34 AM To: U2 Users List Subject: Re: [U2] UD: Phantoms Bill, I get similar results to your test program. INPUT PauseTime FOR I = 1 TO 10 StartTime = TIME() PAUSE PauseTime StopTime = TIME() CRT Total time taken is : OCONV(StopTime - StartTime, 'MTS'): CRT , expected : OCONV(PauseTime, 'MTS') NEXT I Run from ECL Input = 5, Times taken: 6,10,10,10,10,10... Input = 10, first time taken was 8, the next 9 where all 10. ... So, clearly PAUSE aligns itself to a 10 second boundary and can only operate on that. Given this, PAUSE works correctly for any 10 second increment, AFTER the first pause statement. Something like this should be added to the document, because according to the manuals 'PAUSE 5' should work, but in practice, it will actually running a 'PAUSE 10' with the first PAUSE statement pausing for an undefined period. Regards, Dan -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Thursday, 8 April 2010 3:38 AM To: U2 Users List Subject: Re: [U2] UD: Phantoms Well. I have to apologize for disparaging PAUSE. I ran tests by: PauseTime = 30 StartTime = TIME() PAUSE PauseTime StopTime = TIME() CRT Starting at : OCONV(StartTime, 'MTS') CRT Stopping at : OCONV(StopTime, 'MTS') CRT Total time taken is : OCONV(StopTime - StartTime, 'MTS') ...and the total time taken was rarely the PauseTime. So I ran the test with SLEEP and it worked properly. So I replaced SLEEP with PAUSE in our background service program and it wakes up every minute on the exact second. So, I guess, my test program wasn't working. Don't know why though. :-( Bill Bill Haskett said the following on 4/7/2010 10:02 AM: Dean: I ran some tests on PAUSE and it never seemed granular enough to properly work when the time it wakes up important. In other words, I'd pause for 30 and it would pause for sometimes 26 seconds, sometimes 28 seconds, sometimes 23 seconds, sometimes 25 seconds, but never over 30 seconds. SLEEP, however, always seemed to be on time. PAUSE was also cool in that I could find out which lines were paused with the LIST.PAUSE command. I could also WAKE the process from another line. Our UD service program wakes up every minute on the minute. I figure out how many seconds until the next minute then, per Wally's suggestion, I loop for that many seconds then SLEEP 1. This has been hitting the wake-up on the minute over quite a few machines for the past week or two. It appears PAUSE wouldn't come close to waking up at the right time. Anyway, directing my attention to a previously unused BASIC statement is always fun. Thanks, Bill dean.armbrus...@ferguson.com said the following on 4/7/2010 7:59 AM: As an alternative to SLEEP, use PAUSE. A process in PAUSE will return the call stack via PORT.STATUS. SLEEP, CALLC, PCPERFORM, and waiting on a record lock are some of most common conditions which will not return a call stack via PORT.STATUS. Dean Armbruster System
Re: [U2] UD: Phantoms
As an alternative to SLEEP, use PAUSE. A process in PAUSE will return the call stack via PORT.STATUS. SLEEP, CALLC, PCPERFORM, and waiting on a record lock are some of most common conditions which will not return a call stack via PORT.STATUS. Dean Armbruster System Analyst 757-989-2839 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wally Terhune Sent: Friday, April 02, 2010 2:05 PM To: U2 Users List Subject: Re: [U2] UD: Phantoms Not sure. We do use signaling to 'interrupt' the running process and get it to tell the PORT.STATUS session what it is up to. IIRC, we use SIGUSR2, specifically. So - there could be some system calls that the udt process is in that cannot be interrupted. For instance, I tested a phantom that was running 'SLEEP 120' - and experienced the same result as Bill (no call stack printed). I changed this to a loop FOR 120 that was printing a line, then SLEEP 1 Here is the result: :LISTUSER Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total ( 32 + 32 ) / 64 2 0 0 0 2 UDTNO USRNBR UID USRNAME USRTYPE TTYIP-ADDRESSTIME DATE 1 5372 305730 WTerhune udt pts/1 Console 11:53:11 Apr 02 2010 2 6020 305730 WTerhune phantom pts/2 Console 11:58:05 Apr 02 2010 3 2384 305730 WTerhune udt pts/3 Console 11:55:11 Apr 02 2010 :PORT.STATUS PID 6020 CALL.STACK Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total (32 + 32) / 64 2 0 0 0 2 Udtno Pid User UserType Port Last command processed 2 6020 WTerhune phantom 8443624 level line BASIC callstack 1 4 BP\_WWW Session no command stack. : Wally Terhune U2 Support Architect Rocket Software 4700 S. Syracuse Street, Suite 400 **Denver, CO 80237 **USA Tel: +1.720.475.8055 Email: wterh...@rs.com Web: www.rocketsoftware.com/u2 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Friday, April 02, 2010 10:22 AM To: U2 Users List Subject: Re: [U2] UD: Phantoms Wally: Thanks. Using LISTUSER() I can figure out what processes are phantoms but not what they're running. Thus, I have no way to figure out of my BACKGROUND.SERVICE program is running (it sleeps and wakes up every minute). When I do a PORT.STATUS PID {pid# of phantom} CALL.STACK nothing is returned (and it takes about 15 seconds on a fast, development system). 2 Dev (0)- LU Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total ( 24 + 1 ) / 25 3 0 0 0 3 UDTNO USRNBR UID USRNAME USRTYPE TTYIP-ADDRESSTIME DATE 1 2192 197614 AsiAdmin phantom pts/1 Console 05:51:51 Apr 02 2010 2 3248 197615 wphaskett udt pts/2 192.168.1.51 05:54:32 Apr 02 2010 2 Dev (0)- PORT.STATUS PID 2192 CALL.STACK Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total (24 + 1) / 25 3 0 0 0 3 Udtno Pid User UserType Port Last command processed 1 2192 AsiAdmin phantom 28101260 2 Dev (0)- Am I missing something? Thanks again. Bill Wally Terhune said the following on 4/2/2010 8:40 AM: Question wasn't clear to me. If looking at active processes, listuser shows which are phantoms (USRTYPE column) Also - UniBasic LISTUSER() function returns this as dynamic array for easy parsing :listuser Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total ( 32 + 32 ) / 64 1 0 0 0 1 UDTNO USRNBR UID USRNAME USRTYPE TTYIP-ADDRESSTIME DATE 1 5936 305730 WTerhune udt pts/1 Console 09:34:36 Apr 02 2010 2 4300 305730 WTerhune phantom pts/2 Console 09:34:58 Apr 02 2010 Wally Terhune U2 Support Architect Rocket Software 4700 S. Syracuse Street, Suite 400 **Denver, CO 80237 **USA Tel: +1.720.475.8055 Email: wterh...@rs.com Web: www.rocketsoftware.com/u2 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Martin Phillips Sent: Friday, April 02, 2010 9:35 AM To: U2 Users List Subject: Re: [U2] UD: Phantoms Hi Bill, In UniData, does anyone know of a sure way to determine if a BASIC program is running as a phantom? Take a look at the @USER.TYPE variable. This contains 1 for a phantom. Martin Phillips Ladybridge Systems Ltd 17b Coldstream Lane, Hardingstone, Northampton, NN4 6DB +44-(0)1604-709200 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
Dean: I ran some tests on PAUSE and it never seemed granular enough to properly work when the time it wakes up important. In other words, I'd pause for 30 and it would pause for sometimes 26 seconds, sometimes 28 seconds, sometimes 23 seconds, sometimes 25 seconds, but never over 30 seconds. SLEEP, however, always seemed to be on time. PAUSE was also cool in that I could find out which lines were paused with the LIST.PAUSE command. I could also WAKE the process from another line. Our UD service program wakes up every minute on the minute. I figure out how many seconds until the next minute then, per Wally's suggestion, I loop for that many seconds then SLEEP 1. This has been hitting the wake-up on the minute over quite a few machines for the past week or two. It appears PAUSE wouldn't come close to waking up at the right time. Anyway, directing my attention to a previously unused BASIC statement is always fun. Thanks, Bill dean.armbrus...@ferguson.com said the following on 4/7/2010 7:59 AM: As an alternative to SLEEP, use PAUSE. A process in PAUSE will return the call stack via PORT.STATUS. SLEEP, CALLC, PCPERFORM, and waiting on a record lock are some of most common conditions which will not return a call stack via PORT.STATUS. Dean Armbruster System Analyst 757-989-2839 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wally Terhune Sent: Friday, April 02, 2010 2:05 PM To: U2 Users List Subject: Re: [U2] UD: Phantoms Not sure. We do use signaling to 'interrupt' the running process and get it to tell the PORT.STATUS session what it is up to. IIRC, we use SIGUSR2, specifically. So - there could be some system calls that the udt process is in that cannot be interrupted. For instance, I tested a phantom that was running 'SLEEP 120' - and experienced the same result as Bill (no call stack printed). I changed this to a loop FOR 120 that was printing a line, then SLEEP 1 Here is the result: :LISTUSER Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total ( 32 + 32 ) / 64 2 0 0 0 2 UDTNO USRNBR UID USRNAME USRTYPE TTYIP-ADDRESSTIME DATE 1 5372 305730 WTerhune udt pts/1 Console 11:53:11 Apr 02 2010 2 6020 305730 WTerhune phantom pts/2 Console 11:58:05 Apr 02 2010 3 2384 305730 WTerhune udt pts/3 Console 11:55:11 Apr 02 2010 :PORT.STATUS PID 6020 CALL.STACK Licensed(UDT+CP)/Effective Udt Sql iPhtm PooledTotal (32 + 32) / 64 2 0 0 0 2 Udtno Pid User UserType Port Last command processed 2 6020 WTerhune phantom 8443624 level line BASIC callstack 1 4 BP\_WWW Session no command stack. : Wally Terhune U2 Support Architect Rocket Software 4700 S. Syracuse Street, Suite 400 **Denver, CO 80237 **USA Tel: +1.720.475.8055 Email: wterh...@rs.com Web: www.rocketsoftware.com/u2 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Friday, April 02, 2010 10:22 AM To: U2 Users List Subject: Re: [U2] UD: Phantoms Wally: Thanks. Using LISTUSER() I can figure out what processes are phantoms but not what they're running. Thus, I have no way to figure out of my BACKGROUND.SERVICE program is running (it sleeps and wakes up every minute). When I do a PORT.STATUS PID {pid# of phantom} CALL.STACK nothing is returned (and it takes about 15 seconds on a fast, development system). 2 Dev (0)- LU Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total ( 24 + 1 ) / 25 3 0 0 0 3 UDTNO USRNBR UID USRNAME USRTYPE TTYIP-ADDRESSTIME DATE 1 2192 197614 AsiAdmin phantom pts/1 Console 05:51:51 Apr 02 2010 2 3248 197615 wphaskett udt pts/2 192.168.1.51 05:54:32 Apr 02 2010 2 Dev (0)- PORT.STATUS PID 2192 CALL.STACK Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total (24 + 1) / 25 3 0 0 0 3 Udtno Pid User UserType Port Last command processed 1 2192 AsiAdmin phantom 28101260 2 Dev (0)- Am I missing something? Thanks again. Bill Wally Terhune said the following on 4/2/2010 8:40 AM: Question wasn't clear to me. If looking at active processes, listuser shows which are phantoms (USRTYPE column) Also - UniBasic LISTUSER() function returns this as dynamic array for easy parsing :listuser Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total ( 32 + 32 ) / 64 1 0 0 0 1 UDTNO USRNBR UID
Re: [U2] UD: Phantoms
Well. I have to apologize for disparaging PAUSE. I ran tests by: PauseTime = 30 StartTime = TIME() PAUSE PauseTime StopTime = TIME() CRT Starting at : OCONV(StartTime, 'MTS') CRT Stopping at : OCONV(StopTime, 'MTS') CRT Total time taken is : OCONV(StopTime - StartTime, 'MTS') ...and the total time taken was rarely the PauseTime. So I ran the test with SLEEP and it worked properly. So I replaced SLEEP with PAUSE in our background service program and it wakes up every minute on the exact second. So, I guess, my test program wasn't working. Don't know why though. :-( Bill Bill Haskett said the following on 4/7/2010 10:02 AM: Dean: I ran some tests on PAUSE and it never seemed granular enough to properly work when the time it wakes up important. In other words, I'd pause for 30 and it would pause for sometimes 26 seconds, sometimes 28 seconds, sometimes 23 seconds, sometimes 25 seconds, but never over 30 seconds. SLEEP, however, always seemed to be on time. PAUSE was also cool in that I could find out which lines were paused with the LIST.PAUSE command. I could also WAKE the process from another line. Our UD service program wakes up every minute on the minute. I figure out how many seconds until the next minute then, per Wally's suggestion, I loop for that many seconds then SLEEP 1. This has been hitting the wake-up on the minute over quite a few machines for the past week or two. It appears PAUSE wouldn't come close to waking up at the right time. Anyway, directing my attention to a previously unused BASIC statement is always fun. Thanks, Bill dean.armbrus...@ferguson.com said the following on 4/7/2010 7:59 AM: As an alternative to SLEEP, use PAUSE. A process in PAUSE will return the call stack via PORT.STATUS. SLEEP, CALLC, PCPERFORM, and waiting on a record lock are some of most common conditions which will not return a call stack via PORT.STATUS. Dean Armbruster System Analyst 757-989-2839 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wally Terhune Sent: Friday, April 02, 2010 2:05 PM To: U2 Users List Subject: Re: [U2] UD: Phantoms Not sure. We do use signaling to 'interrupt' the running process and get it to tell the PORT.STATUS session what it is up to. IIRC, we use SIGUSR2, specifically. So - there could be some system calls that the udt process is in that cannot be interrupted. For instance, I tested a phantom that was running 'SLEEP 120' - and experienced the same result as Bill (no call stack printed). I changed this to a loop FOR 120 that was printing a line, then SLEEP 1 Here is the result: :LISTUSER Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total ( 32 + 32 ) / 64 2 0 0 0 2 UDTNO USRNBR UID USRNAME USRTYPE TTYIP-ADDRESSTIME DATE 1 5372 305730 WTerhune udt pts/1 Console 11:53:11 Apr 02 2010 2 6020 305730 WTerhune phantom pts/2 Console 11:58:05 Apr 02 2010 3 2384 305730 WTerhune udt pts/3 Console 11:55:11 Apr 02 2010 :PORT.STATUS PID 6020 CALL.STACK Licensed(UDT+CP)/Effective Udt Sql iPhtm PooledTotal (32 + 32) / 64 2 0 0 0 2 Udtno Pid User UserType Port Last command processed 2 6020 WTerhune phantom 8443624 level line BASIC callstack 1 4 BP\_WWW Session no command stack. : Wally Terhune U2 Support Architect Rocket Software 4700 S. Syracuse Street, Suite 400 **Denver, CO 80237 **USA Tel: +1.720.475.8055 Email: wterh...@rs.com Web: www.rocketsoftware.com/u2 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Friday, April 02, 2010 10:22 AM To: U2 Users List Subject: Re: [U2] UD: Phantoms Wally: Thanks. Using LISTUSER() I can figure out what processes are phantoms but not what they're running. Thus, I have no way to figure out of my BACKGROUND.SERVICE program is running (it sleeps and wakes up every minute). When I do a PORT.STATUS PID {pid# of phantom} CALL.STACK nothing is returned (and it takes about 15 seconds on a fast, development system). 2 Dev (0)- LU Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total ( 24 + 1 ) / 25 3 0 0 0 3 UDTNO USRNBR UID USRNAME USRTYPE TTYIP-ADDRESSTIME DATE 1 2192 197614 AsiAdmin phantom pts/1 Console 05:51:51 Apr 02 2010 2 3248 197615 wphaskett udt pts/2 192.168.1.51 05:54:32 Apr 02 2010 2 Dev (0)- PORT.STATUS PID 2192 CALL.STACK Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total (24 + 1) / 25
Re: [U2] UD: Phantoms
I might have missed Bill why are you sleeping for a minute in a phantom? What's it doing that it needs to wake up every minute? ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
Bill, I get similar results to your test program. INPUT PauseTime FOR I = 1 TO 10 StartTime = TIME() PAUSE PauseTime StopTime = TIME() CRT Total time taken is : OCONV(StopTime - StartTime, 'MTS'): CRT , expected : OCONV(PauseTime, 'MTS') NEXT I Run from ECL Input = 5, Times taken: 6,10,10,10,10,10... Input = 10, first time taken was 8, the next 9 where all 10. ... So, clearly PAUSE aligns itself to a 10 second boundary and can only operate on that. Given this, PAUSE works correctly for any 10 second increment, AFTER the first pause statement. Something like this should be added to the document, because according to the manuals 'PAUSE 5' should work, but in practice, it will actually running a 'PAUSE 10' with the first PAUSE statement pausing for an undefined period. Regards, Dan -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Thursday, 8 April 2010 3:38 AM To: U2 Users List Subject: Re: [U2] UD: Phantoms Well. I have to apologize for disparaging PAUSE. I ran tests by: PauseTime = 30 StartTime = TIME() PAUSE PauseTime StopTime = TIME() CRT Starting at : OCONV(StartTime, 'MTS') CRT Stopping at : OCONV(StopTime, 'MTS') CRT Total time taken is : OCONV(StopTime - StartTime, 'MTS') ...and the total time taken was rarely the PauseTime. So I ran the test with SLEEP and it worked properly. So I replaced SLEEP with PAUSE in our background service program and it wakes up every minute on the exact second. So, I guess, my test program wasn't working. Don't know why though. :-( Bill Bill Haskett said the following on 4/7/2010 10:02 AM: Dean: I ran some tests on PAUSE and it never seemed granular enough to properly work when the time it wakes up important. In other words, I'd pause for 30 and it would pause for sometimes 26 seconds, sometimes 28 seconds, sometimes 23 seconds, sometimes 25 seconds, but never over 30 seconds. SLEEP, however, always seemed to be on time. PAUSE was also cool in that I could find out which lines were paused with the LIST.PAUSE command. I could also WAKE the process from another line. Our UD service program wakes up every minute on the minute. I figure out how many seconds until the next minute then, per Wally's suggestion, I loop for that many seconds then SLEEP 1. This has been hitting the wake-up on the minute over quite a few machines for the past week or two. It appears PAUSE wouldn't come close to waking up at the right time. Anyway, directing my attention to a previously unused BASIC statement is always fun. Thanks, Bill dean.armbrus...@ferguson.com said the following on 4/7/2010 7:59 AM: As an alternative to SLEEP, use PAUSE. A process in PAUSE will return the call stack via PORT.STATUS. SLEEP, CALLC, PCPERFORM, and waiting on a record lock are some of most common conditions which will not return a call stack via PORT.STATUS. Dean Armbruster System Analyst 757-989-2839 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wally Terhune Sent: Friday, April 02, 2010 2:05 PM To: U2 Users List Subject: Re: [U2] UD: Phantoms Not sure. We do use signaling to 'interrupt' the running process and get it to tell the PORT.STATUS session what it is up to. IIRC, we use SIGUSR2, specifically. So - there could be some system calls that the udt process is in that cannot be interrupted. For instance, I tested a phantom that was running 'SLEEP 120' - and experienced the same result as Bill (no call stack printed). I changed this to a loop FOR 120 that was printing a line, then SLEEP 1 Here is the result: :LISTUSER Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total ( 32 + 32 ) / 64 2 0 0 0 2 UDTNO USRNBR UID USRNAME USRTYPE TTYIP-ADDRESSTIME DATE 1 5372 305730 WTerhune udt pts/1 Console 11:53:11 Apr 02 2010 2 6020 305730 WTerhune phantom pts/2 Console 11:58:05 Apr 02 2010 3 2384 305730 WTerhune udt pts/3 Console 11:55:11 Apr 02 2010 :PORT.STATUS PID 6020 CALL.STACK Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total (32 + 32) / 64 2 0 0 0 2 Udtno Pid User UserType Port Last command processed 2 6020 WTerhune phantom 8443624 level line BASIC callstack 1 4 BP\_WWW Session no command stack. : Wally Terhune U2 Support Architect Rocket Software 4700 S. Syracuse Street, Suite 400 **Denver, CO 80237 **USA Tel: +1.720.475.8055 Email: wterh...@rs.com Web: www.rocketsoftware.com/u2 -Original Message- From: u2
Re: [U2] UD: Phantoms
Further to that, you can break PAUSE for an entire session by using the break key to kill it while active. To reproduce: At ecl, type in PAUSE and press enter. Use the break key to kill it. ECL should look like this now: :PAUSE BREAK: Enter Qreturn to Quit. Any other character to continueQ : Now, do a LIST.PAUSED. You will see your session is still listed as paused. Run PAUSE again. It will return straight away. Issue a WAKE for your paused session to remove it from the paused list. Run PAUSE again. It will return straight away. Run Bills test program. It will report 0 seconds as the time taken. PAUSE will now not work again in your session, time to log out. :( -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dan McGrath Sent: Thursday, 8 April 2010 8:34 AM To: U2 Users List Subject: Re: [U2] UD: Phantoms Bill, I get similar results to your test program. INPUT PauseTime FOR I = 1 TO 10 StartTime = TIME() PAUSE PauseTime StopTime = TIME() CRT Total time taken is : OCONV(StopTime - StartTime, 'MTS'): CRT , expected : OCONV(PauseTime, 'MTS') NEXT I Run from ECL Input = 5, Times taken: 6,10,10,10,10,10... Input = 10, first time taken was 8, the next 9 where all 10. ... So, clearly PAUSE aligns itself to a 10 second boundary and can only operate on that. Given this, PAUSE works correctly for any 10 second increment, AFTER the first pause statement. Something like this should be added to the document, because according to the manuals 'PAUSE 5' should work, but in practice, it will actually running a 'PAUSE 10' with the first PAUSE statement pausing for an undefined period. Regards, Dan -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Thursday, 8 April 2010 3:38 AM To: U2 Users List Subject: Re: [U2] UD: Phantoms Well. I have to apologize for disparaging PAUSE. I ran tests by: PauseTime = 30 StartTime = TIME() PAUSE PauseTime StopTime = TIME() CRT Starting at : OCONV(StartTime, 'MTS') CRT Stopping at : OCONV(StopTime, 'MTS') CRT Total time taken is : OCONV(StopTime - StartTime, 'MTS') ...and the total time taken was rarely the PauseTime. So I ran the test with SLEEP and it worked properly. So I replaced SLEEP with PAUSE in our background service program and it wakes up every minute on the exact second. So, I guess, my test program wasn't working. Don't know why though. :-( Bill Bill Haskett said the following on 4/7/2010 10:02 AM: Dean: I ran some tests on PAUSE and it never seemed granular enough to properly work when the time it wakes up important. In other words, I'd pause for 30 and it would pause for sometimes 26 seconds, sometimes 28 seconds, sometimes 23 seconds, sometimes 25 seconds, but never over 30 seconds. SLEEP, however, always seemed to be on time. PAUSE was also cool in that I could find out which lines were paused with the LIST.PAUSE command. I could also WAKE the process from another line. Our UD service program wakes up every minute on the minute. I figure out how many seconds until the next minute then, per Wally's suggestion, I loop for that many seconds then SLEEP 1. This has been hitting the wake-up on the minute over quite a few machines for the past week or two. It appears PAUSE wouldn't come close to waking up at the right time. Anyway, directing my attention to a previously unused BASIC statement is always fun. Thanks, Bill dean.armbrus...@ferguson.com said the following on 4/7/2010 7:59 AM: As an alternative to SLEEP, use PAUSE. A process in PAUSE will return the call stack via PORT.STATUS. SLEEP, CALLC, PCPERFORM, and waiting on a record lock are some of most common conditions which will not return a call stack via PORT.STATUS. Dean Armbruster System Analyst 757-989-2839 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wally Terhune Sent: Friday, April 02, 2010 2:05 PM To: U2 Users List Subject: Re: [U2] UD: Phantoms Not sure. We do use signaling to 'interrupt' the running process and get it to tell the PORT.STATUS session what it is up to. IIRC, we use SIGUSR2, specifically. So - there could be some system calls that the udt process is in that cannot be interrupted. For instance, I tested a phantom that was running 'SLEEP 120' - and experienced the same result as Bill (no call stack printed). I changed this to a loop FOR 120 that was printing a line, then SLEEP 1 Here is the result: :LISTUSER Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total ( 32 + 32 ) / 64 2 0 0 0 2 UDTNO USRNBR UID USRNAME
Re: [U2] UD: Phantoms {Unclassified}
Meh! Like NAP 1 in UniVerse on Windows is actually NAP 18 - you can't actually NAP for 1 millisecond, the lowest resolution seems to be about 18 milliseconds. YMMV Mike -Original Message- From: u2-users-boun...@listserver.u2ug.org On Behalf Of Dan McGrath Sent: Thursday, 8 April 2010 10:34 a.m. To: U2 Users List Subject: Re: [U2] UD: Phantoms Bill, I get similar results to your test program. INPUT PauseTime FOR I = 1 TO 10 StartTime = TIME() PAUSE PauseTime StopTime = TIME() CRT Total time taken is : OCONV(StopTime - StartTime, 'MTS'): CRT , expected : OCONV(PauseTime, 'MTS') NEXT I Run from ECL Input = 5, Times taken: 6,10,10,10,10,10... Input = 10, first time taken was 8, the next 9 where all 10. ... So, clearly PAUSE aligns itself to a 10 second boundary and can only operate on that. Given this, PAUSE works correctly for any 10 second increment, AFTER the first pause statement. Something like this should be added to the document, because according to the manuals 'PAUSE 5' should work, but in practice, it will actually running a 'PAUSE 10' with the first PAUSE statement pausing for an undefined period. Regards, Dan The information contained in this Internet Email message is intended for the addressee only and may contain privileged information, but not necessarily the official views or opinions of the New Zealand Defence Force. If you are not the intended recipient you must not use, disclose, copy or distribute this message or the information in it. If you have received this message in error, please Email or telephone the sender immediately. ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
The PAUSE signaling interval is tied to the -m argument on cleanup (which is 10 by default). On UNIX, you can modify the cleanup start command in the startud script (which Dean has done) to change this.. I believe he compromised on -m3 I haven't had a chance today to research how you could change this on Windows (or if you can). Yes it could be better... (and better) Wally Terhune U2 Support Architect Rocket Software 4700 S. Syracuse Street, Suite 400 **Denver, CO 80237 **USA Tel: +1.720.475.8055 Email: wterh...@rs.com Web: www.rocketsoftware.com/u2 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dan McGrath Sent: Wednesday, April 07, 2010 4:34 PM To: U2 Users List Subject: Re: [U2] UD: Phantoms Bill, I get similar results to your test program. INPUT PauseTime FOR I = 1 TO 10 StartTime = TIME() PAUSE PauseTime StopTime = TIME() CRT Total time taken is : OCONV(StopTime - StartTime, 'MTS'): CRT , expected : OCONV(PauseTime, 'MTS') NEXT I Run from ECL Input = 5, Times taken: 6,10,10,10,10,10... Input = 10, first time taken was 8, the next 9 where all 10. ... So, clearly PAUSE aligns itself to a 10 second boundary and can only operate on that. Given this, PAUSE works correctly for any 10 second increment, AFTER the first pause statement. Something like this should be added to the document, because according to the manuals 'PAUSE 5' should work, but in practice, it will actually running a 'PAUSE 10' with the first PAUSE statement pausing for an undefined period. Regards, Dan -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Thursday, 8 April 2010 3:38 AM To: U2 Users List Subject: Re: [U2] UD: Phantoms Well. I have to apologize for disparaging PAUSE. I ran tests by: PauseTime = 30 StartTime = TIME() PAUSE PauseTime StopTime = TIME() CRT Starting at : OCONV(StartTime, 'MTS') CRT Stopping at : OCONV(StopTime, 'MTS') CRT Total time taken is : OCONV(StopTime - StartTime, 'MTS') ...and the total time taken was rarely the PauseTime. So I ran the test with SLEEP and it worked properly. So I replaced SLEEP with PAUSE in our background service program and it wakes up every minute on the exact second. So, I guess, my test program wasn't working. Don't know why though. :-( Bill Bill Haskett said the following on 4/7/2010 10:02 AM: Dean: I ran some tests on PAUSE and it never seemed granular enough to properly work when the time it wakes up important. In other words, I'd pause for 30 and it would pause for sometimes 26 seconds, sometimes 28 seconds, sometimes 23 seconds, sometimes 25 seconds, but never over 30 seconds. SLEEP, however, always seemed to be on time. PAUSE was also cool in that I could find out which lines were paused with the LIST.PAUSE command. I could also WAKE the process from another line. Our UD service program wakes up every minute on the minute. I figure out how many seconds until the next minute then, per Wally's suggestion, I loop for that many seconds then SLEEP 1. This has been hitting the wake-up on the minute over quite a few machines for the past week or two. It appears PAUSE wouldn't come close to waking up at the right time. Anyway, directing my attention to a previously unused BASIC statement is always fun. Thanks, Bill dean.armbrus...@ferguson.com said the following on 4/7/2010 7:59 AM: As an alternative to SLEEP, use PAUSE. A process in PAUSE will return the call stack via PORT.STATUS. SLEEP, CALLC, PCPERFORM, and waiting on a record lock are some of most common conditions which will not return a call stack via PORT.STATUS. Dean Armbruster System Analyst 757-989-2839 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wally Terhune Sent: Friday, April 02, 2010 2:05 PM To: U2 Users List Subject: Re: [U2] UD: Phantoms Not sure. We do use signaling to 'interrupt' the running process and get it to tell the PORT.STATUS session what it is up to. IIRC, we use SIGUSR2, specifically. So - there could be some system calls that the udt process is in that cannot be interrupted. For instance, I tested a phantom that was running 'SLEEP 120' - and experienced the same result as Bill (no call stack printed). I changed this to a loop FOR 120 that was printing a line, then SLEEP 1 Here is the result: :LISTUSER Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total ( 32 + 32 ) / 64 2 0 0 0 2 UDTNO USRNBR UID USRNAME USRTYPE TTYIP-ADDRESSTIME DATE 1 5372 305730 WTerhune udt pts/1 Console 11:53:11
Re: [U2] UD: Phantoms
cleanupd, not cleanup (long day - didn't catch the Windows grammar fixer change...) Wally Terhune U2 Support Architect Rocket Software 4700 S. Syracuse Street, Suite 400 **Denver, CO 80237 **USA Tel: +1.720.475.8055 Email: wterh...@rs.com Web: www.rocketsoftware.com/u2 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wally Terhune Sent: Wednesday, April 07, 2010 5:35 PM To: U2 Users List Subject: Re: [U2] UD: Phantoms The PAUSE signaling interval is tied to the -m argument on cleanup (which is 10 by default). On UNIX, you can modify the cleanup start command in the startud script (which Dean has done) to change this.. I believe he compromised on -m3 I haven't had a chance today to research how you could change this on Windows (or if you can). Yes it could be better... (and better) Wally Terhune U2 Support Architect Rocket Software 4700 S. Syracuse Street, Suite 400 **Denver, CO 80237 **USA Tel: +1.720.475.8055 Email: wterh...@rs.com Web: www.rocketsoftware.com/u2 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dan McGrath Sent: Wednesday, April 07, 2010 4:34 PM To: U2 Users List Subject: Re: [U2] UD: Phantoms Bill, I get similar results to your test program. INPUT PauseTime FOR I = 1 TO 10 StartTime = TIME() PAUSE PauseTime StopTime = TIME() CRT Total time taken is : OCONV(StopTime - StartTime, 'MTS'): CRT , expected : OCONV(PauseTime, 'MTS') NEXT I Run from ECL Input = 5, Times taken: 6,10,10,10,10,10... Input = 10, first time taken was 8, the next 9 where all 10. ... So, clearly PAUSE aligns itself to a 10 second boundary and can only operate on that. Given this, PAUSE works correctly for any 10 second increment, AFTER the first pause statement. Something like this should be added to the document, because according to the manuals 'PAUSE 5' should work, but in practice, it will actually running a 'PAUSE 10' with the first PAUSE statement pausing for an undefined period. Regards, Dan -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Thursday, 8 April 2010 3:38 AM To: U2 Users List Subject: Re: [U2] UD: Phantoms Well. I have to apologize for disparaging PAUSE. I ran tests by: PauseTime = 30 StartTime = TIME() PAUSE PauseTime StopTime = TIME() CRT Starting at : OCONV(StartTime, 'MTS') CRT Stopping at : OCONV(StopTime, 'MTS') CRT Total time taken is : OCONV(StopTime - StartTime, 'MTS') ...and the total time taken was rarely the PauseTime. So I ran the test with SLEEP and it worked properly. So I replaced SLEEP with PAUSE in our background service program and it wakes up every minute on the exact second. So, I guess, my test program wasn't working. Don't know why though. :-( Bill Bill Haskett said the following on 4/7/2010 10:02 AM: Dean: I ran some tests on PAUSE and it never seemed granular enough to properly work when the time it wakes up important. In other words, I'd pause for 30 and it would pause for sometimes 26 seconds, sometimes 28 seconds, sometimes 23 seconds, sometimes 25 seconds, but never over 30 seconds. SLEEP, however, always seemed to be on time. PAUSE was also cool in that I could find out which lines were paused with the LIST.PAUSE command. I could also WAKE the process from another line. Our UD service program wakes up every minute on the minute. I figure out how many seconds until the next minute then, per Wally's suggestion, I loop for that many seconds then SLEEP 1. This has been hitting the wake-up on the minute over quite a few machines for the past week or two. It appears PAUSE wouldn't come close to waking up at the right time. Anyway, directing my attention to a previously unused BASIC statement is always fun. Thanks, Bill dean.armbrus...@ferguson.com said the following on 4/7/2010 7:59 AM: As an alternative to SLEEP, use PAUSE. A process in PAUSE will return the call stack via PORT.STATUS. SLEEP, CALLC, PCPERFORM, and waiting on a record lock are some of most common conditions which will not return a call stack via PORT.STATUS. Dean Armbruster System Analyst 757-989-2839 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wally Terhune Sent: Friday, April 02, 2010 2:05 PM To: U2 Users List Subject: Re: [U2] UD: Phantoms Not sure. We do use signaling to 'interrupt' the running process and get it to tell the PORT.STATUS session what it is up to. IIRC, we use SIGUSR2, specifically. So - there could be some system calls that the udt process is in that cannot be interrupted
Re: [U2] UD: Phantoms
Hi Bill, In UniData, does anyone know of a sure way to determine if a BASIC program is running as a phantom? Take a look at the @USER.TYPE variable. This contains 1 for a phantom. Martin Phillips Ladybridge Systems Ltd 17b Coldstream Lane, Hardingstone, Northampton, NN4 6DB +44-(0)1604-709200 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
Question wasn't clear to me. If looking at active processes, listuser shows which are phantoms (USRTYPE column) Also - UniBasic LISTUSER() function returns this as dynamic array for easy parsing :listuser Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total ( 32 + 32 ) / 64 1 0 0 0 1 UDTNO USRNBR UID USRNAME USRTYPE TTYIP-ADDRESSTIME DATE 1 5936 305730 WTerhune udt pts/1 Console 09:34:36 Apr 02 2010 2 4300 305730 WTerhune phantom pts/2 Console 09:34:58 Apr 02 2010 Wally Terhune U2 Support Architect Rocket Software 4700 S. Syracuse Street, Suite 400 **Denver, CO 80237 **USA Tel: +1.720.475.8055 Email: wterh...@rs.com Web: www.rocketsoftware.com/u2 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Martin Phillips Sent: Friday, April 02, 2010 9:35 AM To: U2 Users List Subject: Re: [U2] UD: Phantoms Hi Bill, In UniData, does anyone know of a sure way to determine if a BASIC program is running as a phantom? Take a look at the @USER.TYPE variable. This contains 1 for a phantom. Martin Phillips Ladybridge Systems Ltd 17b Coldstream Lane, Hardingstone, Northampton, NN4 6DB +44-(0)1604-709200 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
Bill: Use the LOCK command with number 0 through 63. Have your phantom process do a LOCK 60. Then you can test it in other programs using the else clause: LOCK 60 THEN UNLOCK 60 * Restart phantom END ELSE * Phantom is running do nothing END -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Friday, April 02, 2010 9:25 AM To: U2 Mail List Subject: [U2] UD: Phantoms In UniData, does anyone know of a sure way to determine if a BASIC program is running as a phantom? We have a background service program in our application that has to be running as a phantom whenever UniData starts. The ability to start something when the dbms starts doesn't exist in UniData, so I have to schedule the task when Windows starts. However, if the program stops (or UD was stopped and restarted) I have no sure way to know if it's running. Does UD have any way to know this? Thanks, Bill Haskett ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
Martin: @USER.TYPE only tells me if the current process (the one I'm logged in on) is a phantom. It tells me nothing about other processes nor what programs are running on those other processes. I think... :-) Bill Martin Phillips said the following on 4/2/2010 8:35 AM: Hi Bill, In UniData, does anyone know of a sure way to determine if a BASIC program is running as a phantom? Take a look at the @USER.TYPE variable. This contains 1 for a phantom. Martin Phillips Ladybridge Systems Ltd 17b Coldstream Lane, Hardingstone, Northampton, NN4 6DB +44-(0)1604-709200 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
For programs running on another process, use ECL PORT.STATUS command PORT.STATUS PID udt pid of target process CALL.STACK Wally Terhune U2 Support Architect Rocket Software 4700 S. Syracuse Street, Suite 400 **Denver, CO 80237 **USA Tel: +1.720.475.8055 Email: wterh...@rs.com Web: www.rocketsoftware.com/u2 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Friday, April 02, 2010 10:04 AM To: U2 Users List Subject: Re: [U2] UD: Phantoms Martin: @USER.TYPE only tells me if the current process (the one I'm logged in on) is a phantom. It tells me nothing about other processes nor what programs are running on those other processes. I think... :-) Bill Martin Phillips said the following on 4/2/2010 8:35 AM: Hi Bill, In UniData, does anyone know of a sure way to determine if a BASIC program is running as a phantom? Take a look at the @USER.TYPE variable. This contains 1 for a phantom. Martin Phillips Ladybridge Systems Ltd 17b Coldstream Lane, Hardingstone, Northampton, NN4 6DB +44-(0)1604-709200 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
Wally: Thanks. Using LISTUSER() I can figure out what processes are phantoms but not what they're running. Thus, I have no way to figure out of my BACKGROUND.SERVICE program is running (it sleeps and wakes up every minute). When I do a PORT.STATUS PID {pid# of phantom} CALL.STACK nothing is returned (and it takes about 15 seconds on a fast, development system). 2 Dev (0)- LU Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total ( 24 + 1 ) / 25 3 0 0 0 3 UDTNO USRNBR UID USRNAME USRTYPE TTYIP-ADDRESSTIME DATE 1 2192 197614 AsiAdmin phantom pts/1 Console 05:51:51 Apr 02 2010 2 3248 197615 wphaskett udt pts/2 192.168.1.51 05:54:32 Apr 02 2010 2 Dev (0)- PORT.STATUS PID 2192 CALL.STACK Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total (24 + 1) / 25 3 0 0 0 3 Udtno Pid User UserType Port Last command processed 1 2192 AsiAdmin phantom 28101260 2 Dev (0)- Am I missing something? Thanks again. Bill Wally Terhune said the following on 4/2/2010 8:40 AM: Question wasn't clear to me. If looking at active processes, listuser shows which are phantoms (USRTYPE column) Also - UniBasic LISTUSER() function returns this as dynamic array for easy parsing :listuser Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total ( 32 + 32 ) / 64 1 0 0 0 1 UDTNO USRNBR UID USRNAME USRTYPE TTYIP-ADDRESSTIME DATE 1 5936 305730 WTerhune udt pts/1 Console 09:34:36 Apr 02 2010 2 4300 305730 WTerhune phantom pts/2 Console 09:34:58 Apr 02 2010 Wally Terhune U2 Support Architect Rocket Software 4700 S. Syracuse Street, Suite 400 **Denver, CO 80237 **USA Tel: +1.720.475.8055 Email: wterh...@rs.com Web: www.rocketsoftware.com/u2 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Martin Phillips Sent: Friday, April 02, 2010 9:35 AM To: U2 Users List Subject: Re: [U2] UD: Phantoms Hi Bill, In UniData, does anyone know of a sure way to determine if a BASIC program is running as a phantom? Take a look at the @USER.TYPE variable. This contains 1 for a phantom. Martin Phillips Ladybridge Systems Ltd 17b Coldstream Lane, Hardingstone, Northampton, NN4 6DB +44-(0)1604-709200 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
Hi Bill, Apologies. I had mis-understood the question. It looks like you have sufficient responses for me to back out of this discussion. Martin Phillips Ladybridge Systems Ltd 17b Coldstream Lane, Hardingstone, Northampton, NN4 6DB +44-(0)1604-709200 - Original Message - From: Bill Haskett wphask...@advantos.net To: U2 Users List u2-users@listserver.u2ug.org Sent: Friday, April 02, 2010 5:03 PM Subject: Re: [U2] UD: Phantoms Martin: @USER.TYPE only tells me if the current process (the one I'm logged in on) is a phantom. It tells me nothing about other processes nor what programs are running on those other processes. I think... :-) Bill ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
Bill, I have my Phantom processes update a status record (in the DICT of the file related to the Process) with the date/time as the start of each loop. Each program has a characteristic sleep time. The status record also serves as a run flag which can be set to '0' to stop the phantom. I built a Inquiry screen that collects all the status records and displays them. Any process with an 'out of range' date /time stamp is suspect (has stopped). I had at one time a Phantom that watched these status records and re-launched the phantoms if the date/time was out of range, but I discontinued that as it was all too busy. I cannot think of the last time I actually had a phantom fail. We are on HP-UX so I can grep PHANTOM and see the name of the program, but would not tell me the account it is running in: !sh ps -ef | grep PHANTOM marcr 19329 1 0 01:41:02 ? 6:26 /usr/ud/bin/udt PHANTOMHUSH SYS.Z15 Marc Rutherford Senior Programmer/Analyst Advanced Bionics LLC 661) 362 1754 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Friday, April 02, 2010 8:25 AM To: U2 Mail List Subject: [U2] UD: Phantoms In UniData, does anyone know of a sure way to determine if a BASIC program is running as a phantom? We have a background service program in our application that has to be running as a phantom whenever UniData starts. The ability to start something when the dbms starts doesn't exist in UniData, so I have to schedule the task when Windows starts. However, if the program stops (or UD was stopped and restarted) I have no sure way to know if it's running. Does UD have any way to know this? Thanks, Bill Haskett ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
Doug: That is an idea. I was hoping I could be more direct, but this should work. Thanks, Bill Doug said the following on 4/2/2010 8:56 AM: Bill: Use the LOCK command with number 0 through 63. Have your phantom process do a LOCK 60. Then you can test it in other programs using the else clause: LOCK 60 THEN UNLOCK 60 * Restart phantom END ELSE * Phantom is running do nothing END -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Friday, April 02, 2010 9:25 AM To: U2 Mail List Subject: [U2] UD: Phantoms In UniData, does anyone know of a sure way to determine if a BASIC program is running as a phantom? We have a background service program in our application that has to be running as a phantom whenever UniData starts. The ability to start something when the dbms starts doesn't exist in UniData, so I have to schedule the task when Windows starts. However, if the program stops (or UD was stopped and restarted) I have no sure way to know if it's running. Does UD have any way to know this? Thanks, Bill Haskett ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
Thanks Marc. I do the same. The problem is if the program crashes (or UD gets recycled in the development environment) the dict item isn't updated; thus I can't tell if the program is running or not (unless there are zero phantoms running). I think I can manage the phantom services with the LOCK statement, as suggested by Doug. Thanks again. Bill Marc Rutherford said the following on 4/2/2010 10:01 AM: Bill, I have my Phantom processes update a status record (in the DICT of the file related to the Process) with the date/time as the start of each loop. Each program has a characteristic sleep time. The status record also serves as a run flag which can be set to '0' to stop the phantom. I built a Inquiry screen that collects all the status records and displays them. Any process with an 'out of range' date /time stamp is suspect (has stopped). I had at one time a Phantom that watched these status records and re-launched the phantoms if the date/time was out of range, but I discontinued that as it was all too busy. I cannot think of the last time I actually had a phantom fail. We are on HP-UX so I can grep PHANTOM and see the name of the program, but would not tell me the account it is running in: !sh ps -ef | grep PHANTOM marcr 19329 1 0 01:41:02 ? 6:26 /usr/ud/bin/udt PHANTOMHUSH SYS.Z15 Marc Rutherford Senior Programmer/Analyst Advanced Bionics LLC 661) 362 1754 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Friday, April 02, 2010 8:25 AM To: U2 Mail List Subject: [U2] UD: Phantoms In UniData, does anyone know of a sure way to determine if a BASIC program is running as a phantom? We have a background service program in our application that has to be running as a phantom whenever UniData starts. The ability to start something when the dbms starts doesn't exist in UniData, so I have to schedule the task when Windows starts. However, if the program stops (or UD was stopped and restarted) I have no sure way to know if it's running. Does UD have any way to know this? Thanks, Bill Haskett ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
Bill, We actually run this program to do what Marc suggests. Just formats the output a little nicer than the plain ps output. PROGRAM LIST.PHANTOMS STMT = '!sh -c ps -ef |grep PHANTOM |grep -v grep' EXECUTE STMT CAPTURING CAP NUM.LINES = DCOUNT(CAP,@AM) CRT CRT uid pid ? ? started cpu time run path name *** FOR X = 1 TO NUM.LINES CAPX = TRIM(CAPX,' ','B') CRT CAPX NEXT X HTH --bev At 4/2/2010 01:01 PM, Marc Rutherford wrote: Bill, I have my Phantom processes update a status record (in the DICT of the file related to the Process) with the date/time as the start of each loop. Each program has a characteristic sleep time. The status record also serves as a run flag which can be set to '0' to stop the phantom. I built a Inquiry screen that collects all the status records and displays them. Any process with an 'out of range' date /time stamp is suspect (has stopped). I had at one time a Phantom that watched these status records and re-launched the phantoms if the date/time was out of range, but I discontinued that as it was all too busy. I cannot think of the last time I actually had a phantom fail. We are on HP-UX so I can grep PHANTOM and see the name of the program, but would not tell me the account it is running in: !sh ps -ef | grep PHANTOM marcr 19329 1 0 01:41:02 ? 6:26 /usr/ud/bin/udt PHANTOMHUSH SYS.Z15 Marc Rutherford Senior Programmer/Analyst Advanced Bionics LLC 661) 362 1754 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Friday, April 02, 2010 8:25 AM To: U2 Mail List Subject: [U2] UD: Phantoms In UniData, does anyone know of a sure way to determine if a BASIC program is running as a phantom? We have a background service program in our application that has to be running as a phantom whenever UniData starts. The ability to start something when the dbms starts doesn't exist in UniData, so I have to schedule the task when Windows starts. However, if the program stops (or UD was stopped and restarted) I have no sure way to know if it's running. Does UD have any way to know this? Thanks, Bill Haskett ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users Bev Wilson 410.309.2700 voice 410.309.2701 fax ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
Doug: After reading the documentation for LOCK... Resources are not automatically unlocked by the termination of the locking program. The UniBasic UNLOCK or ECL QUIT commands must release them. Otherwise, you can release resources by executing the ECL CLEAR.LOCKS command at UniData level. ...the resource lock will still be set if the service program crashes. H. I'll have to think about this some more. :-( Bill Bill Haskett said the following on 4/2/2010 10:10 AM: Doug: That is an idea. I was hoping I could be more direct, but this should work. Thanks, Bill Doug said the following on 4/2/2010 8:56 AM: Bill: Use the LOCK command with number 0 through 63. Have your phantom process do a LOCK 60. Then you can test it in other programs using the else clause: LOCK 60 THEN UNLOCK 60 * Restart phantom END ELSE * Phantom is running do nothing END -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Friday, April 02, 2010 9:25 AM To: U2 Mail List Subject: [U2] UD: Phantoms In UniData, does anyone know of a sure way to determine if a BASIC program is running as a phantom? We have a background service program in our application that has to be running as a phantom whenever UniData starts. The ability to start something when the dbms starts doesn't exist in UniData, so I have to schedule the task when Windows starts. However, if the program stops (or UD was stopped and restarted) I have no sure way to know if it's running. Does UD have any way to know this? Thanks, Bill Haskett ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
Is there anyway to use the COMO file (_PH_)? If a Phantom ends or crashes the last line is something like PHANTOM process PID has completed. What happens when UDT is recycled? That has never happened to me. :-) Bruce M Neylon Health Care Management Group ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
Bruce: Thanks, but the _PH_ file is cleaned up every night using the CLEAR.ACCOUNT command (we use a number of 3rd party applications that create _PH_ items throughout the day). When I check out the locks I see it doesn't work as expected... 2 Dev (0)- LIST.LOCKS 2 Dev (0)- BPTEST LOCK 60 THEN CRT Lock 60 set... ELSE CRT Cannot access Lock 60... Compiling Unibasic: SAVEDLISTS\BpTest_374558121 in mode 'p'. compilation finished Lock 60 set... 2 Dev (0)- LIST.LOCKS UNO UNBR UIDUNAME TTY FILENAME RECORD_ID M TIME DATE 2 3248 197615 wphasket pts/2semaphore 60 X 10:24:10 Apr 02 2 Dev (0)- BPTEST LOCK 60 THEN CRT Lock 60 set... ELSE CRT Cannot access Lock 60... Compiling Unibasic: SAVEDLISTS\BpTest_374842961 in mode 'p'. compilation finished Lock 60 set... 2 Dev (0)- So, why didn't the program tell me it couldn't access lock 60 the second time I ran it? It seems the semaphone is very fussy about how it's set and who can unset it. It also didn't tell me it was set when I tested it in a BASIC program. So, this isn't looking like a viable solution after all. :-( Bill bney...@hcmg.net said the following on 4/2/2010 10:24 AM: Is there anyway to use the COMO file (_PH_)? If a Phantom ends or crashes the last line is something like PHANTOM process PID has completed. What happens when UDT is recycled? That has never happened to me. :-) Bruce M Neylon Health Care Management Group ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
I do a variation on this -- since my phantoms now need to be 'multi-account' (that is, 6 accounts, I need 6 phantoms - one per account) -- I do a READU of an 'item' from a 'Paramters' file -- the ItemID I attempt to read is AcctName-PHANRUN Don't care if it exists or not -- as long as the READU 'passes' -- if the LOCKED clause hits, I exit the 'startup'... I put this logic into a process I call during the LOGIN paragraph -- not flawless, in that people have to move in and out of the account, but for what I do, it works A-OK. This way, if another account needs to 'starts up' it can tell if the phantom for that account's data already has a phantom 'running' or not. Uses READU so that regardless of how the phantom dies, the lock goes with it. And more flexible than the LOCK 60 type of lock. DW -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Doug Sent: Friday, April 02, 2010 10:57 AM To: 'U2 Users List' Subject: Re: [U2] UD: Phantoms Bill: Use the LOCK command with number 0 through 63. Have your phantom process do a LOCK 60. Then you can test it in other programs using the else clause: LOCK 60 THEN UNLOCK 60 * Restart phantom END ELSE * Phantom is running do nothing END -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Friday, April 02, 2010 9:25 AM To: U2 Mail List Subject: [U2] UD: Phantoms In UniData, does anyone know of a sure way to determine if a BASIC program is running as a phantom? We have a background service program in our application that has to be running as a phantom whenever UniData starts. The ability to start something when the dbms starts doesn't exist in UniData, so I have to schedule the task when Windows starts. However, if the program stops (or UD was stopped and restarted) I have no sure way to know if it's running. Does UD have any way to know this? Thanks, Bill Haskett ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
Not sure. We do use signaling to 'interrupt' the running process and get it to tell the PORT.STATUS session what it is up to. IIRC, we use SIGUSR2, specifically. So - there could be some system calls that the udt process is in that cannot be interrupted. For instance, I tested a phantom that was running 'SLEEP 120' - and experienced the same result as Bill (no call stack printed). I changed this to a loop FOR 120 that was printing a line, then SLEEP 1 Here is the result: :LISTUSER Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total ( 32 + 32 ) / 64 2 0 0 0 2 UDTNO USRNBR UID USRNAME USRTYPE TTYIP-ADDRESSTIME DATE 1 5372 305730 WTerhune udt pts/1 Console 11:53:11 Apr 02 2010 2 6020 305730 WTerhune phantom pts/2 Console 11:58:05 Apr 02 2010 3 2384 305730 WTerhune udt pts/3 Console 11:55:11 Apr 02 2010 :PORT.STATUS PID 6020 CALL.STACK Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total (32 + 32) / 64 2 0 0 0 2 Udtno Pid User UserType Port Last command processed 2 6020 WTerhune phantom 8443624 level line BASIC callstack 1 4 BP\_WWW Session no command stack. : Wally Terhune U2 Support Architect Rocket Software 4700 S. Syracuse Street, Suite 400 **Denver, CO 80237 **USA Tel: +1.720.475.8055 Email: wterh...@rs.com Web: www.rocketsoftware.com/u2 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Friday, April 02, 2010 10:22 AM To: U2 Users List Subject: Re: [U2] UD: Phantoms Wally: Thanks. Using LISTUSER() I can figure out what processes are phantoms but not what they're running. Thus, I have no way to figure out of my BACKGROUND.SERVICE program is running (it sleeps and wakes up every minute). When I do a PORT.STATUS PID {pid# of phantom} CALL.STACK nothing is returned (and it takes about 15 seconds on a fast, development system). 2 Dev (0)- LU Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total ( 24 + 1 ) / 25 3 0 0 0 3 UDTNO USRNBR UID USRNAME USRTYPE TTYIP-ADDRESSTIME DATE 1 2192 197614 AsiAdmin phantom pts/1 Console 05:51:51 Apr 02 2010 2 3248 197615 wphaskett udt pts/2 192.168.1.51 05:54:32 Apr 02 2010 2 Dev (0)- PORT.STATUS PID 2192 CALL.STACK Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total (24 + 1) / 25 3 0 0 0 3 Udtno Pid User UserType Port Last command processed 1 2192 AsiAdmin phantom 28101260 2 Dev (0)- Am I missing something? Thanks again. Bill Wally Terhune said the following on 4/2/2010 8:40 AM: Question wasn't clear to me. If looking at active processes, listuser shows which are phantoms (USRTYPE column) Also - UniBasic LISTUSER() function returns this as dynamic array for easy parsing :listuser Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total ( 32 + 32 ) / 64 1 0 0 0 1 UDTNO USRNBR UID USRNAME USRTYPE TTYIP-ADDRESSTIME DATE 1 5936 305730 WTerhune udt pts/1 Console 09:34:36 Apr 02 2010 2 4300 305730 WTerhune phantom pts/2 Console 09:34:58 Apr 02 2010 Wally Terhune U2 Support Architect Rocket Software 4700 S. Syracuse Street, Suite 400 **Denver, CO 80237 **USA Tel: +1.720.475.8055 Email: wterh...@rs.com Web: www.rocketsoftware.com/u2 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Martin Phillips Sent: Friday, April 02, 2010 9:35 AM To: U2 Users List Subject: Re: [U2] UD: Phantoms Hi Bill, In UniData, does anyone know of a sure way to determine if a BASIC program is running as a phantom? Take a look at the @USER.TYPE variable. This contains 1 for a phantom. Martin Phillips Ladybridge Systems Ltd 17b Coldstream Lane, Hardingstone, Northampton, NN4 6DB +44-(0)1604-709200 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org
Re: [U2] UD: Phantoms
Bill: On some sites we use 6 phantoms to do various activities. When the program crashes, which we can remember only once in 5 years, the LOCK was released. The other programs that need to phantom restarted it just as was shown in the code below. And those locks are released on restart. There is one additional feature that we do is that phantoms should be restarted at least once a day (1am) rather than continually looping. This keeps the code refreshed if you have changed it and the stack very clean. Regards, Doug www.u2logic.com -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Friday, April 02, 2010 11:15 AM To: U2 Mail List Subject: Re: [U2] UD: Phantoms Doug: After reading the documentation for LOCK... Resources are not automatically unlocked by the termination of the locking program. The UniBasic UNLOCK or ECL QUIT commands must release them. Otherwise, you can release resources by executing the ECL CLEAR.LOCKS command at UniData level. ...the resource lock will still be set if the service program crashes. H. I'll have to think about this some more. :-( Bill Bill Haskett said the following on 4/2/2010 10:10 AM: Doug: That is an idea. I was hoping I could be more direct, but this should work. Thanks, Bill Doug said the following on 4/2/2010 8:56 AM: Bill: Use the LOCK command with number 0 through 63. Have your phantom process do a LOCK 60. Then you can test it in other programs using the else clause: LOCK 60 THEN UNLOCK 60 * Restart phantom END ELSE * Phantom is running do nothing END o/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
Thanks David. This could work. Bill David Wolverton said the following on 4/2/2010 10:57 AM: I do a variation on this -- since my phantoms now need to be 'multi-account' (that is, 6 accounts, I need 6 phantoms - one per account) -- I do a READU of an 'item' from a 'Paramters' file -- the ItemID I attempt to read is AcctName-PHANRUN Don't care if it exists or not -- as long as the READU 'passes' -- if the LOCKED clause hits, I exit the 'startup'... I put this logic into a process I call during the LOGIN paragraph -- not flawless, in that people have to move in and out of the account, but for what I do, it works A-OK. This way, if another account needs to 'starts up' it can tell if the phantom for that account's data already has a phantom 'running' or not. Uses READU so that regardless of how the phantom dies, the lock goes with it. And more flexible than the LOCK 60 type of lock. DW -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Doug Sent: Friday, April 02, 2010 10:57 AM To: 'U2 Users List' Subject: Re: [U2] UD: Phantoms Bill: Use the LOCK command with number 0 through 63. Have your phantom process do a LOCK 60. Then you can test it in other programs using the else clause: LOCK 60 THEN UNLOCK 60 * Restart phantom END ELSE * Phantom is running do nothing END -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Friday, April 02, 2010 9:25 AM To: U2 Mail List Subject: [U2] UD: Phantoms In UniData, does anyone know of a sure way to determine if a BASIC program is running as a phantom? We have a background service program in our application that has to be running as a phantom whenever UniData starts. The ability to start something when the dbms starts doesn't exist in UniData, so I have to schedule the task when Windows starts. However, if the program stops (or UD was stopped and restarted) I have no sure way to know if it's running. Does UD have any way to know this? Thanks, Bill Haskett ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
I second David's idea of using a READU also you can return exactly which port/pid has the lock set, which might be helpful as well if the phantom *shouldn't* be running! I'd go a set further and have the phantom actually timestamp when it set the READU lock. ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
I am on digest, so apologies if this is a duplication of a suggestion made earlier. We tend to use plain old record locks for our phantom processes. The record won't list but if you try to edit it, it will come back as locked and prevents a second instance of the process from running. Ex; * Set an exclusive record lock or exit if already running RECORDLOCKU F.FILENAME,BACKGROUND.SERVICE LOCKED * Send a message if necessary STOP END Also, for sleeping phantoms, I've found the LIST.PAUSED command helpful to at least see if they are there. It's not helpful at all for what they're running or where they're running. Shaun Ferguson Systems Analyst Ferguson Enterprises, Inc. ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
So, instead of sleeping for a minute (or close to it anyway) then loop 60 times and sleep for 1 second on each loop. I love it. :-) Thanks, Bill Wally Terhune said the following on 4/2/2010 11:05 AM: Not sure. We do use signaling to 'interrupt' the running process and get it to tell the PORT.STATUS session what it is up to. IIRC, we use SIGUSR2, specifically. So - there could be some system calls that the udt process is in that cannot be interrupted. For instance, I tested a phantom that was running 'SLEEP 120' - and experienced the same result as Bill (no call stack printed). I changed this to a loop FOR 120 that was printing a line, then SLEEP 1 Here is the result: :LISTUSER Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total ( 32 + 32 ) / 64 2 0 0 0 2 UDTNO USRNBR UID USRNAME USRTYPE TTYIP-ADDRESSTIME DATE 1 5372 305730 WTerhune udt pts/1 Console 11:53:11 Apr 02 2010 2 6020 305730 WTerhune phantom pts/2 Console 11:58:05 Apr 02 2010 3 2384 305730 WTerhune udt pts/3 Console 11:55:11 Apr 02 2010 :PORT.STATUS PID 6020 CALL.STACK Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total (32 + 32) / 64 2 0 0 0 2 Udtno Pid User UserType Port Last command processed 2 6020 WTerhune phantom 8443624 level line BASIC callstack 1 4 BP\_WWW Session no command stack. : Wally Terhune U2 Support Architect Rocket Software 4700 S. Syracuse Street, Suite 400 **Denver, CO 80237 **USA Tel: +1.720.475.8055 Email: wterh...@rs.com Web: www.rocketsoftware.com/u2 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Friday, April 02, 2010 10:22 AM To: U2 Users List Subject: Re: [U2] UD: Phantoms Wally: Thanks. Using LISTUSER() I can figure out what processes are phantoms but not what they're running. Thus, I have no way to figure out of my BACKGROUND.SERVICE program is running (it sleeps and wakes up every minute). When I do a PORT.STATUS PID {pid# of phantom} CALL.STACK nothing is returned (and it takes about 15 seconds on a fast, development system). 2 Dev (0)- LU Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total ( 24 + 1 ) / 25 3 0 0 0 3 UDTNO USRNBR UID USRNAME USRTYPE TTYIP-ADDRESSTIME DATE 1 2192 197614 AsiAdmin phantom pts/1 Console 05:51:51 Apr 02 2010 2 3248 197615 wphaskett udt pts/2 192.168.1.51 05:54:32 Apr 02 2010 2 Dev (0)- PORT.STATUS PID 2192 CALL.STACK Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total (24 + 1) / 25 3 0 0 0 3 Udtno Pid User UserType Port Last command processed 1 2192 AsiAdmin phantom 28101260 2 Dev (0)- Am I missing something? Thanks again. Bill Wally Terhune said the following on 4/2/2010 8:40 AM: Question wasn't clear to me. If looking at active processes, listuser shows which are phantoms (USRTYPE column) Also - UniBasic LISTUSER() function returns this as dynamic array for easy parsing :listuser Licensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total ( 32 + 32 ) / 64 1 0 0 0 1 UDTNO USRNBR UID USRNAME USRTYPE TTYIP-ADDRESSTIME DATE 1 5936 305730 WTerhune udt pts/1 Console 09:34:36 Apr 02 2010 2 4300 305730 WTerhune phantom pts/2 Console 09:34:58 Apr 02 2010 Wally Terhune U2 Support Architect Rocket Software 4700 S. Syracuse Street, Suite 400 **Denver, CO 80237 **USA Tel: +1.720.475.8055 Email: wterh...@rs.com Web: www.rocketsoftware.com/u2 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Martin Phillips Sent: Friday, April 02, 2010 9:35 AM To: U2 Users List Subject: Re: [U2] UD: Phantoms Hi Bill, In UniData, does anyone know of a sure way to determine if a BASIC program is running as a phantom? Take a look at the @USER.TYPE variable. This contains 1 for a phantom. Martin Phillips Ladybridge Systems Ltd 17b Coldstream Lane, Hardingstone, Northampton, NN4 6DB +44-(0)1604-709200 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] UD: Phantoms
I actually got this running. I used Wally's suggestion. I was already using a subroutine named IS.PHANTOM.RUNNING ( ServiceName, IsRunning). All I did was: 1) Run listusers() to get the list of users, 2) Parse out phantom users and run PORT.STATUS PID {n} CALL.STACK against them, 3) Parse out the 1st entry after the attribute containing BASIC CALLSTACK to get what's running, 4) Compare this program against the passed in Service Name. 5) If #4 matches then IsRunning = 1 otherwise it equals 0 It only pauses for about three seconds so this is a good thing. As a result of the above, I don't have to manage anything, just find out if what I'm interested in is running as a phantom. The important change I had to make was to modify our service program from... SLEEP SleepForSeconds ...to... FOR X = 1 TO SleepForSeconds SLEEP 1 NEXT X Thanks for the help. Bill Bill Haskett said the following on 4/2/2010 11:59 AM: Thanks David. This could work. Bill David Wolverton said the following on 4/2/2010 10:57 AM: I do a variation on this -- since my phantoms now need to be 'multi-account' (that is, 6 accounts, I need 6 phantoms - one per account) -- I do a READU of an 'item' from a 'Paramters' file -- the ItemID I attempt to read is AcctName-PHANRUN Don't care if it exists or not -- as long as the READU 'passes' -- if the LOCKED clause hits, I exit the 'startup'... I put this logic into a process I call during the LOGIN paragraph -- not flawless, in that people have to move in and out of the account, but for what I do, it works A-OK. This way, if another account needs to 'starts up' it can tell if the phantom for that account's data already has a phantom 'running' or not. Uses READU so that regardless of how the phantom dies, the lock goes with it. And more flexible than the LOCK 60 type of lock. DW -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Doug Sent: Friday, April 02, 2010 10:57 AM To: 'U2 Users List' Subject: Re: [U2] UD: Phantoms Bill: Use the LOCK command with number 0 through 63. Have your phantom process do a LOCK 60. Then you can test it in other programs using the else clause: LOCK 60 THEN UNLOCK 60 * Restart phantom END ELSE * Phantom is running do nothing END -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett Sent: Friday, April 02, 2010 9:25 AM To: U2 Mail List Subject: [U2] UD: Phantoms In UniData, does anyone know of a sure way to determine if a BASIC program is running as a phantom? We have a background service program in our application that has to be running as a phantom whenever UniData starts. The ability to start something when the dbms starts doesn't exist in UniData, so I have to schedule the task when Windows starts. However, if the program stops (or UD was stopped and restarted) I have no sure way to know if it's running. Does UD have any way to know this? Thanks, Bill Haskett ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users