V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
funky

signal.Notify 监听不到 托管到 supervisor 服务的启动/停止信号

  •  
  •   funky · May 30, 2023 · 1134 views
    This topic created in 1071 days ago, the information mentioned may be changed or developed.

    如题所述,监听不到,但是启动的时候会有

    signal:urgent I/O condition
    
    julyclyde
        1
    julyclyde  
       May 31, 2023
    先发代码和实验过程
    funky
        2
    funky  
    OP
       May 31, 2023
    以下是伪代码
    ```
    shutdown:= make(chan os.Signal,1),
    signal.Notify(shutdown)
    go func() {
    for {
    ss := <-shutdown
    log.Printf("signal:%s", ss.String())
    return
    }
    }()
    ```
    我在其他的地方阻塞了主线程,当我用 supervisor 托管我的服务
    stop xxx(我的程序在 supervisor 的名称)
    日志没有任何打印
    start xxx(我的程序在 supervisor 的名称)
    日志过会才有打印
    ``` signal:urgent I/O condition ```
    julyclyde
        3
    julyclyde  
       Jun 1, 2023
    那如果不在 supervisord 下面运行呢,可以正常收到么?
    funky
        4
    funky  
    OP
       Jun 1, 2023
    不进行托管的话可以正常捕获
    funky
        5
    funky  
    OP
       Jun 1, 2023
    @funky 挂载到 system service 就可以正常捕获到,看来 supervisor 和系统不一致
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   928 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 18:25 · PVG 02:25 · LAX 11:25 · JFK 14:25
    ♥ Do have faith in what you're doing.