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

[RLlib] TF2/eager memory leak fixes. #19198

Merged
merged 9 commits into from
Oct 8, 2021

Conversation

sven1977
Copy link
Contributor

@sven1977 sven1977 commented Oct 7, 2021

TF2/eager: Memory leak fix.

Why are these changes needed?

Issue #19233

Related issue number

Closes #19233

Checks

  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Comment on lines +759 to +763
if len(pre_batches) > 1:
other_batches = pre_batches.copy()
del other_batches[agent_id]
else:
other_batches = {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a comment here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not even sure this was necessary, but our new memory leak finder was nit-picky here. I'll leave it in and add a TODO comment to remove this once confirmed it's not causing an actual leak.

Copy link
Member

@gjoliver gjoliver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't actually understand why any of these would contribute to a memory leak ...
we may need better understanding / written practice of how to avoid memory leak for tf2.
let's get this commit in.

@gjoliver
Copy link
Member

gjoliver commented Oct 8, 2021

there seems to be a relevant test failure though.

hey @sven1977, are all these diffs really needed? since this is a cherry-pick commit, we may want to limit the diff to only the ones that contribute to that 1GB/2M step memory leak?

@@ -92,7 +92,7 @@ def test_ppo_compilation_and_schedule_mixins(self):
config["model"]["lstm_cell_size"] = 10
config["model"]["max_seq_len"] = 20
# Use default-native keras models whenever possible.
config["model"]["_use_default_native_models"] = True
# config["model"]["_use_default_native_models"] = True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this line necessary or just debugging?

@sven1977 sven1977 added the tests-ok The tagger certifies test failures are unrelated and assumes personal liability. label Oct 8, 2021
@sven1977 sven1977 changed the title [RLlib] Small memory leak fixes. [RLlib] TF2/eager memory leak fixes. Oct 8, 2021
@sven1977 sven1977 merged commit d439fd7 into ray-project:master Oct 8, 2021
gjoliver pushed a commit that referenced this pull request Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests-ok The tagger certifies test failures are unrelated and assumes personal liability.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RLlib Bug] EagerTFPolicy has a small memory leak in compute_actions methods.
3 participants