Menu

#338 LOAD DATA LOCAL query causes segfault in multi-threaded program

MySQLdb-1.2
open
nobody
None
1
2015-01-22
2014-12-23
Wayne Song
No

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()?

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.