neos-development-collection icon indicating copy to clipboard operation
neos-development-collection copied to clipboard

BUGFIX: Use dedicated connection for EventStore

Open bwaidelich opened this issue 1 year ago • 5 comments

Use a dedicated DBAL Connection for the DoctrineEventStore in order to prevent nested transactions potentially leading to RuntimeException of

A transaction is active already, can't commit events!

As a result, the doctrine:migrate and cr:setup commands can be skipped during CI

bwaidelich avatar Apr 22 '24 12:04 bwaidelich

Yes i observed that already once in ci ... locally it works without ... probably because stuff (schema) is already warmed up?

mhsdesign avatar Apr 22 '24 13:04 mhsdesign

@mhsdesign The error is

RuntimeException: Failed to acquire checkpoint lock for subscriber "Neos\Neos\FrontendRouting\Projection\DocumentUriPathProjection_Original" because a transaction is active already

I guess this is only implicitly related. I'll check again once #4988 is merged

bwaidelich avatar Apr 22 '24 15:04 bwaidelich

grml, this isn't solved wiht #4988 it seems – I applied the fix there and checks still fail. But The actual exception is now revealed and this can be reproduced locally by removing all Flow/Neos tables and running:

../../bin/behat -f progress --strict --no-interaction '-vvv' '--stop-on-failure' '-c' 'Neos.Neos/Tests/Behavior/behat.yml'  

=>

001 Scenario: Match homepage URL                                     # Features/FrontendRouting/Basic.feature:69
      When the command CreateRootWorkspace is executed with payload: # Features/FrontendRouting/Basic.feature:30
        RuntimeException: A transaction is active already, can't commit events! in Packages/Libraries/neos/eventstore-doctrineadapter/src/DoctrineEventStore.php:95

So this is the line that fails. I'll investigate..

bwaidelich avatar May 01 '24 09:05 bwaidelich

I can confirm that the last version works in conjunction with the reworked catchup: image

If we were to create a dedicated connection per projection, it would probably work here as well – and maybe that even makes sense since they have their independent transaction boundaries

bwaidelich avatar May 01 '24 15:05 bwaidelich

I have encountered the bug also in the NodeTemplates Ci (see https://github.com/Flowpack/Flowpack.NodeTemplates/pull/51/commits/f37b6c4a21abd9ae4fa368a62c5a81ab01d1a152)

The first error is:

Neos.ContentRepository.Core/Classes/EventStore/EventPersister.php:47

RuntimeException: A transaction is active already, can't commit events!


and succeeding errors:

Neos.ContentRepository.Core/Classes/Infrastructure/DbalCheckpointStorage.php:88

RuntimeException: Failed to acquire checkpoint lock for subscriber "Neos\ContentRepository\Core\Projection\ContentStream\ContentStreamProjection" because a transaction is active already

mhsdesign avatar Jun 21 '24 17:06 mhsdesign

This will hopefully be resolved with #4988 once and for all

bwaidelich avatar Sep 18 '24 09:09 bwaidelich