Fix a race condition in tensorflow::ProfilerServer.
server_ is accessed concurrently from two threads without any locking. Amongst other things this could lead to a deadlock if a server was started and then immediately destroyed, because the if (server_) ... condition in ~ProfilerServer could run before server_ had been assigned in the worker thread. Rather than add locking, a simpler solution is just to remove the thread altogether. There is no need to use a thread here: we simply need to call Wait() in the destructor, because gRPC has its own threading internally. PiperOrigin-RevId: 294996411 Change-Id: Idd507d1ea97642e540fdec520900a3c491d34e5a
Showing
想要评论请 注册 或 登录