thread vs threading -- Unexpected Results
CK
fw58959 at hotmail.com
Fri Dec 5 22:22:18 EST 2003
fw58959 at hotmail.com (CK) wrote in message news:<c0367340.0312050704.3c9b0fe3 at posting.google.com>...
> "Krzysztof Stachlewski" <stach at fr.pl> wrote in message news:<bqn9no$qp6$1 at absinth.dialog.net.pl>...
> > "CK" <fw58959 at hotmail.com> wrote in message
...snip
> Good point. I added code to check for this (a la Programming
> Python by Mark Lutz) but the results are really strange. All I see are
> Connecting messages and never a disconnecting message and
> so now the whole program hangs waiting for these "hung"
> threads to wake up.
>
...snip
>
> and here is some sample output....
>
> Fri Dec 5 06:54:12 2003 Connecting to 10.34.32.0 on port 135 ThreadId=0
> Fri Dec 5 06:54:12 2003 Connecting to 10.34.32.5 on port 135 ThreadId=5
> Fri Dec 5 06:54:12 2003 Connecting to 10.34.32.6 on port 135 ThreadId=6
> Fri Dec 5 06:54:12 2003 Connecting to 10.34.32.7 on port 135 ThreadId=7
> Fri Dec 5 06:54:12 2003 Connecting to 10.34.32.8 on port 135 ThreadId=8
> Fri Dec 5 06:54:12 2003 Connecting to 10.34.32.9 on port 135 ThreadId=9
> Fri Dec 5 06:54:12 2003 Connecting to 10.34.32.10 on port 135 ThreadId=10
> Fri Dec 5 06:54:12 2003 Connecting to 10.34.32.11 on port 135 ThreadId=11
> Fri Dec 5 06:54:12 2003 Connecting to 10.34.32.12 on port 135 ThreadId=12
> Fri Dec 5 06:54:12 2003 Connecting to 10.34.32.13 on port 135 ThreadId=13
> Fri Dec 5 06:54:12 2003 Connecting to 10.34.32.14 on port 135 ThreadId=14
> Fri Dec 5 06:54:12 2003 Connecting to 10.34.32.15 on port 135 ThreadId=15
> Fri Dec 5 06:54:12 2003 Connecting to 10.34.32.16 on port 135 ThreadId=16
> ...
>
> Never see a Disconnecting message, never see "Main thread exitting"
>
Well it turns out that if I wait long enough (namely 4 minutes) all
the Disconnecting messages come out at once. I seem to recall that
4 minutes has something to do with the TCP/IP Maximum Segment Life
or something like that. I don't know why sockets under 'thread'
work differently from sockets under 'threading'. The code used to
generate the socket connections is the same in both instances.
Quite odd.
./CK
More information about the Python-list
mailing list