- Issue created by @catch
- Merge request !6040Don't prevent destruction without preHandle having been run. β (Closed) created by catch
- Status changed to Needs review
11 months ago 3:30pm 5 January 2024 - π¬π§United Kingdom catch
This is not explicit test coverage, but it's the test coverage I was a trying to add when I discovered this bug. The green test run shows there's no explicit or implicit test coverage for the current behaviour at all.
- π¬π§United Kingdom catch
OpenTelemetryFrontPagePerformanceTest::testNodePageHotCache()
has some kind of problem with the page cache not being set - this is what led me to here in the first place. However I can't reproduce that problem locally, only on gitlab CI, which makes it hard to track down what's going on. I've added some extra assertions to the Umami front page test instead, which should fail on a test only run.@znerol pointed out in slack the original reason this was done: https://www.drupal.org/project/drupal/issues/2348679#comment-9517741 β
All event subscribers to the onKernelTerminate event will be run if we do my original approach here - and many of those aren't and shouldn't be run on page cache hits (like path alias subscriber).
However, we we take service destruction out of the onKernelTerminate event subscriber and run it in its own right, that might work. Services only get destructed if they're already initialized, so that's minimal overhead to add.
I've pushed a commit that does that.
This seems to work - but we either need to rename that class or just move the logic into DrupalKernel since it leaves it wrongly named.
- π¬π§United Kingdom catch
This requires adjusting some test assertions - possibly because the collector is running after other services in kernel destruct and hence picking up more database queries.
In general I think while the performance test use case is very specific, this change in behaviour is an improvement:
1. Destructable services should destruct as late as possible - i.e. after other things that might happen in kernel destruct like
UserRequestSubscriber
or automated cron.2. If you tag a service with
needs_destruction
it seems reasonable to assume it'll be destructed on any request where it's iniatialized. - π¬π§United Kingdom catch
Inlining was causing very strange errors on gitlab which I couldn't reproduce with local test runs, so backed that out of the MR. We could just rename the class/service and leave it as is, if this approach is otherwise OK.
- πΊπΈUnited States smustgrave
There any concern about the increase in calls?
- π¬π§United Kingdom catch
It will only run for services that were already instantiated and are also destructable, which will usually be nothing.
- Status changed to RTBC
11 months ago 2:21am 11 January 2024 - Status changed to Needs work
11 months ago 10:00am 11 January 2024 - π¬π§United Kingdom catch
We need to rename the class to something other than
KernelDestructionSubscriber
to avoid confusion before commit (and put it in a different namespace). Maybe something likeServiceDestructor
? - Status changed to Needs review
11 months ago 5:18pm 11 January 2024 - π¬π§United Kingdom catch
I had tried that before, but completely failed - however @alexpott pointed out that this was because I hadn't removed the call to the event subscriber (now a non-existing class), because it's so low level the test failures weren't obvious and I was looking for bugs with what I'd changed, not what I hadn't changed. With that cruft removed, it's fine. This avoids the renaming issue altogether.
- πΊπΈUnited States smustgrave
+1 for me. kernel.destructable_services seems like a good name and feedback appears to be addressed.
Going to leave in review for additional eyes.
- Status changed to RTBC
10 months ago 2:21pm 17 January 2024 - πΊπΈUnited States smustgrave
Been a few days, going to go ahead and mark.
- Status changed to Needs work
10 months ago 1:23pm 19 January 2024 - π¬π§United Kingdom longwave UK
Added feedback to the MR, also we need to remove the event subscriber from core.services.yml:
kernel_destruct_subscriber: class: Drupal\Core\EventSubscriber\KernelDestructionSubscriber calls: - [setContainer, ['@service_container']]
- Status changed to Needs review
10 months ago 10:08am 20 January 2024 - π¬π§United Kingdom catch
Should address #16, also added a CR for the deprecation.
- Status changed to RTBC
10 months ago 7:39pm 21 January 2024 - πΊπΈUnited States smustgrave
Appears deprecation feedback has been addressed.
- Status changed to Needs work
10 months ago 6:17pm 30 January 2024 - π¬π§United Kingdom longwave UK
Needs rebasing following changes to StandardPerformanceTest.
- Status changed to Needs review
10 months ago 9:11pm 30 January 2024 - π¬π§United Kingdom catch
Rebased. A few assertions have to be increased, which I'm pretty sure is because it's recording more things that were already happening.
- π«π·France andypost
@catch maybe instead service should be deprecated? https://www.drupal.org/about/core/policies/core-change-policies/drupal-d... β
- π¬π§United Kingdom catch
@andypost all event subscribers are implicitly @internal per https://www.drupal.org/about/core/policies/core-change-policies/bc-polic... β The service is only to register the event subscriber so similarly we should remove rather than deprecate here - we'd have to remove the event subscriber tag anyway.
- Status changed to RTBC
10 months ago 9:58pm 30 January 2024 - Status changed to Fixed
10 months ago 10:14pm 30 January 2024 -
longwave β
committed e5fc18c5 on 11.x
Issue #3412556 by catch, smustgrave, andypost, longwave: Allow...
-
longwave β
committed e5fc18c5 on 11.x
Automatically closed - issue fixed for 2 weeks with no activity.
- π¦πΊAustralia dpi Perth, Australia
Created a major bug as a result of this issue: π Container compile crash when a service decorates a destructable service Needs work