Bug 31124 - koha-remove fails to remove long_tasks queue daemon, so koha-create for same <instance> user fails
Summary: koha-remove fails to remove long_tasks queue daemon, so koha-create for same ...
Status: ASSIGNED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: wajasu
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 24383 35092
  Show dependency treegraph
 
Reported: 2022-07-08 14:57 UTC by wajasu
Modified: 2024-01-04 10:25 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
koha-remove fixed to fully remove instancename (including instance-user) so subsequent koha-create can succeed with same instancename.
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wajasu 2022-07-08 14:57:10 UTC
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
Comment 1 Magnus Enger 2023-05-04 12:56:59 UTC
(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.