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

Multi Threaded update to List of TriggeredAbilities - Why and how to avoid? #966

Closed
LevelX2 opened this issue May 14, 2015 · 2 comments
Closed
Labels

Comments

@LevelX2
Copy link
Contributor

@LevelX2 LevelX2 commented May 14, 2015

BetaSteward reverted the list of triggeredabilities recently back to HashMap from ConcurrentHashMap with this commit: fcb9bc9.

Now again the ConcurrentModificationExceptions happen on servers.
http://www.slightlymagic.net/forum/viewtopic.php?f=70&t=17186&p=178870#p178870
http://www.slightlymagic.net/forum/viewtopic.php?f=70&t=17186&start=30#p179083

First issue was #473.

Checking for the reason is needed and resolving the issue in one or the other way.

@BetaSteward
Copy link
Contributor

@BetaSteward BetaSteward commented May 18, 2015

I did a lot of tests without ConcurrentHashMap and I didn't get any errors. I guess that there might be some cases were the TriggeredAbilities list is modified while it is being traversed. This could throw a ConcurrentModificationException.

I think it should be fine to change it back to ConcurrentHashMap. The performance saving is not that great.

@LevelX2
Copy link
Contributor Author

@LevelX2 LevelX2 commented May 18, 2015

I assume there are triggered abilities that add triggered abilites that cause this problem. So probably the update won't be caused by another thread. But I'm not sure because the ability will only be put onto the stack on not resolve yet.

Chnaged it back to ConcurrentHashMap.

@LevelX2 LevelX2 closed this in 27cbe6a May 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants