Bug#1057061: The service roundcube-cleandb should depend on mariadb.service

2023-11-29 Thread Dmitry Katsubo
On 2023-11-30 00:22, Guilhem Moulin wrote:
> If the impact is only that the first run after a reboot or during a
> RDBMS restart fails, then I don't think it's worth trying to fix the
> race.  The service might fail for various other reasons, but as long as
> garbage doesn't pile up forever (i.e., as long as it doesn't *always*
> fail) this is not an issue.

I generally agree. Positive is that we have shared possible solutions if 
somebody sees the same issue.

-- 
With best regards,
Dmitry



Bug#1057061: The service roundcube-cleandb should depend on mariadb.service

2023-11-29 Thread Guilhem Moulin
Control: tag -1 - wontfix

On Thu, 30 Nov 2023 at 00:22:45 +0100, Guilhem Moulin wrote:
> On Thu, 30 Nov 2023 at 00:13:44 +0100, Dmitry Katsubo wrote:
>> For the subsequent calls I ma not sure – I've got an impression that
>> this service is run only once at system startup.
>
> No, it's supposed to run once a day at 00:05 local time, see the
> associated .timer unit.
>
> If the impact is only that the first run after a reboot or during a
> RDBMS restart fails, then I don't think it's worth trying to fix the
> race.  The service might fail for various other reasons, but as long as
> garbage doesn't pile up forever (i.e., as long as it doesn't *always*
> fail) this is not an issue.

Thinking more about it, the easiest and least disruptive solution would
be to set ‘Persistent=false’ in the .timer units, after all there is no
reason to clean the DB ASAP after boot.  The old cron jobs wait until
the next calendar occurrence, and it makes sense to align the .timer
units on that behavior.

The race condition is still present, but at least booting a system
that's been down for a long while won't show any failure in the
`systemctl status` output.

-- 
Guilhem.


signature.asc
Description: PGP signature


Bug#1057061: The service roundcube-cleandb should depend on mariadb.service

2023-11-29 Thread Guilhem Moulin
On Thu, 30 Nov 2023 at 00:13:44 +0100, Dmitry Katsubo wrote:
> For the subsequent calls I ma not sure – I've got an impression that
> this service is run only once at system startup.

No, it's supposed to run once a day at 00:05 local time, see the
associated .timer unit.

If the impact is only that the first run after a reboot or during a
RDBMS restart fails, then I don't think it's worth trying to fix the
race.  The service might fail for various other reasons, but as long as
garbage doesn't pile up forever (i.e., as long as it doesn't *always*
fail) this is not an issue.

-- 
Guilhem.


signature.asc
Description: PGP signature


Bug#1057061: The service roundcube-cleandb should depend on mariadb.service

2023-11-29 Thread Dmitry Katsubo
On 2023-11-29 20:17, Guilhem Moulin wrote:
> On Wed, 29 Nov 2023 at 19:48:09 +0100, Dmitry Katsubo wrote:
>> After= is not the same as Requires=
>> If the service is not present, it is just noop.
>> You might wish to add all supported RDBMS into After=.
> 
> One could also imagine systems where one (or more) of these .service
> files exists but isn't used by Roundcube.  In that case it's not a noop.
> I'll need to check what other maintainer do.

I agree, that adds more work to the scheduler, but roundcube-cleandb still 
works correctly.

>> Otherwise I have no good idea how to cure the error I got... making an 
>> explicit delay?
> 
> You can also add the After= relevant for your setup as a separate file
> override.

Right, that what I've done: added After=mariadb.service to 
roundcube-cleandb.service.

> What's the impact of this anyway? The race condition might
> cause the first run to fail but subsequent ones should succeed no?

Well, the impact is that during startup the unit is marked as failed:

# systemctl --all --failed
  UNIT  LOAD   ACTIVE SUBDESCRIPTION
● roundcube-cleandb.service loaded failed failed Purge Roundcube database: 
remove old records that were marked as deleted

For the subsequent calls I ma not sure – I've got an impression that this 
service is run only once at system startup.

-- 
With best regards,
Dmitry



Bug#1057061: The service roundcube-cleandb should depend on mariadb.service

2023-11-29 Thread Dmitry Katsubo
On 2023-11-29 02:23, Guilhem Moulin wrote:
> I don't think it's that simple: MariaDB is only one of several supported
> RDBMS, and the server might be on a different system.

After= is not the same as Requires=
If the service is not present, it is just noop.
You might wish to add all supported RDBMS into After=.

Otherwise I have no good idea how to cure the error I got... making an explicit 
delay?

TimeoutStartSec=70
ExecStartPre=/bin/sleep 60

-- 
With best regards,
Dmitry



Bug#1057061: The service roundcube-cleandb should depend on mariadb.service

2023-11-29 Thread Guilhem Moulin
On Wed, 29 Nov 2023 at 19:48:09 +0100, Dmitry Katsubo wrote:
> After= is not the same as Requires=
> If the service is not present, it is just noop.
> You might wish to add all supported RDBMS into After=.

One could also imagine systems where one (or more) of these .service
files exists but isn't used by Roundcube.  In that case it's not a noop.
I'll need to check what other maintainer do.

> Otherwise I have no good idea how to cure the error I got... making an 
> explicit delay?

You can also add the After= relevant for your setup as a separate file
override.  What's the impact of this anyway?  The race condition might
cause the first run to fail but subsequent ones should succeed no?

-- 
Guilhem.


signature.asc
Description: PGP signature


Bug#1057061: The service roundcube-cleandb should depend on mariadb.service

2023-11-28 Thread Guilhem Moulin
Control: tag -1 moreinfo

On Wed, 29 Nov 2023 at 01:14:27 +0100, Dmitry Katsubo via 
Pkg-roundcube-maintainers wrote:
> The service roundcube-cleandb should be run after MySQL/MariaDB is started:
>
> === file /lib/systemd/system/roundcube-cleandb.service ===
>
> [Unit]
> After=mariadb.service
>
> === end ===

I don't think it's that simple: MariaDB is only one of several supported
RDBMS, and the server might be on a different system.

-- 
Guilhem.


signature.asc
Description: PGP signature


Bug#1057061: The service roundcube-cleandb should depend on mariadb.service

2023-11-28 Thread Dmitry Katsubo
Package: roundcube-core
Version: 1.6.3+dfsg-1~deb12u1

The service roundcube-cleandb should be run after MySQL/MariaDB is started:

=== file /lib/systemd/system/roundcube-cleandb.service ===

[Unit]
After=mariadb.service

=== end ===

otherwise the following error may occur during the startup:

2023-11-29 00:12:13.677906 systemd[1]: roundcube-cleandb.service: Main process 
exited, code=exited, status=1/FAILURE
2023-11-29 00:12:13.678149 cleandb.sh[1034]: ERROR: SQLSTATE[HY000] [2002] No 
such file or directory
2023-11-29 00:12:13.680342 cleandb.sh[1034]: ERROR: Failed to connect to 
database

-- 
With best regards,
Dmitry