libcontainerd: fix leaking container/exec state#35484
Conversation
3cfd714 to
1282336
Compare
Signed-off-by: Tonis Tiigi <[email protected]>
1282336 to
6c4ce7c
Compare
| c.Lock() | ||
| delete(ctr.execs, ei.ProcessID) | ||
| c.Unlock() | ||
| ctr := c.getContainer(ei.ContainerID) |
There was a problem hiding this comment.
On error (e.g. failure to create the task) this would cause a deadlock if I'm not mistaken
There was a problem hiding this comment.
Can you explain more? You mean the RLock inside getContainer() ?
There was a problem hiding this comment.
Yes, I think I had this initially (a call to getContainer) and it caused a deadlock in some error conditions and for execs. Can't remember the exact details
There was a problem hiding this comment.
Well, it is taking the same lock as line 643 so I'm not sure how this can cause a deadlock and the previous one doesn't.
There was a problem hiding this comment.
I may just be confused, I'll have to have a closer look, I had to change this part quite a few time to get rid of all the deadlocks. I'll try to have a proper look sometime tomorrow.
There was a problem hiding this comment.
Just ignore me, this is safe 😇 I got confused with another part of the code.
@andrewhsu @dmcgowan @crosbymichael
Signed-off-by: Tonis Tiigi [email protected]