Skip to content

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

Closed

Description

@btc
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 }

Activity

  1. added
    kind/bugA bug in existing code (including security flaws)
    on Jan 22, 2015
  2. modified the milestone: Daemon on Apr 1, 2015
  3. torarnv commented on Apr 23, 2015

    @torarnv
    Contributor

    I think this was fixed by #1037, cf6a268 specifically

  4. jbenet commented on Apr 27, 2015

    @jbenet
    Member

    thanks @torarnv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions