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

[Bug Fix] Fix crash if spawn is delayed in multi-env #4872

Merged
merged 5 commits into from
Jan 22, 2021

Conversation

vincentpierre
Copy link
Contributor

Proposed change(s)

In an environment with 2 behaviors, if one behavior randomly spawns after some time, training with multiple environments can cause a crash.
The reason is that we try to get the behavior specs from the first environment and there is a chance the later behavior is not yet spawned in this environment. I modified the code to take an aggreate of the behavior specs of all of the environments. I tested my fix on a custom environment.

I do not know how to write a test for this bug since it involves multi environment, multi behavior with random spawning of behaviors. I am open to suggestions.

Useful links (Github issues, JIRA tickets, ML-Agents forum threads etc.)

Types of change(s)

  • Bug fix
  • New feature
  • Code refactor
  • Breaking change
  • Documentation update
  • Other (please describe)

Checklist

  • Added tests that prove my fix is effective or that my feature works
  • Updated the changelog (if applicable)
  • Updated the documentation (if applicable)
  • Updated the migration guide (if applicable)

Other comments

@vincentpierre vincentpierre self-assigned this Jan 20, 2021
@ervteng
Copy link
Contributor

ervteng commented Jan 21, 2021

I think for a test - you could do a test just for training_behaviors, something very similar to the test_reset_collects_results_from_all_envs in test_subprocess_env_manager.py. It just tests that it calls the EnvironmentCommand for all workers. We have unit tests that test that training_behaviors is called, so we just need to test that calling it does the right thing.

Copy link
Contributor

@ervteng ervteng left a comment

Choose a reason for hiding this comment

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

🚢 with test

@vincentpierre vincentpierre merged commit fd0e092 into master Jan 22, 2021
@delete-merged-branch delete-merged-branch bot deleted the fix-numti-env-delayed-spawn branch January 22, 2021 19:22
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants