Bug #31436 | Windows C++ client crashes when multiple threads use the same connection | ||
---|---|---|---|
Submitted: | 8 Oct 2007 0:36 | Modified: | 8 Oct 2007 2:09 |
Reporter: | Norbert Schmidt | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | MySQL Server: C API (client library) | Severity: | S2 (Serious) |
Version: | 5.0.45 | OS: | Windows |
Assigned to: | CPU Architecture: | Any | |
Tags: | threads |
[8 Oct 2007 0:36]
Norbert Schmidt
[8 Oct 2007 2:09]
MySQL Verification Team
Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.mysql.com/how-to-report.php If you can provide more information, feel free to add it to this bug and change the status back to 'Open'. Thank you for your interest in MySQL. Please double check your code according the Manual at: http://dev.mysql.com/doc/refman/5.1/en/threaded-clients.html * Two threads can't send a query to the MySQL server at the same time on the same connection. In particular, you have to ensure that between calls to mysql_query() and mysql_store_result() no other thread is using the same connection. * Many threads can access different result sets that are retrieved with mysql_store_result(). * If you use mysql_use_result, you must ensure that no other thread is using the same connection until the result set is closed. However, it really is best for threaded clients that share the same connection to use mysql_store_result(). * If you want to use multiple threads on the same connection, you must have a mutex lock around your pair of mysql_query() and mysql_store_result() calls. Once mysql_store_result() is ready, the lock can be released and other threads may query the same connection. * If you use POSIX threads, you can use pthread_mutex_lock() and pthread_mutex_unlock() to establish and release a mutex lock.