framecache: add SIGPIPE ignore, signal logging, and init:true for stable POST handling

This commit is contained in:
Wild Dragon Dev 2026-06-03 20:05:55 +00:00
parent 0ed1254fd9
commit 902d985ca8
2 changed files with 5 additions and 2 deletions

View file

@ -169,6 +169,7 @@ services:
build: ./services/framecache
profiles: [capture]
restart: unless-stopped
init: true
ipc: host
shm_size: '${FC_SHM_SIZE_GB:-40}gb'
environment:

View file

@ -315,13 +315,15 @@ static void request_completed(void *cls,
/* ── main ──────────────────────────────────────────────────────────── */
static volatile int g_running = 1;
static volatile int g_received_signal = 0;
static void on_signal(int sig) { (void)sig; g_running = 0; }
static void on_signal(int sig) { g_received_signal = sig; g_running = 0; }
int main(void)
{
signal(SIGINT, on_signal);
signal(SIGTERM, on_signal);
signal(SIGPIPE, SIG_IGN);
/* Ensure /dev/shm/framecache exists */
mkdir("/dev/shm/framecache", 0755);
@ -352,7 +354,7 @@ int main(void)
nanosleep(&ts, NULL);
}
fprintf(stderr, "[framecache] shutting down\n");
fprintf(stderr, "[framecache] shutting down (signal %d)\n", g_received_signal);
/* Destroy all active slots */
for (int i = 0; i < FC_MAX_SLOTS; i++) {