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] KeyNotFoundException exception in garbage collector #175

Open
rnd256 opened this issue Oct 1, 2021 · 2 comments
Open

[Bug] KeyNotFoundException exception in garbage collector #175

rnd256 opened this issue Oct 1, 2021 · 2 comments

Comments

@rnd256
Copy link
Contributor

rnd256 commented Oct 1, 2021

Colyseus Unity3d version: 0.14.8 (latest). It also occurs with version 0.14.7. I haven't tested other versions.
Colyseus server version: 0.14.23 (latest).

Occasionally, after removing a Schema object from a MapSchema, this line throws the error "KeyNotFoundException: The given key was not present in the dictionary":
https://github.com/colyseus/colyseus-unity3d/blob/f80f7f402ad2e51c4ebad59db389c0b4d05ee1ad/Assets/Colyseus/Runtime/Scripts/Serializer/Schema/ColyseusReferenceTracker.cs#L85

If I continue to play my game after this error, I eventually hit a "refId not found" error as well:
https://github.com/colyseus/colyseus-unity3d/blob/f80f7f402ad2e51c4ebad59db389c0b4d05ee1ad/Assets/Colyseus/Runtime/Scripts/Serializer/Schema/Schema.cs#L399

This makes me think that there's some step where a Schema within a MapSchema isn't properly getting added to refCounts and refs in the Unity3d client.

@rnd256
Copy link
Contributor Author

rnd256 commented Oct 1, 2021

My temporary workaround is to completely disable the garbage collector by commenting out this line:

https://github.com/colyseus/colyseus-unity3d/blob/f80f7f402ad2e51c4ebad59db389c0b4d05ee1ad/Assets/Colyseus/Runtime/Scripts/Serializer/Schema/Schema.cs#L648

That seems to prevent both of the above errors.

@endel
Copy link
Member

endel commented Oct 12, 2022

It seems this issue has some connection to this one, which has been (hopefully) fixed here: colyseus/colyseus#495 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants