Project

General

Profile

Dbo::ptr reading concurrency problem

Added by Saif Rehman about 8 years ago

Hi,

I'm using Wt::Dbo::ptr for sharing data between multiple sessions. To check for any random errors, I call refresh() on all WApplications open using a function, I'll call this procedure refreshAll(). The refresh() functions uses WLocalizedStrings to get Wt::Dbo::ptr from a map object which is protected with a read/write lock as in Wt's configuration class.

In certain refreshAll() attempts, when 2 threads call resolveKey() concurrently with the same arguments, the ptr is initialized with the same object inside and this causes random unknown errors(maybe due to concurrent call to incRef() and decRef() as in my test case). Some attempts to refreshAll() work fine, and some cause a random error. Mostly includes trying to access uninitialized data.

I can't create the same kind of error and I don't know how I can break the execution before that error occurs. Any ideas what I should do?

I thought of a solution, to change the read/write lock to a simple lock which will prevent concurrent construction/destruction of the same ptr in refreshAll(), however, I'd like some alternative too.


Replies (2)

RE: Dbo::ptr reading concurrency problem - Added by Saif Rehman about 8 years ago

It seems that a Dbo::ptr was deleted before it was dereferenced, so maybe it is because the concurrent calls to decRef()? Should I create a test file?

    (1-2/2)