katello-nightly-rpm-pipeline 1633 failed

Just making a note here: we can consistently see this failing over the past few days.

Looking at Katello’s and Foreman’s git log I don’t see anything that would even touch these areas, so I wonder if this is something in some other RPM we updated that now interacts unexpectedly. We don’t see this in Foreman’s tests so I don’t know if it’s just chance.

Katello does have additional middleware that Foreman doesn’t, so either Katello::Middleware::EventDaemon (which I still question; you shouldn’t attempt to start a daemon thread in middleware) or Katello::Middleware::OrganizationCreatedEnforcer are suspects to me.

For example, it could be this line:

If the file was somehow corrupted or there’s a race condition, it could be empty and return nil perhaps?

Not entirely the same situation and very old, but it looks like it could happen:

Reading more on Rails, you are supposed to wrap threads that you spawn:

So perhaps this is something that would make the EventDaemon safer.

I’ve opened a PR with some potential fixes: