Project

General

Profile

Actions

Support #4352

closed

Problem with reentrant statement + MYSQL

Added by Thibault Lapassade over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
High
Assignee:
-
Target version:
Start date:
07/27/2015
Due date:
% Done:

0%

Estimated time:

Description

Hi,

after I made many request to my database from one of my WRessource, I have the "A collection for '...' is already in use. Reentrant statement use is not yet implemented." Is there a solution to this problem ? I precise that my calls to the WRessource can be very numerous and that I have already try to add a boost mutex at the beginning of the handleRequest function of my WRessource.

Best regards,

Thibault


Files

example ressource.cpp (1.32 KB) example ressource.cpp Thibault Lapassade, 07/28/2015 01:55 PM
Actions #1

Updated by Wim Dumon over 8 years ago

Can you show us some code? WResources are indeed special since handleRequest is called asynchronously wrt the session, and many calls to handleRequest can happen simultaneously. It's easy to mess up.

BR,

Wim.

Actions #2

Updated by Thibault Lapassade over 8 years ago

Hi,

Here an example of the code that I used.

BR,

Thibault

Actions #3

Updated by Koen Deforche over 8 years ago

  • Tracker changed from Bug to Support
  • Status changed from New to Resolved

Hey,

You must either protect your resource's handleRequest() with a mutex (the session lock), or use a thread specific pointer with a session per thread.

The latter is for example what we do in the techempower benchmark:

https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/frameworks/C%2B%2B/wt/benchmark.cpp

Regards,

koen

Actions #4

Updated by Koen Deforche over 8 years ago

  • Status changed from Resolved to Closed
Actions #5

Updated by Koen Deforche over 8 years ago

  • Target version set to 3.3.5
Actions

Also available in: Atom PDF