Test application can't exit after calling MxPredCreate


#1

Hello everyone! I faced a really unusual problem with MxNet on Windows7 and don’t know what to do!
Brief:
I compiled MxNet 1.2.0 with visual studio 2017 without GPU, without OpenMP, with MKL and without OpenBLAS, with USE_CPP_PACKAGE. OpenCV version 3.3.0. Then I made a very simple C++ app which just loads model and calls MxPredCreate(…) and then MXPredFree(…). All functions work successfully, but after that my application can’t terminate. I pressed pause button in VS and found this call stack:
libmxnet.dll!dmlc::ConcurrentBlockingQueue<mxnet::engine::OprBlock *,0>::SignalForKill() Line 244 C++
libmxnet.dll!mxnet::engine::ThreadedEnginePerDevice::SignalQueueForKill::__l2::(unsigned int i, mxnet::engine::ThreadedEnginePerDevice::ThreadWorkerBlock<0> * block) Line 314 C++
libmxnet.dll!mxnet::common::LazyAllocArray<mxnet::engine::ThreadedEnginePerDevice::ThreadWorkerBlock<0> >::ForEach<void (unsigned int, mxnet::engine::ThreadedEnginePerDevice::ThreadWorkerBlock<0> *) >(mxnet::engine::ThreadedEnginePerDevice::SignalQueueForKill::__l2::void (unsigned int, mxnet::engine::ThreadedEnginePerDevice::ThreadWorkerBlock<0> *) fvisit) Line 169 C++
libmxnet.dll!mxnet::engine::ThreadedEnginePerDevice::SignalQueueForKill<mxnet::engine::ThreadedEnginePerDevice::ThreadWorkerBlock<0> >(mxnet::common::LazyAllocArray<mxnet::engine::ThreadedEnginePerDevice::ThreadWorkerBlock<0> > * array) Line 315 C++
libmxnet.dll!mxnet::engine::ThreadedEnginePerDevice::SignalQueuesForKill() Line 321 C++
libmxnet.dll!mxnet::engine::ThreadedEnginePerDevice::StopNoWait() Line 79 C++
libmxnet.dll!mxnet::engine::ThreadedEnginePerDevice::~ThreadedEnginePerDevice() Line 75 C++
[External Code]
[Frames below may be incorrect and/or missing, no symbols loaded for ucrtbased.dll]
MxNetTest.exe!main() Line 12 C++
[External Code]

So there is something wrong with concurrency. Did anybody has such kind of problem?

!!Update!!
I have just found that the problem will disappear if I change MxNet Engine Type from ThreadedEnginePerDevice to NaiveEngine using cmd command SET:
SET MXNET_ENGINE_TYPE=NaiveEngine