&*^%^$#%$*& USER!
Brian K. White
brian at aljex.com
Thu Apr 1 16:23:33 PST 2004
I thought we recently established that closing a user() alias was a
effective answer for stopping repeated user commands from piling up
background processes?
I have what looks like a pretty straightforward situation, easy to spot a
mis-step if there are any:
In input processing there is a gosub that may be called many many times in
one rclerk session, or it may never be called even once.
Here is the gosub:
---
vimg if:
then: user cgc = cgc
if:
then: cgc = getenv("COMPANY"){","{scanimg_dtyp{","{scanimg_dnum
if:
then: system "winstart http://"{getenv("SRVIP"){"/cgi-bin/showthm?"{cgc
if:
then: close cgc ; return
---
And here is "cgc":
---
#!/bin/ksh
KEY=`command that generates the same garbled string all day, but different
every day`
case `basename $0` in
cgc)
while read PLAINTEXT ; do
echo "${PLAINTEXT}\c" |crypt ${KEY} |base64
done ;;
uncgc)
while read ENCRYPTED ; do
echo "${ENCRYPTED}\c" |base64 -d |crypt ${KEY}
done ;;
esac
---
The reason I say I think the process is easy to trace is because the script
that loops is simple, and what it does when run is very simple. it's
interaction is just 1 in for 1 out. easy to avoid getting out of sync and
little risk of having the fp process hung on reading when it should be
writing etc...
And the simple fact that the thing functions proves that all the possible
questions about the contents of the variables shown above and the syntax for
user that some people keep saying isn't valid etc...
It works, therefor all such things are happening correctly.
The problem is:
Every time the user hits the gosub a defunct process is left behind and
eventually completely fills the process stack programs start failing
system-wide due to unable to fork new processes.
As soon as the user exits rclerk ALL the defunct processes dissappear
instantly.
two possible work-arounds that I can see are:
1) track whether user has ever been opened in a global variable and then
check the variable at the beginning of the gosub and never close the user
command.
2) don't track whether user has already been opened, just always open it
once in @once and never close it.
I don't like either of those. #1 is clunky and unreliable, #2 is wasteful
because while one user may run the gosub several times in a minute for hours
on end, most users will never hot it, or just a few times in a day.
Neither of those is so bad I won't DO it, it's just that I don't like it and
I can't beleive it's really necessary.
I should be able to spawn a child process and end it.
I don't understand precisely what filepro does when you close a user alias,
but if I manually run cgc and close my session, it does not leave any
defunct process behind.
Brian K. White -- brian at aljex.com -- http://www.aljex.com/bkw/
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro BBx Linux SCO Prosper/FACTS AutoCAD #callahans Satriani
More information about the Filepro-list
mailing list