Sync may got dead lock
Opened this issue · 1 comments
when using both gitsync and gitops in one docker container I always got stuck after certain times sync , I explore the code and find the lock is hold by clusterCache.processEvent
then clusterCache.GetManagedLiveObjs
in engine.Sync
would be locked forever
since there is a timer to notify to get the sync state the resUpdated channel is useless..and remove the OnResourceUpdated
in Sync function and everything goes well .
unfortunately I didn't find the root cause..
The clusterCache.EnsureSycned
holds the c.lock
, and sync()
in the EnsureSynced()
will accquire listSemaphore
. And the watchEvents() goroutine in sync()
will accquire semaphore first, then lock the c.lock
in RunSynced
. so dead locks happened.
I wish I explained the situation clearly.