Skip to content

Fix Prooph projection manager reuse after reconnect - #702

Open
lifinsky wants to merge 2 commits into
ecotoneframework:mainfrom
lifinsky:fix/prooph-projection-manager-reconnect
Open

lifinsky wants to merge 2 commits into
ecotoneframework:mainfrom
lifinsky:fix/prooph-projection-manager-reconnect

Conversation

@lifinsky

@lifinsky lifinsky commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Why is this change proposed?

LazyProophEventStore rebuilds its inner Event Store when the PDO connection changes, but LazyProophProjectionManager keeps returning the manager cached for the same context. That manager still holds the previous Event Store and PDO connection.

After a reconnect, a synchronous projection can therefore read through the old connection while the command appends an event inside a transaction on the new one. The projection cannot see the uncommitted event and leaves the read model unchanged.

Description of Changes

Associate each cached manager with the inner Event Store used to create it and rebuild the manager when that instance changes. This reuses the existing reconnect detection and preserves the per-context cache.

The regression scenario initializes a synchronous projection, reconnects, updates an aggregate inside an open transaction, and checks the read model before commit. It also checks rollback and a subsequent retry.

In-memory mode returns its configured projection manager directly, without reconnect tracking.

Fixes #703.

Pull Request Contribution Terms

  • I have read and agree to the contribution terms outlined in CONTRIBUTING.

@lifinsky

Copy link
Copy Markdown
Contributor Author

@dgafka, could you please prioritize reviewing and merging this fix for a 1.x patch release, rather than waiting for 2.0?

Applications still running 1.x are affected: after a reconnect, synchronous projections can miss events written inside the current transaction. A 1.x release would let affected applications receive the fix without requiring a major-version upgrade.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Synchronous Prooph projections use a stale PDO connection after reconnect

1 participant