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

Inform messages must be restricted in layer effects (ConcurrentModificationException and other errors) #13278

Open
4 tasks
JayDi85 opened this issue Feb 1, 2025 · 0 comments
Assignees
Labels
bug Bugs and errors enhancement

Comments

@JayDi85
Copy link
Member

JayDi85 commented Feb 1, 2025

Related to #11285

Some layer effects (ContinuousEffect) can send client side messages:

  • looked at all cards;
  • combat removes on transform;
  • day/night;
  • rules modifications, etc.

It can potentially break game and raise random errors like ConcurrentModificationException.

There are few potentially failure points:

  1. informMessages call inside layer effects will send unfinished battlefield data to client side (in the middle of the apply effects logic);
  2. Block game state and raise random ConcurrentModificationException due race conditional (if message sending thread get access to game data faster than ApplyEffects finished). The slower the game, the greater the chance for error.

I added runtime check and todos for such use cases in d757923, but it slow and must be enabled for debugging/testing only.

TODOs:

  • remove all informMessages inside layer effects or rework sending logic like simultaneousEvents does (collect all messages in single list and send after game cycle completed);
  • research and make sure message sending code get access to copied game only, not original;
  • make sure both fixes works fine and do not conflicts with each other (possible bug after fix: send really copied and unfinished data to a client side);
  • add server side commands line param to enable strict checks on informMessages with error logs and run it on production for research (how many errors in real games);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs and errors enhancement
Projects
None yet
Development

No branches or pull requests

1 participant