| Summary: | koha-remove fails to remove long_tasks queue daemon, so koha-create for same <instance> user fails | ||
|---|---|---|---|
| Product: | Koha | Reporter: | wajasu <matted-34813> |
| Component: | Command-line Utilities | Assignee: | Tomás Cohen Arazi (tcohen) <tomascohen> |
| Status: | Needs documenting --- | QA Contact: | Marcel de Rooy <m.de.rooy> |
| Severity: | major | ||
| Priority: | P5 - low | CC: | dcook, fridolin.somers, m.de.rooy, magnus, martin.renvoize, mtj, robin, tomascohen, wainuiwitikapark |
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27783 | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | Trivial patch |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: |
This development makes `koha-remove` stop all worker processes before attempting to remove the instance's UNIX user.
|
Version(s) released in: |
25.11.00,25.05.01,24.11.08
|
| Circulation function: | |||
| Bug Depends on: | |||
| Bug Blocks: | 24383, 32736, 35092, 39961 | ||
| Attachments: |
Bug 31124: Make koha-remove stop all workers
Bug 31124: Make koha-remove stop all workers Bug 31124: Make koha-remove stop all workers Bug 31124: Make koha-remove stop all workers |
||
(In reply to wajasu from comment #0) > 2) > koha-worker needs: > the --queue option should be added to the --help / POD > > Also, koha-worker --help should at least show: > Usage: > koha-worker [--start|--stop|--restart] [--quiet|-q] [--queue <queuename>] > instancename1 [instancename2...] > and also: > --queue <queuename> Specify a queue name I think this was added to the script itself here: https://git.koha-community.org/Koha-community/Koha/commit/486d78f544f1fe074d4f474206155c4bcb02ea2a And to the "man" page here: https://git.koha-community.org/Koha-community/Koha/commit/f1fef6527c778977bd0d48e2cb42b5c9dc153a8f The problem with the long_tasks still running after koha-remove remains, at least for 22.05.11. This has been sitting for a while. Stealing it as I found it in the wild. Created attachment 182702 [details] [review] Bug 31124: Make koha-remove stop all workers This patch makes two things: * Adds a `get_worker_queues` function to koha-functions.sh * Makes `koha-remove` loop through all the defined queues to stop all the running workers before trying to remove the unix user for the instance. To test: 1. Run: $ ktd --shell k$ sudo -s k$ koha-create test1 k$ service koha-common restart k$ koha-remove test1 => FAIL: There's an error about not being able to drop the instance user 2. Run: k$ ps -ef | grep test1 => FAIL: There's a running process for the 'long_tasks' queue worker. 3. Apply this patch 4. Run: k$ cp debian/scripts/koha-functions.sh \ /usr/share/koha/bin/koha-functions.sh 5. Repeat 1 naming the instance `test2` => SUCCESS: The instance is removed correctly. No error about running processes => SUCCESS: No process is running for `test2` 6. Sign off :-D Created attachment 182703 [details] [review] Bug 31124: Make koha-remove stop all workers This patch makes two things: * Adds a `get_worker_queues` function to koha-functions.sh * Makes `koha-remove` loop through all the defined queues to stop all the running workers before trying to remove the unix user for the instance. To test: 1. Run: $ ktd --shell k$ sudo -s k$ koha-create --create-db test1 k$ service koha-common restart k$ koha-remove test1 => FAIL: There's an error about not being able to drop the instance user 2. Run: k$ ps -ef | grep test1 => FAIL: There's a running process for the 'long_tasks' queue worker. 3. Apply this patch 4. Run: k$ cp debian/scripts/koha-functions.sh \ /usr/share/koha/bin/koha-functions.sh 5. Repeat 1 naming the instance `test2` => SUCCESS: The instance is removed correctly. No error about running processes => SUCCESS: No process is running for `test2` 6. Sign off :-D I need to amend the test plan: when repeating the tests in step 5, please run ``` debian/scripts/koha-remove test2 ``` so the new version of the script is used. Created attachment 182714 [details] [review] Bug 31124: Make koha-remove stop all workers This patch makes two things: * Adds a `get_worker_queues` function to koha-functions.sh * Makes `koha-remove` loop through all the defined queues to stop all the running workers before trying to remove the unix user for the instance. To test: 1. Run: $ ktd --shell k$ sudo -s k$ koha-create --create-db test1 k$ service koha-common restart k$ koha-remove test1 => FAIL: There's an error about not being able to drop the instance user 2. Run: k$ ps -ef | grep test1 => FAIL: There's a running process for the 'long_tasks' queue worker. 3. Apply this patch 4. Run: k$ cp debian/scripts/koha-functions.sh \ /usr/share/koha/bin/koha-functions.sh 5. Repeat 1 naming the instance `test2` => SUCCESS: The instance is removed correctly. No error about running processes => SUCCESS: No process is running for `test2` 6. Sign off :-D Signed-off-by: Magnus Enger <magnus@libriotech.no> Thanks for fixing this, it has been a bother for quite some time! Created attachment 183054 [details] [review] Bug 31124: Make koha-remove stop all workers This patch makes two things: * Adds a `get_worker_queues` function to koha-functions.sh * Makes `koha-remove` loop through all the defined queues to stop all the running workers before trying to remove the unix user for the instance. To test: 1. Run: $ ktd --shell k$ sudo -s k$ koha-create --create-db test1 k$ service koha-common restart k$ koha-remove test1 => FAIL: There's an error about not being able to drop the instance user 2. Run: k$ ps -ef | grep test1 => FAIL: There's a running process for the 'long_tasks' queue worker. 3. Apply this patch 4. Run: k$ cp debian/scripts/koha-functions.sh \ /usr/share/koha/bin/koha-functions.sh 5. Repeat 1 naming the instance `test2` => SUCCESS: The instance is removed correctly. No error about running processes => SUCCESS: No process is running for `test2` 6. Sign off :-D Signed-off-by: Magnus Enger <magnus@libriotech.no> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Nice work everyone! Pushed to main for 25.11 Nice work everyone! Pushed to 25.05.x for 25.05.03 Pushed to 24.11.x for 24.11.08 Not backporting to 22.11.x as it wasn't backported to 24.05.x |
From the command line as a koha shell user: 1) koha-remove <instance> fails to remove the backgroundjobs / long_tasks(queue) daemon. (ps -aef | grep long_tasks) So when it tries to "deluser" the <instance>-koha user from /etc/passwd that errors because a process is still running for that user's PID. 2) koha-create <instance> fails for that same instance name from that point onward. 3) koha-worker --help doesn't show any --queue option Cursory investigation shows: --queue support was added in version 22.05 to koha-worker. koha-worker --stop --queue long-tasks <instancename> works to shut down that specified queue. --status and --start are also supported. Suggested Fix: 1) koha-remove needs to have an entry added: koha-worker --stop --queue long_tasks <instancename> added accordingly to get that process to stop so the latter deluser will succeed. 2) koha-worker needs: the --queue option should be added to the --help / POD Also, koha-worker --help should at least show: Usage: koha-worker [--start|--stop|--restart] [--quiet|-q] [--queue <queuename>] instancename1 [instancename2...] and also: --queue <queuename> Specify a queue name One should be able to be able(test plan): test 1) koha-remove kohadev koha-create --create-db kohadev koha-remove kohadev without problems in the ktd or other test environment to be fixed. test 2) Also, koha-worker --help should at least show: Usage: koha-worker [--start|--stop|--restart] [--quiet|-q] [--queue <queuename>] instancename1 [instancename2...] and also: --queue <queuename> Specify a queue name