getPolicy method is not threadsafe (Bug #3584)
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
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
Additional information regarding issue:
http://eli.thegreenplace.net/2011/08/30/construction-of-function-static-variables-in-c-is-not-thread-safe/
- 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