Skip to content

Race condition upon queue flushing for an update #20320

Closed
@HermannDppes

Description

@HermannDppes

Description

tl;dr

When upgrading to a different version, either there is no way without race conditions to flush the queues (and such a way needs to be created) or there is such a way (and it needs to be documented).

Expected Behaviour

When performing an upgrade that requires flushed queues (e.g. from 1.16.3 to 1.16.4), I can flush the queues without worrying they might be unflushed.

Actual Behaviour

The only documented way to flush queues I could find screams race condition so loudly that people started commenting “RIP headphone users” on unrelated YouTube-Videos.

Steps to Reproduce

This is, of course, only an example, but it was my scenario:

  1. Run Gitea version 1.16.3
  2. Decide to upgrade to a later version and see that this requires flushing the mirror sync queue
  3. Find only gitea manager flush-queues in the documentation
  4. Find out that it can be executed only when Gitea is running
  5. Execute the queue flushing command and race to stop the Gitea instance (essentially gitea manager flush-queues && systemctl stop gitea)
  6. Perform the upgrade
  7. Sit back and acknowledge that what you just did feels really dumb because race conditions you neither know how to check for nor how to correct for should absolutely never be part of your process

Conclusion

So, if there was (for some reason or another) no race condition going on or I could have somehow prevented race conditions from occurring, I would have loved to know about that. As it stands, my best guess is that there was a race condition, there was nothing I could do about it and I got lucky and it caused me no problems. But as queue flushing is presumably here to stay as an occasional upgrade requirement, I'm definitely not satisfied with this state of affairs.

Gitea Version

e.g. 1.16.3 → 1.16.4

How are you running Gitea?

By reading documentation and release notes. :P

Less tongue-in-cheek, from binary via systemd, but this feels relevant to all variants of running Gitea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions