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

Keep heap lean during remote polling #4599

Closed

Conversation

hpoettker
Copy link
Contributor

Resolves #4598.

The polling in MessageChannelPartitionHandler repeatedly fetches the running job execution with all associated step executions from the job repository. At the moment, it also retains references to step executions that have completed since the last iteration. This can accrue a lot of heap memory as each step execution holds references to a job execution, and that job execution holds references to all step executions.

This PR proposes not to retain any references to step or job executions while there are still running step executions. Instead, the step executions from the last iteration are used to build the result. This works as completed step executions are not expected to change after completion. And it reduces the memory foot print as the objects created in intermediate iterations can be handled by the garbage collector.

No test is added or changed as the changed code is already covered by appropriate tests.

@hpoettker
Copy link
Contributor Author

hpoettker commented May 21, 2024

@fmbenhassine Do you think this can be included in the 5.0/5.1 releases tomorrow?

It's backward-compatible and seems to solve the problem considering the reproducing example from #4598. I think it even fixes the problem in a way that requires no further refactoring of the polling. But effective feedback on that will probably only come when it's released in a minor release.

@fmbenhassine
Copy link
Contributor

Thank you for the follow up on #4598 and for opening this PR!

Yes, the change LGTM and will be included in 5.0.6 and 5.1.2.

@fmbenhassine
Copy link
Contributor

Rebased and merged as 03a2b4d. Thank you!

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

Successfully merging this pull request may close these issues.

Memory leak in MessageChannelPartitionHandler when polling the database
2 participants