[reSIProcate] Threading issues in DUM
Hi,
I may have found some threading issues in the Dialog Usage
Manager. I've written a little application that stress tests my VOIP
server. It dials a SIP user, then when it rings it hangs up. Once it's
hung up, it calls again, and so forth, endlessly.
Inside a worker thread, I call _uacDum->process() etc. to handle the incoming data.
From the main thread, I create and send requests (invite, etc.) using _uacDum->send(_uacDum->makeInviteSession(...)).
With this stress-test application, I get random crashes.
Sometimes after a minute, sometimes after 10 minutes. The crashes seem
to happen most often in DialogUsageManager::makeUacDialogSet. More specifically, it crashes at this code:
mDialogSetMap[ds->getId()] = ds;
My guess is that
this crash happens because inside the worker thread, DUM is removing
DialogSets from that hashmap, while the main thread is simultaneously
adding them. Looking at the DUM code, I see no sort synchronization
whatsoever, which could confirm my suspicion.
I know this email is short on details, but I was wondering if
I could be on the right track here. Maybe I should be calling
_uacDum->makeInviteSession() etc. from the same thread that's
calling _uacDum->process() ?
I really hope someone could give me a clue here. Thanks in advance.
Kind regards,
Richard.