Skip to content

Commit

Permalink
nit: keyerror exception handling (#35)
Browse files Browse the repository at this point in the history
There is a chance that remove_world in world_manager is called twice.
The funcall call removes a key from worlds_stores.
So, the second call leads to KeyError.
We currently can't ensure call the function only once because
the current remove_world is not clean due to a deadlock issue.
So, we mask the key error.
  • Loading branch information
myungjin authored Jul 18, 2024
1 parent d6bd887 commit fb8a6a7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions multiworld/world_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,13 @@ def remove_world(self, world_name):
self._communicator.remove_world(world_name)

logger.debug(f"remove {world_name} from world stores")
del self._worlds_stores[world_name]
try:
del self._worlds_stores[world_name]
except KeyError:
pass

logger.debug(f"destory process group for {world_name}")
# FIXME: the following two lindes of code here causes program hang.
# FIXME: the following two lines of code here causes program hang.
# we need to find out a right timing/way to call them.
# calling them is temporarily disabled.
# dist.destroy_process_group(name=world_name)
Expand Down

0 comments on commit fb8a6a7

Please sign in to comment.