mirror of
https://github.com/troglobit/finit.git
synced 2026-10-28 12:30:44 +00:00
Instead of deleting svc_t, mark it for cleanup by garbage collector
When a process, that has been sent SIGTERM by us, takes a full 3 sec to terminate, the event loop may have both the SIGCHLD event (where we do the svc_del()) and the 3 sec timeout event to send SIGKILL in its event cache. When we call svc_del() it releases the svc_t memory, which can then be dereferenced by the SIGKILL timer callback and we're doomed. There are two fixes to this; 1) the event loop, that uses epoll_wait(), can set maxevents=1 (instead of today's 10). The kernel will then drop the SIGKILL timer event before it's delivered to the userspace process. 2) we can postpone deleting the svc_t to a "later stage" when all events in the event cache have been processed. This patch implements (2). A later patch will use uev_init1(ctx, 1) to ensure the event cache handles only one event at a time. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
f33ed869e4
commit
cb9f6213dc
2 files changed
+51
-4