In an attempt to potentially isolate the problem further, the following multi-threaded application was written which strictly makes Storm calls. The database queries are those which were observed in the PostgreSQL log when running the above request to reproduce the problem. Unfortunately, this doesn't seem to reproduce the blocking problem which seems to indicate that the problem might be in the Zope3 threading pool.
import sys, os
import transaction
from threading import Thread
from zope.component import getUtility
from canonical.certify.application import load_config
from canonical.certify.interfaces import IStoreSelector, MAIN_STORE
THREAD_COUNT = 40
ITERATION_COUNT = 40
def do_function(thread_num):
main_store = getUtility(IStoreSelector).get(MAIN_STORE)
for i in range(ITERATION_COUNT):
try: transaction.begin()
result = main_store.execute("""SELECT hardware.access_context_id, hardware.account_id, hardware.aliases, hardware.canonical_id, hardware.category, hardware.c
result = main_store.execute("""UPDATE hardware SET foo_time='2009-01-29 12:30:42.443242' WHERE hardware.id = 123""")
result = main_store.execute("""SELECT certificate.completed, certificate.hardware_id, certificate.id, certificate.name, certificate.release, certificate.secu
result = main_store.execute("""SELECT account.access_context_id, account.billing_city, account.billing_country, account.billing_postal_code, account.billing_
result = main_store.execute("""SELECT COUNT(*) FROM certificate WHERE certificate.hardware_id = 123""")
result = main_store.execute("""UPDATE hardware SET foo_time='2009-01-29 12:30:42.747807' WHERE hardware.id = 123""")
result = main_store.execute("""SELECT DISTINCT hardware.access_context_id, hardware.account_id, hardware.aliases, hardware.canonical_id, hardware.category, h
result = main_store.execute("""SELECT DISTINCT hardware.access_context_id, hardware.account_id, hardware.aliases, hardware.canonical_id, hardware.category, h
result = main_store.execute("""SELECT DISTINCT hardware.access_context_id, hardware.account_id, hardware.aliases, hardware.canonical_id, hardware.category, h transaction.commit()
except Exception, e:
print e
In an attempt to potentially isolate the problem further, the following multi-threaded application was written which strictly makes Storm calls. The database queries are those which were observed in the PostgreSQL log when running the above request to reproduce the problem. Unfortunately, this doesn't seem to reproduce the blocking problem which seems to indicate that the problem might be in the Zope3 threading pool.
import sys, os certify. application import load_config certify. interfaces import IStoreSelector, MAIN_STORE
import transaction
from threading import Thread
from zope.component import getUtility
from canonical.
from canonical.
THREAD_COUNT = 40
ITERATION_COUNT = 40
def do_function( thread_ num): IStoreSelector) .get(MAIN_ STORE) _COUNT) :
transactio n.begin( ) execute( """SELECT hardware. access_ context_ id, hardware. account_ id, hardware.aliases, hardware. canonical_ id, hardware.category, hardware.c execute( """UPDATE hardware SET foo_time= '2009-01- 29 12:30:42.443242' WHERE hardware.id = 123""") execute( """SELECT certificate. completed, certificate. hardware_ id, certificate.id, certificate.name, certificate. release, certificate.secu execute( """SELECT account. access_ context_ id, account. billing_ city, account. billing_ country, account. billing_ postal_ code, account.billing_ execute( """SELECT COUNT(*) FROM certificate WHERE certificate. hardware_ id = 123""") execute( """UPDATE hardware SET foo_time= '2009-01- 29 12:30:42.747807' WHERE hardware.id = 123""") execute( """SELECT DISTINCT hardware. access_ context_ id, hardware. account_ id, hardware.aliases, hardware. canonical_ id, hardware.category, h execute( """SELECT DISTINCT hardware. access_ context_ id, hardware. account_ id, hardware.aliases, hardware. canonical_ id, hardware.category, h execute( """SELECT DISTINCT hardware. access_ context_ id, hardware. account_ id, hardware.aliases, hardware. canonical_ id, hardware.category, h
transactio n.commit( )
main_store = getUtility(
for i in range(ITERATION
try:
result = main_store.
result = main_store.
result = main_store.
result = main_store.
result = main_store.
result = main_store.
result = main_store.
result = main_store.
result = main_store.
except Exception, e:
print e
def main(argv): config( os.path. abspath( "."), "application.conf")
load_
threads = [] COUNT): target= do_function, args=[i])
threads. append( thread)
thread. start()
for i in range(THREAD_
thread = Thread(
while True:
alive. join(1)
sys.exit( 1)
alives = [t for t in threads if t.isAlive()]
for alive in alives:
try:
except KeyboardInterrupt:
else:
break
return 0
if __name__ == "__main__": exit(main( sys.argv) )
sys.