urllib.urlopen blocking all threads for seconds when no connection or exception?
Aahz
aahz at pythoncraft.com
Thu Dec 12 17:34:25 EST 2002
In article <3df89a91$0$3028$9b622d9e at news.freenet.de>,
Robert <k.robert at gmx.de> wrote:
>
>Running the script below on windows (XP), when the computer has no
>connection to the site, urlopen blocks ALL other threads for seconds
>unpleasantly, as shown in the output below. When the connection is
>there, everything seems to run smooth and seamless, regardless how
>time-consuming the urlopen or read is.
>
>is there a solution to this problem?
Which version of Python is this? (Probably doesn't matter, but I'm
asking anyway.) On many OSes, some calls are not thread-safe
(gethostbyname() is a common one on Unix), and threads will block until
that call returns. You're probably hitting something like that; if so,
there's not much Python can do.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"To me vi is Zen. To use vi is to practice zen. Every command is a
koan. Profound to the user, unintelligible to the uninitiated. You
discover truth everytime you use it." --reddy at lion.austin.ibm.com
More information about the Python-list
mailing list