getPolicy method is not threadsafe (Bug #3584)


Added by Alexander Karsakov about 11 years ago. Updated almost 11 years ago.


Status:Done Start date:2014-02-28
Priority:Normal Due date:
Assignee:Marius Muja % Done:

0%

Category:flann
Target version:3.0
Affected version:branch 'master' (3.0-dev) Operating System:Windows
Difficulty: HW Platform:x64
Pull request:https://github.com/Itseez/opencv/pull/2474

Description

Failed test stitch_a123.a123/0 (compiled with VS2012 x64).
I found out that error is occured in base_any_policy* get_policy() method. In this method declared static variable policy.

template<typename T>
base_any_policy* get_policy()
{
    static typename choose_policy<T>::type policy; 
    return &policy;
}

I suppose that a few threads can enter to this function and incorrect initialize this variable.
When I run tests with one thread all tests passed. I tryed to add cv::Mutex before initialization. All tests passed, but works a little slower.


Associated revisions

Revision 1c9668b3
Added by Vadim Pisarevsky about 10 years ago

Merge pull request #3584 from nisargthakkar:UMatDimsZeroAfterRelease

History

Updated by Alexander Karsakov about 11 years ago

  • Description changed from Failed test stitch_a123.a123/0 (compiled with VS2012 x64). I found out that e... to Failed test stitch_a123.a123/0 (compiled with VS2012 x64). I found out that e... More

Updated by Roman Donchenko about 11 years ago

FLANN as a whole is not thread-safe, because it uses rand. IMHO, we should cease all multithreaded usage of it.

Updated by Alexander Karsakov almost 11 years ago

  • Pull request set to https://github.com/Itseez/opencv/pull/2474

Updated by Alexander Karsakov almost 11 years ago

  • Status changed from Open to Done

Also available in: Atom PDF