Skip to content
Tcl Source Code View Ticket
Login

View Ticket

exit command hangs tcl8.4.0

Closed617624ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 22 years ago
Descriptionplain2002-10-02 16:12:50
We have a service written in TCL that performs HTTP 
geturl requests for backend clients....

After 10000 transactions, we have it restart -- to reset 
memory in case a huge web page was pulled.

We are seeing our service hang on the 'exit' command in 
both TCL 8.4a3 and TCL8.4.0.

Of note...the service uses the TLS package and runs on 
the AIX platform.  On the hang, an SSL socket was 
open...

The service performs HTTP requests via callbacks.
It uses an timer callback for maintenance...
And it reads messages from port 11555 by doing a 
[gets] in a while loop.

Here's the code in the while loop:
                if { $total > 10000 } {
                        if { $pending == 0 || $total > 15000 } {
                                logit "SYSTEM||restarting due to 
MAX TRANSACTIONS $total p=$pending"
                                exit
                        }
                }

Here's the log file:
unix> tail log_39872.20020904
...
152545|SYSTEM||restarting due to MAX 
TRANSACTIONS 10001 p=0

Notice the pid is 39872 and the time is 152545.

At 16:02, the pid 39872 was still running:
unix>ps -ef |grep httpserv
    root 39872     1   0   Sep 03      - 698:31 
wictcl /wic/sys/httpserv/bin/httpserv.tcl 

Doing a low-level 'lsof' we see that nothing stuck in 
CLOSE_WAITs.

unix>sudo lsof -p 39872
lsof: WARNING: compiled for AIX version 4.3.2.0; this is 
4.3.3.0.
COMMAND   PID USER   FD   TYPE     DEVICE 
SIZE/OFF  NODE NAME
wictcl  39872 root  cwd   VDIR       10,4      512     2 / 
(/dev/hd4)
wictcl  39872 root    0u  VCHR        2,2      0t0  
4157 /dev/null
wictcl  39872 root    1w  VREG      10,10        0    
17 /wic/log (/dev/wicloglv)
wictcl  39872 root    2w  VREG      10,10        0    
17 /wic/log (/dev/wicloglv)
wictcl  39872 root    3u  IPv4 0x7052cadc      0t0   TCP 
localhost:38156->localhost:11555 (ESTABLISHED)
wictcl  39872 root    4u  unix 0x70373800      0t0       -
>0x7038a600 
wictcl  39872 root    5w  VREG      10,10  1576780 
14357 /wic/log (/dev/wicloglv)
wictcl  39872 root    6u  IPv4 0x70489adc      0t0   TCP 
iwww2:51407->198.178.10.180:443 (ESTABLISHED)


Originally I thought this was a tcl8.4a3 issue, but we got 
it to happen on tcl8.4.0 when I was on vacation last 
week.

To solve the exit problem, we replaced 'exit' with:

  catch {exec kill [pid]}
  after 5000
  catch {exec kill -9 [pid]}

We are moving this platform to Linux, so I will try it on 
TCL8.4.0 for linux in a few weeks.
dkf Ticket [617624ffff]: 1 change [History diff]2002-10-03 20:09:52
dgpplain2002-10-03 22:30:27
Logged In: YES 
user_id=80530

...appears to be an issue with [socket] close on exit?
pedietzplain2002-10-11 21:54:33
Logged In: YES 
user_id=584339

We are converting Suse based linux to RedHat next week, so 
my test on Linux is on hold till the end of October.
hobbs Ticket [617624ffff]: 2 changes [History diff]2004-11-12 03:29:20
pedietzplain2004-11-12 03:37:12
Logged In: YES 
user_id=584339

hasnt happened in forever.
I'll gladly close it.
pedietz Ticket [617624ffff]: 2 changes [History diff]2004-11-12 03:37:13
davygrvyplain2004-11-12 03:45:11
Logged In: YES 
user_id=7549

Does Tcl modify its close behavior on a socket during [exit]
in the same way the pipe channel driver does?  Is a [flush]
becoming blocked?

I don't think I can assist with this.
davygrvy Closed ticket [617624ffff]. [History diff]2004-11-12 03:48:56
davygrvy Ticket [617624ffff]: 2 changes [History diff]2004-11-12 03:48:57
Log in (anonymous is fine) to add a comment.