Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Risk of memory leak in JpaEventPublicationRepository #1022

Open
iirekm opened this issue Jan 18, 2025 · 0 comments
Open

Risk of memory leak in JpaEventPublicationRepository #1022

iirekm opened this issue Jan 18, 2025 · 0 comments

Comments

@iirekm
Copy link

iirekm commented Jan 18, 2025

findIncompletePublicationsPublishedBefore and similar methods do something like: entityManager....getResultStream().map(...).toList(). The toList() part here can cause a memory leak if there are zillions of events to process (e.g. the event handler is constantly failing). Paging is missing (e.g. OFFSET...LIMIT)

I had a similar expensive, production bug in custom-made transactional outbox, because of exactly the same problem!

The same problem likely exists in other publication repository implementations (e.g. JDBC).

Another issue I see is order by p.publicationDate asc - after adding paging it will make Denial of Service attacks pretty easy (when all events in a page end with processing error, eventually no further events can be processed). Instead some form of exponential backoff and/or randomness should be used.

Version: 1.3.1

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

No branches or pull requests

1 participant