urllib.urlopen + https = all threads locked?

Jeff Johnson usenet at jeffjohnson.net
Thu Oct 25 11:32:07 EDT 2001


Thanks Gerhard!

Here's a test script that shows the problem and output from the
script.  I open the same public link in both https and http.  The
ticker thread pauses during the https call.

I'll test the patch out in a bit and let you know what I find.

-Jeff 

====  OUTPUT  ====  time between ticks = 0.00
  time between ticks = 0.41
  time between ticks = 0.51
Opening HTTPS://www.digitalegroup.com/ea/ThreadTest3.
Finished.
  time between ticks = 3.46
  time between ticks = 0.50
Opening HTTP://www.digitalegroup.com/ea/ThreadTest3.
  time between ticks = 0.51
  time between ticks = 0.51
  time between ticks = 0.51
  time between ticks = 0.51
  time between ticks = 0.51
  time between ticks = 0.51
  time between ticks = 0.51
Finished.
  time between ticks = 0.51
  time between ticks = 0.51

====  SCRIPT ====
from threading import Thread
import urllib, time

def read(url):
		print "Opening %s." % url
		f = urllib.urlopen(url)
		print "Finished."
		
def ticker():
	t1 = time.time()
	while 1:
		t2 = time.time()
		print "  time between ticks = %0.2f" % (t2 - t1)
		t1 = time.time()
		time.sleep(.5)

t2 = Thread(target=ticker)
t2.setDaemon(1)
t2.start()

time.sleep(1)
read("HTTPS://www.digitalegroup.com/ea/ThreadTest3")
time.sleep(1)
read("HTTP://www.digitalegroup.com/ea/ThreadTest3")
time.sleep(1)



More information about the Python-list mailing list