|
From: SourceForge.net <no...@so...> - 2012-07-03 22:15:05
|
Bugs item #3539648, was opened at 2012-07-03 01:53 Message generated for change (Comment added) made by mhoenicka You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=379806&aid=3539648&group_id=23824 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed Priority: 5 Private: No Submitted By: Emmanuel Courrges (ecourreges) Assigned to: Nobody/Anonymous (nobody) Summary: dbi_conn_error not reentrant Initial Comment: Just thought I would finally file this one which could be fixed for the next release: The static errmsg in dbi_conn_error prevents the function from being used in a multithreaded context. It clearly crashes when 2 or more threads (each having their own dbi_conn) try to get the error message simultaneously. I guess the simplest solution is to allocate it and force the user to free it, but all existing code will have a memory leak... Another good solution is to add a char * full_err_msg in the dbi_conn_t, so that it becomes thread safe for different connections, and it avoids the memory leak or an api change. ---------------------------------------------------------------------- >Comment By: Markus Hoenicka (mhoenicka) Date: 2012-07-03 15:15 Message: I've implemented your second suggestion, see the current cvs revision. It passes all tests ok. However, I think this implementation is only "thread-safe" as long as each thread uses its own connection. Maybe this should go into the docs somewhere. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=379806&aid=3539648&group_id=23824 |