fix: modify lock location of exec delete
func (e *execProcess) delete(ctx context.Context) error { e.wg.Wait() ... } delete exec process will wait for io copy finish, if wait here, other process can not get lock of shim service. 1. apply lock around s.transition() calls in the Delete methods. 2. put lock after wait io copy in exec Delete. Signed-off-by: Ace-Tang <aceapril@126.com>
This commit is contained in:
@@ -60,11 +60,11 @@ func (s *execCreatedState) Start(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func (s *execCreatedState) Delete(ctx context.Context) error {
|
||||
s.p.mu.Lock()
|
||||
defer s.p.mu.Unlock()
|
||||
if err := s.p.delete(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
s.p.mu.Lock()
|
||||
defer s.p.mu.Unlock()
|
||||
return s.transition("deleted")
|
||||
}
|
||||
|
||||
@@ -168,11 +168,11 @@ func (s *execStoppedState) Start(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func (s *execStoppedState) Delete(ctx context.Context) error {
|
||||
s.p.mu.Lock()
|
||||
defer s.p.mu.Unlock()
|
||||
if err := s.p.delete(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
s.p.mu.Lock()
|
||||
defer s.p.mu.Unlock()
|
||||
return s.transition("deleted")
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user