sigterm

Capture Heroku SIGTERM in Celery workers to shutdown worker gracefully

天大地大妈咪最大 提交于 2019-12-03 04:52:50
I've done a ton of research on this, and I'm surprised I haven't found a good answer to this yet anywhere. I'm running a large application on Heroku, and I have certain celery tasks that run for a very long time processing, and at the end of the task save a result. Every time I redeploy on Heroku, it sends SIGTERM (and eventually, SIGKILL) and kills my running worker. I'm trying to find a way for the worker instance to shut itself down gracefully and re-queue itself for processing later so that eventually we can save the required result instead of losing the queued task. I cannot find a way

Detect user logout / shutdown in Python / GTK under Linux - SIGTERM/HUP not received

眉间皱痕 提交于 2019-12-01 15:53:06
问题 OK this is presumably a hard one, I've got an pyGTK application that has random crashes due to X Window errors that I can't catch/control. So I created a wrapper that restarts the app as soon as it detects a crash, now comes the problem, when the user logs out or shuts down the system, the app exits with status 1. But on some X errors it does so too. So I tried literally anything to catch the shutdown/logout, with no success, here's what I've tried: import pygtk import gtk import sys class

Can I trap signals in R?

≡放荡痞女 提交于 2019-11-30 17:56:54
问题 In bash I can trap SIGINT , SIGKILL , SIGTERM , and so on. That allows me to do different things depending how the program was unexpectedly stopped. Is there a way to do this in R? 回答1: Expanding a bit on my comment which OP asked me to post as an answer The help file for conditions has the description These functions provide a mechanism for handling unusual conditions, including errors and warnings. There are many handling functions explained in the file, with examples. So I suggest starting

How to get rid of SIGTERM error

六眼飞鱼酱① 提交于 2019-11-29 18:51:49
问题 i have been working on this iphone app in the new xcode4. Practically every time I exit my application in the simulator I get an error on a code line in the main.m Here is my line of code, and then the error on the next line int retVal = UIApplicationMain(argc, argv, nil, nil); Thread 1:Program received signal: "SIGTERM". What is happening here? How do I fix this? 回答1: SIGTERM is a Unix signal, used to tell your program to quit (TERMinate). When you run your program in Xcode, it runs it

How to detect pending system shutdown on Linux?

心不动则不痛 提交于 2019-11-27 21:15:48
I am working on an application where I need to detect a system shutdown. However, I have not found any reliable way get a notification on this event. I know that on shutdown, my app will receive a SIGTERM signal followed by a SIGKILL . I want to know if there is any way to query if a SIGTERM is part of a shutdown sequence ? Does any one know if there is a way to query that programmatically (C API)? As far as I know, the system does not provide any other method to query for an impending shutdown. If it does, that would solve my problem as well. I have been trying out runlevels as well, but

Apache server keeps crashing, “caught SIGTERM, shutting down”

人盡茶涼 提交于 2019-11-27 19:58:09
This just started happening three weeks or so ago. The content of my website hasn't changed, it's just a phpBB forum using MySQL as a backend. Nothing has changed in well over a year but recently, every two days or so, the server just shuts down and cannot be accessed at all, I have to notify my service provider to physically restart the machine. It seems to be tied to these SIGTERM errors I find in the logs. Problem is I have no idea how to fix these kinds of things or find the root cause as my skills in this area are lacking. Anyone have any ideas what could be going on? Apache/2.2.3 (CentOS

Win32 API analog of sending/catching SIGTERM

人走茶凉 提交于 2019-11-27 15:31:30
Under POSIX OS there is signal API that allows to send a signal to process to shut it down with kill and you can catch it with sigaction and do what you need; However, Win32 is not POSIX system, so: How can I handle shutdown events that may come, for example from "End Process" in "Task manager"? What is the standard API for sending shutdown signal to Win32 application? I'm not talking about GUI, I'm talking about TCP/IP server that should be nicely shutdown. that does not run like windows service. Christopher You get a WM_QUIT message on your first created thread. When you don't handle that,

Java: How to handle a SIGTERM only?

旧时模样 提交于 2019-11-27 06:27:01
问题 Is there a way in Java to handle a received SIGTERM? I am running a java service but do not want to close my java service when the user log off. Would like to override only the sigterm shutdown handler but retain the handlers for the rest of the signals. details of signals a slight variation of this qns 回答1: If the Signal passed to handle has name "TERM" then do something, otherwise, ignore it. class MySignalHandler implements SignalHandler { public void handle(Signal sig) { if (!"TERM"

Is it possible to capture a Ctrl+C signal and run a cleanup function, in a “defer” fashion?

◇◆丶佛笑我妖孽 提交于 2019-11-27 02:34:38
I want to capture the Ctrl+C ( SIGINT ) signal sent from the console and print out some partial run totals. Is this possible in Golang? Note: When I first posted the question I was confused about Ctrl+C being SIGTERM instead of SIGINT . Lily Ballard You can use the os/signal package to handle incoming signals. ^C is SIGINT , so you can use this to trap os.Interrupt . c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt) go func(){ for sig := range c { // sig is a ^C, handle it } }() The manner in which you cause your program to terminate and print information is entirely up to you. This

Apache server keeps crashing, “caught SIGTERM, shutting down”

北慕城南 提交于 2019-11-26 22:53:09
问题 This just started happening three weeks or so ago. The content of my website hasn't changed, it's just a phpBB forum using MySQL as a backend. Nothing has changed in well over a year but recently, every two days or so, the server just shuts down and cannot be accessed at all, I have to notify my service provider to physically restart the machine. It seems to be tied to these SIGTERM errors I find in the logs. Problem is I have no idea how to fix these kinds of things or find the root cause as