Skip to content

Conversation

@0b100100
Copy link
Contributor

@0b100100 0b100100 commented Jul 9, 2021

linuxserver.io


  • I have read the contributing guideline and understand that I have made the correct modifications

Description:

We should wait for the termination of the transmission-daemon before the s6 service issues a sigterm to all remaining processes.
Without this delay the s6 sigterms are issued right after the RPC 'transmission-remote --exit'. This leaves not time to properly save the settings.json file, stats.json file, all resume files and showing the closing message 'Closing transmission session... done'.

Benefits of this PR and context:

This PR closes #80.

How Has This Been Tested?

docker-compose.yml:

version: '2'
services:
  transmission:
    image: linuxserver/transmission
    container_name: transmission
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
      - TRANSMISSION_WEB_HOME=/transmission-web-control/
      - USER=username
      - PASS=password
    volumes:
      - /root/transmission_config:/config
      - /root/Downloads/transmission:/downloads
      - /root/Downloads/transmission/watch:/watch
    ports:
      - 9091:9091
      - 51413:51413
      - 51413:51413/udp

Build:

# git clone https://github.com/linuxserver/docker-transmission.git
# cd docker-transmission
# docker build \
  --no-cache \
  --pull \
  -t linuxserver/transmission:latest .

Start:

# docker-compose up -d

Log after issuing docker-compose down without the fix:

# docker logs -f transmission
...
Caught SIGTERM signal!
localhost:9091/transmission/rpc/ responded: "success"
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
[2021-07-09 00:47:24.210] Reloading settings from "/config" (/home/buildozer/aports/community/transmission/src/transmission-3.00/daemon/daemon.c:592)
[2021-07-09 00:47:24.210] RPC Server Serving RPC and Web requests on 0.0.0.0:9091/transmission/ (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/rpc-server.c:1243)
[2021-07-09 00:47:24.210] RPC Server Password required (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/rpc-server.c:1254)
[2021-07-09 00:47:24.210] Saved "/config/settings.json" (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/variant.c:1221)
[2021-07-09 00:47:24.210] DHT Not saving nodes, DHT not ready (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/tr-dht.c:445)
[2021-07-09 00:47:24.210] Port Forwarding Stopped (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/port-forwarding.c:196)
Closing transmission session... done.
[s6-finish] sending all processes the KILL signal and exiting.

Log after issuing docker-compose down with the fix:

...
Caught SIGTERM signal!
Tell the transmission session to shut down.
localhost:9091/transmission/rpc/ responded: "success"
Closing transmission session... done.
[2021-07-09 00:51:07.671] Saved "/config/settings.json" (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/variant.c:1221)
[2021-07-09 00:51:07.671] DHT Not saving nodes, DHT not ready (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/tr-dht.c:445)
[2021-07-09 00:51:07.671] Port Forwarding Stopped (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/port-forwarding.c:196)
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.

Important line in the logs when the saving occurs:
... Saved "/config/settings.json" ...

Without the fix the old settings get reloaded right after the TERM signal by the S6 service.
This prevents saving changed settings from the Web-Interface:
... Reloading settings from "/config" ...

Source / References:

#80 (comment)

We should wait for the termination of the transmission-daemon before the s6 service issues a sigterm to all remaining processes.
Without this delay the s6 sigterms are issued right after the RPC 'transmission-remote --exit'. This leaves not time to properly save the settings.json file, stats.json file, all resume files and showing the closing message 'Closing transmission session... done'.

This commit should fix the following issue: linuxserver#80
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this pull request! Be sure to follow the pull request template!

@LinuxServer-CI
Copy link
Collaborator

@aptalca
Copy link
Member

aptalca commented Jul 9, 2021

Thanks for the PR. Let's get some test results in the issue topic, then we can merge.

In the meantime, please add a changelog entry to readme-vars.yml

@LinuxServer-CI
Copy link
Collaborator

@aptalca aptalca merged commit 877cdeb into linuxserver:master Jul 25, 2021
@0b100100 0b100100 deleted the patch-1 branch July 25, 2021 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't exit transmission cleanly when using custom RPC settings

3 participants