1

I'm trying to dockerize a standalone transmission-daemon with https. So I'm using transmission-daemon and nginx packages, and the docker is based on alpine Linux.

To run both programs, I'm using supervisor.

All works good, but I want that docker container stop gracefully kill my container. So, I have configured supervisor to propagate TERM signal to transmission-daemon.

This works good when transmission is idle. But if I stop the container when it downloads or doing something, it unfortunately doesn't works. It seem completely ignore the signal, because even after the download finish, it keeps running.

I have absolutely no idea why. Can someone help me please?

Here is my supervisor transmission configuration:

[program:transmission]
user=transmission
command=/usr/bin/transmission-daemon -f
stopsignal=TERM
stopwaitsecs=60
stopasgroup=true
killasgroup=true

I'm open to any suggestion.

1

From the Transmission arch wiki it looks like the commands to end transmission-daemon are:

killall transmission-daemon

Or

$ transmission-remote --exit

Or from Ubuntu's help:

transmission-remote -n 'transmission:transmission' -q

I think a SIGTERM and TERM signal are the same, and killall's default is to send a SIGTERM, it looks like your supervisor should work... after the stopwaitsecs it's supposed to send a KILL signal too, so unless it's not sending the right signals at the right time... Confirm in a terminal that TERM/SIGTERM will kill transmission. If it doesn't, maybe it's a bug.

Try adding a redirect_stderr or stdout_logfile line to see if it'll tell supervisord anything useful

| improve this answer | |
  • Thanks for your response. transmission-remote --exit seems work. I dit a lot of tests and the problem is the same if I manually send signal to transmission when it downloading. It seems ignore it. But I did the same test based on Archlinux image and it works perfectly... transmission-version of both distribution are the same (2.92). So I think the cause is more complicatly: maybe a difference in signal management between Alpine and Archlinux? It's beyond my skills... – lama02 Nov 30 '17 at 13:19
  • 1
    I'm unfamiliar with Alpine, but it must be the difference, a plain signal should work. But if only transmission-remote --exit does work, could try investigating it's source code to see exactly what --exit does, it's not a script so it's not as easy as less $(which ...) unfortunately, but then that wouldn't help supervisor anyway, it's set up to easily use signals... I'm leaning more towards bug in Alpine's transmission – Xen2050 Nov 30 '17 at 13:26
  • transmission-remote --exit calls tr_sessionClose and cleanly close transmission. I do not understand how TERM or INT signals calls this function too, but I think it's the case because when it works on my tests I can see same logs as tr_sessionClose call. So, you think it can be a bug in Alpine transmission? But there is the same versions on both Archlinux and Alpine, so how is possible? – lama02 Nov 30 '17 at 15:03
  • 1
    I've never heard of Alpine linux before today, but apparently it's based on busybox & musl (C library), not using glibc (Debian's repo calls glibc6 "the standard libraries that are used by nearly all programs on the system") so that could be something. You could try comparing the source code from arch & Alpine's packages? Or could try their wiki's method wiki.alpinelinux.org/wiki/… controlling it with HTTP ("transmission-daemon will be controlled via Clutch which is run by lighttpd") – Xen2050 Nov 30 '17 at 18:31
  • 1
    It looks like a bug & acts like a bug, especially tested with the same version on another system, I think it's a bug :) That's an advantage of bigger distros like Debian (& directly derived), more testers & eyes to find bugs. Thanks for the check, I up-arrowed your bug report too since it's definitely a useful answer. Good luck! – Xen2050 Dec 1 '17 at 10:21
1

It's probably a bug. Reported in Alpine bug tracker:

https://bugs.alpinelinux.org/issues/8218

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.