Service restarts intermittently but is already running

support
raspberrypi3

#1

Hey all,

I’ve been seeing a weird issue on my Raspberry Pi 2 stack for a few weeks now. It’s running Host OS Version
Resin OS 2.12.7+rev1 production and Supervisor Version 7.4.3 with two small services in a stack. I THINK this issue started after a Resin OS update, but I can’t confirm.

What happens at least once a day, is I get a log message that the services are already running, and then it appears to run my init command again in the existing container. This causes my container that runs a cron process to emit weird behavior because the init script has now run twice. Also notice the time jump between the OS logs and the service logs, not sure if it’s related.

07.06.18 08:04:54 (-0400)  rsnapshot      root@192.168.86.13:/ /snapshots/alpha.0/fragrant-dust/
07.06.18 07:54:58 (-0400) Service is already running 'rsnapshot sha256:40da009f58e770f840e9bac467e0b94d699ddc58678889a8ce79ce40c6b4ed83'
07.06.18 07:54:58 (-0400) Service is already running 'ssh sha256:7a54ed1167b157070a3b65493892a303440b80addb15083732d4c530e03a40c7'

This container is supposed to execute start.sh, which appends some config to a file then runs a crond daemon. However after the init script is run a second time, I see my vars are duplicated in the config file and there are two instances of the init script running.

PID   USER     TIME   COMMAND
    1 root       0:00 tini -sg -- /bin/sh start.sh
   17 root       0:00 /bin/sh start.sh
   39 root       0:00 /usr/sbin/crond -f
   94 root       0:00 /bin/bash
  102 root       0:00 ps

I could try to catch multiple executions in my start script, but I’m more concerned that my init script is being executed a second time while the service is running. Has anyone else seen this behavior before? I can share access to my application if it’s helpful.