Problem/Motivation
Tests are failing on SQLite because it seems to happen that a request's KernelEvents::TERMINATE event is dispatched after the site has already been uninstalled. Not sure why this only happens for SQLite, probably a timing issue.
I had originally thought this only affected 8.x-1.x and could be fixed by #3540554: Functional tests attempting to release locks for a no-longer existing site throws an exception so I attempted to fix the problem with e3f80630c0fc808a7b86dc7b57db6e9ee0b7a0c9, but it seems that this is tied to SQLite and not the version and also that issue does not yet fully fix the problem.
In particular, \Drupal\automated_cron\EventSubscriber\AutomatedCron::onTerminate() is also causing problems by running cron on a site that no longer exists.
Proposed resolution
I had already opened a merge request against 8.x-1.x (as I originally thought this only affected that branch). Once that is settled I will open another one for 2.x which will presumably need the same treatment.
Comments
Comment #2
tstoecklerComment #3
tstoecklerSo the original fix for the automated cron thing that I had in mind (not storing the config object in the service, but the config factory) was in fact already fixed by #3483996: Remove lazy declaration and proxy class for cron and use service closure instead. I was just looking at 10.4. Unfortunately that does not seem to completely fix the cron issue. From looking at the code I can't figure out why the automated cron still runs when the site is installed, but somehow it does... (or something else entirely is going on and I'm completely off track 🤷)
Comment #4
tstoecklerReally could not figure out a proper way to do this, so I just opened #3540786: Test site may be destroyed while an (automated) cron is still running to explicitly work around this edge case and am adding that as a patch for CI. Seems to work, so that's going to be good enough until someone can come up with a better solution 🤷
Comment #7
tstoecklerComment #8
tstoeckler