Skip to content

Instantly share code, notes, and snippets.

@movermeyer
Created August 10, 2015 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save movermeyer/220f87b34eba730bb67b to your computer and use it in GitHub Desktop.
Save movermeyer/220f87b34eba730bb67b to your computer and use it in GitHub Desktop.
Fix to issue #60 causes infinite loop
import multiprocessing
import time
import firebirdsql
FIREBIRD_HOST = "localhost"
FIREBIRD_DB = "D:\\LOCALCONFIG.fdb"
FIREBIRD_USER = "SYSDBA"
FIREBIRD_PASS = "masterkey"
def test(number_to_select):
conn = firebirdsql.connect(host=FIREBIRD_HOST, database=FIREBIRD_DB, user=FIREBIRD_USER, password=FIREBIRD_PASS)
cur = conn.cursor()
cur.execute("select FIRST {0} * FROM TEST".format(number_to_select))
results = cur.fetchall()
conn.close()
if __name__ == '__main__':
for i in range(399,402):
print "Testing fetching {0} results".format(i)
p = multiprocessing.Process(target=test, args=(i,))
p.start()
# Wait for 10 seconds or until process finishes
p.join(10)
# If thread is still active
if p.is_alive():
print "Timed out. Killing it!"
# Terminate
p.terminate()
p.join()
else:
print "Success!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment