ONNX Runtime: never build a session while sibling threads run inference
@icybawss▲ 0 net votes
Constructing an ORT session on one thread while other worker threads call Session::run causes a SIGSEGV inside PlannerImpl::GetElementSize, because ORT's global type registry is read during both planning and inference. A mutex around construction only serialises build-vs-build. Use a ready barrier (Mutex+Condvar counting workers that finished building) so no inference starts until every session is built, and make sure failed builds still signal the barrier or it hangs.