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

Procfile configure problem #27

Open
orainxiong opened this issue Jul 18, 2016 · 1 comment
Open

Procfile configure problem #27

orainxiong opened this issue Jul 18, 2016 · 1 comment

Comments

@orainxiong
Copy link

web5: go run web.go -a :$PORT

It will cause client hang while stop web5,because of "http://stackoverflow.com/questions/24982845/process-kill-on-child-processes"

We need compile web.go to solve this problem,like below
web5: go run ./web -a :$PORT

I recommend add timeout feature for function stopProc

func stopProc(proc string, quit bool) error {
    p, ok := procs[proc]
    if !ok {
        return errors.New("Unknown proc: " + proc)
    }
    p.mu.Lock()
    defer p.mu.Unlock()

    if p.cmd == nil {
        return nil
    }

    p.quit = quit
    err := terminateProc(proc)
    if err != nil {
        return err
    }

    var done = make(chan bool, 1)

    go func(done chan bool) {
        p.cond.Wait()
        done <- true
    }(done)

    select {
    case <-time.After(1 * time.Second):
        p.cond.Signal()
        <- done
        err = errors.New("stop timeout")
    case <-done:
        err = nil
    }
    return err
}
@mattn
Copy link
Owner

mattn commented Jul 18, 2016

goreman have implementation that send signal to process group. and have timeout already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants