Actions
Bug #5373
closedPython multithreading code crashes
Start date:
2022-03-07
Due date:
% Done:
100%
Estimated time:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Found in version:
11.2
Fixed in version:
11.3
SaxonC Languages:
SaxonC Platforms:
SaxonC Architecture:
Description
Reported by user in the following forum post: https://saxonica.plan.io/boards/4/topics/8523?page=2
The following SaxonC python example crashes:
import threading
import time
from saxonc import *
exitFlag = 0
class myThread (threading.Thread):
def __init__(self, threadID, name, counter, xquery_processor):
threading.Thread.__init__(self)
self.threadID = threadID
self.name = name
self.counter = counter
self.xquery_processor = xquery_processor
def run(self):
print ("Starting " + self.name)
example(self.name, self.counter, 5, self.xquery_processor)
print ("Exiting " + self.name)
def example(threadName, delay, counter, xquery_processor):
while counter:
if exitFlag:
threadName.exit()
time.sleep(delay)
print("%s : %s" % (threadName, xquery_processor.run_query_to_string(query_text = '"Hello from SaxonC: " || current-dateTime()')))
counter -= 1
saxon_proc = PySaxonProcessor(license = False)
# Create new threads
thread1 = myThread(1, "Thread-1", 1, saxon_proc.new_xquery_processor())
thread2 = myThread(2, "Thread-2", 2, saxon_proc.new_xquery_processor())
# Start new Threads
thread1.start()
thread2.start()
thread1.join()
thread2.join()
print ("Exiting Main Thread")
saxon_proc.release()
Crashes in linux as follows:
Starting Thread-1
Starting Thread-2
JET RUNTIME HAS DETECTED UNRECOVERABLE ERROR: system exception at 0x00007f71dca62d49
Please, contact the vendor of the application.
Core dump will be piped to "/usr/share/apport/apport %p %s %c %d %P %E"
Extra information about error is saved in the "jet_err_167047.txt" file.
Aborted (core dumped)
Related issues
Please register to edit this issue
Actions