@@ -26,9 +26,7 @@ import (
2626 "github.com/containerd/containerd/namespaces"
2727 "github.com/containerd/containerd/platforms"
2828 "github.com/containerd/containerd/plugin"
29- "github.com/containerd/containerd/reaper"
3029 "github.com/containerd/containerd/runtime"
31- "github.com/containerd/containerd/sys"
3230 runc "github.com/containerd/go-runc"
3331 "github.com/containerd/typeurl"
3432 ptypes "github.com/gogo/protobuf/types"
@@ -159,9 +157,6 @@ func (r *Runtime) Create(ctx context.Context, id string, opts runtime.CreateOpts
159157 return nil , err
160158 }
161159
162- ec := reaper .Default .Subscribe ()
163- defer reaper .Default .Unsubscribe (ec )
164-
165160 bundle , err := newBundle (id ,
166161 filepath .Join (r .state , namespace ),
167162 filepath .Join (r .root , namespace ),
@@ -206,7 +201,7 @@ func (r *Runtime) Create(ctx context.Context, id string, opts runtime.CreateOpts
206201 "id" : id ,
207202 "namespace" : namespace ,
208203 }).Warn ("cleaning up after killed shim" )
209- err = r .cleanupAfterDeadShim (context .Background (), bundle , namespace , id , lc .pid , ec )
204+ err = r .cleanupAfterDeadShim (context .Background (), bundle , namespace , id , lc .pid )
210205 if err == nil {
211206 r .tasks .Delete (ctx , lc )
212207 } else {
@@ -313,7 +308,7 @@ func (r *Runtime) Delete(ctx context.Context, c runtime.Task) (*runtime.Exit, er
313308
314309 rsp , err := lc .shim .Delete (ctx , empty )
315310 if err != nil {
316- if cerr := r .cleanupAfterDeadShim (ctx , bundle , namespace , c .ID (), lc .pid , nil ); cerr != nil {
311+ if cerr := r .cleanupAfterDeadShim (ctx , bundle , namespace , c .ID (), lc .pid ); cerr != nil {
317312 log .G (ctx ).WithError (err ).Error ("unable to cleanup task" )
318313 }
319314 return nil , errdefs .FromGRPC (err )
@@ -394,7 +389,7 @@ func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) {
394389 "id" : id ,
395390 "namespace" : ns ,
396391 }).Error ("connecting to shim" )
397- err := r .cleanupAfterDeadShim (ctx , bundle , ns , id , pid , nil )
392+ err := r .cleanupAfterDeadShim (ctx , bundle , ns , id , pid )
398393 if err != nil {
399394 log .G (ctx ).WithError (err ).WithField ("bundle" , bundle .path ).
400395 Error ("cleaning up after dead shim" )
@@ -419,7 +414,7 @@ func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) {
419414 return o , nil
420415}
421416
422- func (r * Runtime ) cleanupAfterDeadShim (ctx context.Context , bundle * bundle , ns , id string , pid int , ec chan runc. Exit ) error {
417+ func (r * Runtime ) cleanupAfterDeadShim (ctx context.Context , bundle * bundle , ns , id string , pid int ) error {
423418 ctx = namespaces .WithNamespace (ctx , ns )
424419 if err := r .terminate (ctx , bundle , ns , id ); err != nil {
425420 if r .config .ShimDebug {
@@ -428,17 +423,6 @@ func (r *Runtime) cleanupAfterDeadShim(ctx context.Context, bundle *bundle, ns,
428423 log .G (ctx ).WithError (err ).Warn ("failed to terminate task" )
429424 }
430425
431- if ec != nil {
432- // if sub-reaper is set, reap our new child
433- if v , err := sys .GetSubreaper (); err == nil && v == 1 {
434- for e := range ec {
435- if e .Pid == pid {
436- break
437- }
438- }
439- }
440- }
441-
442426 // Notify Client
443427 exitedAt := time .Now ().UTC ()
444428 r .events .Publish (ctx , runtime .TaskExitEventTopic , & eventstypes.TaskExit {
0 commit comments