Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interrupt handler attempts to get IPFSNode from client process while daemon is running #615

Closed
btc opened this issue Jan 22, 2015 · 2 comments
Labels
kind/bug A bug in existing code (including security flaws) topic/cleanup Topic cleanup topic/daemon + init
Milestone

Comments

@btc
Copy link
Contributor

btc commented Jan 22, 2015

485 // listen for and handle SIGTERM
486 func (i *cmdInvocation) setupInterruptHandler() {
487
488     ctx := i.req.Context()
489     sig := allInterruptSignals()
490
491     go func() {
492         // first time, try to shut down.
493
494         // loop because we may be
495         for count := 0; ; count++ {
496             <-sig
497
498             n, err := ctx.GetNode() // shouldn't be accessed from client process
499             if err != nil {
500                 log.Error(err)
501                 log.Critical("Received interrupt signal, terminating...")
502                 os.Exit(-1)
503             }
504
505             switch count {
506             case 0:
507                 log.Critical("Received interrupt signal, shutting down...")
508                 go func() {
509                     n.Close()
510                     log.Info("Gracefully shut down.")
511                 }()
512
513             default:
514                 log.Critical("Received another interrupt before graceful shutdown, terminating...")
515                 os.Exit(-1)
516             }
517         }
518     }()
519 }
@btc btc added the kind/bug A bug in existing code (including security flaws) label Jan 22, 2015
@jbenet jbenet modified the milestone: Daemon Apr 1, 2015
@torarnv
Copy link
Contributor

torarnv commented Apr 23, 2015

I think this was fixed by #1037, cf6a268 specifically

@jbenet jbenet closed this as completed Apr 27, 2015
@jbenet
Copy link
Member

jbenet commented Apr 27, 2015

thanks @torarnv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) topic/cleanup Topic cleanup topic/daemon + init
Projects
None yet
Development

No branches or pull requests

3 participants