Opened 10 years ago

Closed 9 years ago

Last modified 8 years ago

#2119 closed Enhancement (fixed)

daemon should reload settings.json on SIGHUP

Reported by: charles Owned by: charles
Priority: Normal Milestone: 1.80
Component: Daemon Version: 1.61
Severity: Normal Keywords:
Cc: dirkjan@…, yumkam@…

Description (last modified by charles)

Currently, the daemon saves its current state to settings.json when it exits. This has caused some confusion:

  1. With most daemons, the config file can be edited by hand while the daemon is running, and then the daemon can be told (via HUP) to reload the file. transmission-daemon ignores the HUP, and overwrites the user's changes when it exits.
  1. By not saving externally-driven settings changes (such as if the user alters speed limits via the web ui) until the daemon exits, we run the risk of losing the changes if the OS shuts down uncleanly, or doesn't give the daemon enough time to shutdown cleanly.

The daemon should probably save its session changes to settings.json immediately as they occur, and also support rereading the settings via HUP.

Useful links:

http://www.enderunix.org/docs/eng/daemon.php

Change History (22)

comment:1 Changed 10 years ago by charles

  • Component changed from Transmission to Daemon
  • Description modified (diff)
  • Owner set to charles
  • Status changed from new to assigned
  • Summary changed from transmission-daemon should be more daemon-like to transmission-daemon should keep its config files in a more daemon-like way

#2060 has been marked as a duplicate of this ticket.

#1999 has been marked as a duplicate of this ticket.

#1759 has been marked as a duplicate of this ticket.

comment:2 Changed 10 years ago by charles

  • Description modified (diff)

comment:3 Changed 10 years ago by charles

  • Summary changed from transmission-daemon should keep its config files in a more daemon-like way to transmission-daemon should use its config files as daemons do

comment:4 Changed 10 years ago by charles

#2161 has been marked as a duplicate of this ticket.

comment:5 Changed 10 years ago by charles

  • Milestone changed from Sometime to 1.80

comment:6 Changed 9 years ago by djc

It would also be helpful if there was a way to find error messages. Of course, something in the (web) UI would be best, but some daemon logs would probably also be of use.

comment:7 Changed 9 years ago by djc

  • Cc dirkjan@… added

comment:8 Changed 9 years ago by charles

  • Summary changed from transmission-daemon should use its config files as daemons do to use config files as other daemons do

comment:9 Changed 9 years ago by Waldorf

I'll look into this.

comment:10 Changed 9 years ago by charles

  • Summary changed from use config files as other daemons do to daemon should reload settings.json on SIGHUP

See also #2119

comment:11 Changed 9 years ago by charles

Initial commit added to trunk in r9387 for 1.80

comment:12 Changed 9 years ago by charles

  • Resolution set to fixed
  • Status changed from assigned to closed

Seems to be working

comment:13 Changed 9 years ago by KyleK

This patch removes the signal handler for SIGTERM (the default signal of kill and killall) to cleanly quit Transmission. Any particular reason why?

comment:14 Changed 9 years ago by charles

This is a good point. Fixed in trunk for 1.80 by r9390

comment:15 Changed 9 years ago by KyleK

  • Resolution fixed deleted
  • Status changed from closed to reopened

r9390 introduced a switch() to the function gotsig(), but the break statement is missing from the SIGHUP case. As a result, Transmission quits (cleanly) after sending a SIGHUP signal to reload the settings :)

comment:16 Changed 9 years ago by charles

gaaaah! :)

thanks for watching over my shoulder.

comment:17 Changed 9 years ago by charles

  • Resolution set to fixed
  • Status changed from reopened to closed

re-fixed in trunk for 1.80 by r9415. thanks again for noticing this. :)

comment:18 Changed 9 years ago by yukam

  • Cc yumkam@… added
  • Resolution fixed deleted
  • Status changed from closed to reopened

You need s/SIGKILL/SIGTERM/g (r9387 removed SIGTERM handling, and r9390 incorrectly introduced SIGKILL instead). SIGKILL cannot be handled (it always unconditionally and immediately terminates process without userspace notification).

comment:19 Changed 9 years ago by charles

gaaaah! :)

thanks for watching over my shoulder.

comment:20 Changed 9 years ago by charles

  • Resolution set to fixed
  • Status changed from reopened to closed

re-re-fixed in trunk for 1.80 by r9439. thanks again for finding this.

comment:21 Changed 9 years ago by charles

charles * r9644 /trunk/ (3 files in 2 dirs): (trunk) #2119 "daemon should reload settings.json on SIGHUP" -- reload the blocklists, too. Suggested by nano- in irc.

comment:22 Changed 8 years ago by jordan

ticket #2834 has been closed as a duplicate of this ticket.

Note: See TracTickets for help on using tickets.