LOAD DATA LOCAL query causes segfault in multi-threaded program
MySQL database connector for Python programming
Brought to you by:
adustman
The following program gives a segfault:
import threading, _mysql def run_load(conn): conn.query("LOAD DATA LOCAL INFILE '/tmp/a.txt' INTO TABLE test.x FIELDS TERMINATED BY ','") if __name__ == '__main__': conn = _mysql.connect(host='127.0.0.1', user='root', db='', passwd='', local_infile = 1) t = threading.Thread(target=run_load, args=(conn,)) t.start() t.join()
It appears that the problem is that mysql_thread_init() is not called in the new thread. Would it be possible to provide a function in _mysql that exposes mysql_thread_init()?