Page MenuHomeFreeBSD

www/tt-rss: Simplify ttrssd rc script
ClosedPublic

Authored by dereks_lifeofadishwasher.com on Jun 16 2024, 9:50 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jan 31, 2:47 AM
Unknown Object (File)
Wed, Jan 22, 9:36 AM
Unknown Object (File)
Mon, Jan 20, 9:47 PM
Unknown Object (File)
Sat, Jan 18, 1:41 AM
Unknown Object (File)
Wed, Jan 8, 2:01 AM
Unknown Object (File)
Sun, Jan 5, 4:06 AM
Unknown Object (File)
Dec 13 2024, 6:15 PM
Unknown Object (File)
Dec 11 2024, 1:45 PM
Subscribers
None

Details

Summary

ttrssd rc script has a check if a local database is ready such that at
startup ttrssd will wait 10 seconds for a database connection.

With daemon you can restart the child process with a delay such that the
rc script can be simplified to use command and command_args.

Test Plan
  1. service ttrssd status/stop/start while:
  2. not running
  3. running
  1. tail logs waiting for the database to start.
  2. See it fail until the database up

not running
status: not running

  1. service ttrssd status
		ttrssd is not running.

stop: not running

  1. service ttrssd stop
		ttrssd not running? (check /var/run/ttrssd.pid).

start: start

  1. service ttrssd start
		Starting ttrssd.

running:
status: displays correct pid

  1. service ttrssd status
		ttrssd is running as pid 53703.
		# pgrep -fal daemon
		53703 daemon: sh[53731]
		53731 /usr/local/bin/php /usr/local/www/tt-rss/update_daemon2.php

stop: stops daemon and php process waiting for all childern to finish

  1. service ttrssd stop
		Stopping ttrssd.
		Waiting for PIDS: 53703.
		# pgrep -fal daemon
		#

start: displays ttrssd is already running

  1. service ttrssd start
		ttrssd already running?  (pid=54520).
  1. tailing logs during a failing startup

tail -F /var/log/ttrssd.log
<pre>Exception while creating PDO object:SQLSTATE[08006] [7] connection to server at ".... failed: Connection refused

		Is the server running on that host and accepting TCP/IP connections?... : Connection refused

...
[21:26:31/54736] Lock: update.lock
[21:26:31/54736] Database schema is already at latest version.
[21:26:32/54735] Installing shutdown handlers
[21:26:32/54735] Spawned child process with PID 54739 for task 0.
...

One issue noticed with daemon is it can't be killed by normal means (service ttrssd stop) if the child process isn't running. I believe this is the cause of the issue? https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277959 If the rc script needs to handle this I beleive I can add a prestop checking if pgrep -P <parent> return value and killing the parent and deleting the pid file.

Diff Detail

Repository
R11 FreeBSD ports repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 59177
Build 56064: arc lint + arc unit

Event Timeline

Add UPDATING and stop if daemon doesn't have a child

Recommendations from https://lists.freebsd.org/archives/freebsd-ports/2024-June/006287.html
https://lists.freebsd.org/archives/freebsd-ports/2024-June/006290.html

  • Add UPDATING because of rc var removal ttrssd_local_db
  • Add a stop to INT or TERM the parent daemon.
    • If the child doesn't exist send INT to daemon.
    • If the child exists TERM will propagate to the child.
    • Testing has shown the parentless child will go away.

Revert GL_SITE update. This was caused by a failed rebase while working on a
update after this commit.

This revision was not accepted when it landed; it landed in state Needs Review.Sep 8 2024, 7:44 AM
This revision was automatically updated to reflect the committed changes.