Found what caused the segfault.
A bug in my own code. Thing is I assigned a value to an out-of-bounds parameter. Doing so causes segfaults in the ResetSet_free code. Would it be possible to raise an SQLException in those cases instead?
demo code attached.
Paul J Stevens wrote:
Jan-Henrik,
I've started using threads in my application and now the mysql driver starts to segfault:
Starting program: /home/paul/git/dbmail/src/dbmail-imapd -D [Thread debugging using libthread_db enabled] [New process 27692] [New Thread -1217631440 (LWP 27692)] [New Thread -1218696304 (LWP 27694)] [Thread -1218696304 (LWP 27694) exited]
Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1217631440 (LWP 27692)] 0xb7d80175 in ResultSet_free (R=0x81526e4) at src/db/ResultSet.c:65 65 (*R)->op->free(&(*R)->I);
this only happens when I use the mysql driver. The postgres driver has exhibited some infrequent crashes but those have been very difficult to reproduce.
My guess is it has to do with the query involved:
INSERT IGNORE INTO dbmail_headername (headername) VALUES (?)
a construct not used for postgres.
Perhaps this type of query affects the kind of MYSQL_RES returned. I'm not sure. I'll try to investigate myself.