Close epoller on task stop

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2017-09-20 11:18:04 -04:00
parent 781ce658c8
commit 7030a4add0
3 changed files with 10 additions and 0 deletions

View File

@ -62,6 +62,7 @@ func NewService(config Config, publisher events.Publisher) (*Service, error) {
type platform interface { type platform interface {
copyConsole(ctx context.Context, console console.Console, stdin, stdout, stderr string, wg, cwg *sync.WaitGroup) (console.Console, error) copyConsole(ctx context.Context, console console.Console, stdin, stdout, stderr string, wg, cwg *sync.WaitGroup) (console.Console, error)
shutdownConsole(ctx context.Context, console console.Console) error shutdownConsole(ctx context.Context, console console.Console) error
close() error
} }
type Service struct { type Service struct {
@ -146,6 +147,7 @@ func (s *Service) Delete(ctx context.Context, r *google_protobuf.Empty) (*shimap
return nil, err return nil, err
} }
s.deleteProcess(p.ID()) s.deleteProcess(p.ID())
s.platform.close()
s.events <- &eventsapi.TaskDelete{ s.events <- &eventsapi.TaskDelete{
ContainerID: s.id, ContainerID: s.id,
ExitStatus: uint32(p.ExitStatus()), ExitStatus: uint32(p.ExitStatus()),

View File

@ -69,6 +69,10 @@ func (p *linuxPlatform) shutdownConsole(ctx context.Context, cons console.Consol
return epollConsole.Shutdown(p.epoller.CloseConsole) return epollConsole.Shutdown(p.epoller.CloseConsole)
} }
func (p *linuxPlatform) close() error {
return p.epoller.Close()
}
// initialize a single epoll fd to manage our consoles. `initPlatform` should // initialize a single epoll fd to manage our consoles. `initPlatform` should
// only be called once. // only be called once.
func (s *Service) initPlatform() error { func (s *Service) initPlatform() error {

View File

@ -52,6 +52,10 @@ func (p *unixPlatform) shutdownConsole(ctx context.Context, cons console.Console
return nil return nil
} }
func (p *unixPlatform) close() error {
return nil
}
func (s *Service) initPlatform() error { func (s *Service) initPlatform() error {
s.platform = &unixPlatform{} s.platform = &unixPlatform{}
return nil return nil