Docker image keeps exiting with exit 0

I’m running Syncthing on a pi4 running raspbian with docker-compose and I’m noticing that my service keeps going down. Every time this happens, docker-compose ps shows that Syncthing exited with code 0, which is confusing since that should be the successful error code and AFAIK Syncthing shouldn’t exit:

$ docker-compose ps
  Name                 Command               State                                 Ports                              
----------------------------------------------------------------------------------------------------------------------
syncthing   /bin/entrypoint.sh /bin/sy ...   Exit 0   21027/udp, 0.0.0.0:22000->22000/tcp, 0.0.0.0:22000->22000/udp,  
                                                      0.0.0.0:8384->8384/tcp 

I’ve checked docker logs syncthing and I seem to get Syncthing exited: signal: killed without much more information and other times nothing as the last message:

[PN2BU] 21:52:19 INFO: Device ****** client is "syncthing v1.19.2" named "******" at 172.21.0.2:50442-170.178.211.213:22067/relay-server/TLS1.3-TLS_CHACHA20_POLY1305_SHA256
[monitor] 00:04:53 INFO: Syncthing exited: signal: killed
[start] 00:04:54 INFO: syncthing v1.19.2 "Fermium Flea" (go1.17.7 linux-arm) docker@build.syncthing.net 2022-03-21 03:47:47 UTC [noupgrade]
...
[PN2BU] 17:39:10 INFO: Joined relay relay://104.193.226.100:22067
[PN2BU] 17:48:15 INFO: Completed initial scan of receiveencrypted folder "Default Folder" (szn99-uxvgv)
[start] 11:33:07 INFO: syncthing v1.19.2 "Fermium Flea" (go1.17.7 linux-arm) docker@build.syncthing.net 2022-03-21 03:47:47 UTC [noupgrade]

Also my docker-compose.yml:

version: '3'
services:

  syncthing:
    image: syncthing/syncthing
    container_name: syncthing
    environment:
      - PUID=1001
      - PGID=1001
      - TZ=America/Los_Angeles
    volumes:
      - /home/grantland/syncthing/config:/var/syncthing/config
      - /media/storage/syncthing:/data
      - /media/storage:/media/storage
    ports:
      - 8384:8384
      - 22000:22000/tcp
      - 22000:22000/udp
    restart: unless-stopped

Are there logs somewhere else that might show me why Syncthing keeps exiting? FWIW this is an encrypted node which is in beta.

Thanks!

Seeing more log lines around the time it restarts might show a clue.

Looks like its running out of memory to me.

Could you check the kernel log at that time?

dmesg -T

I think this might be the cause. I remembered that the last thing I did on this machine was up the inotify limits to double what was recommended here since I was still getting the warning when increasing it to what was recommended.

https://docs.syncthing.net/users/faq.html#inotify-limits

For now I’ve reverted it back to the default (8192) to see if it goes away and hopefully the warning doesn’t come back either.

If you don’t hear back from me it was a success! If you do, I’ll check out dmesg -T and add more log lines.

That explains why Syncthing is getting killed but it shouldn’t stop with exit 0.

Yeah that’s weird IMO. This last time it did stop with exit 15, but every time before that it was exit 0.

Quick update: I started getting the inotify errors again so I updated it to the recommended 204800. No errors so far so we’ll see if we’re good after a week or so as it was stopped last time after 3 days.

I haven’t received any issues, but also I’ve now disabled watchers completely as this is a receive only device.