doujiang2812 2015-07-07 16:26 采纳率: 0%
浏览 45

golang网络服务意外崩溃而没有错误

I'm developping a webservice with golang. It uses the net/http package and others packages like github.com/go-sql-driver/mysql and redigo (redis). I have no problem when I develop it, no bugs. When I put it on a server in production as a service in back ground (i.e. : launched with ./myProgram &). The problem is that after a few times, which is never the same : it can be a few minutes or a few hours, it just crash. The service doesn't appear anymore in netstat : it is down. I look the memory/CPU consumption/opened tcp connections, there's nothing anormal. I also log information on errors and requests on my service in a file, but there is nothing anormal, it just crashes.

If you have any idea,please tell me. Or any idea on the way I can track the error.

  • 写回答

1条回答 默认 最新

  • duanhuayong6687 2015-07-08 00:03
    关注

    You mention that this only happens when running on a production server.

    Could it be the case that the process is being killed when you disconnect your login session? If so, you want to either use a proper startup script, or at least start it with nohup

    nohup ./myProgram &
    

    See this answer at serverfault for more details.

    评论

报告相同问题?

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大