-
Notifications
You must be signed in to change notification settings - Fork 331
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
AddNetObject System.IndexOutOfRangeException: Index was outside the bounds of the array. #416
Comments
I started 10 clients of version 2021.5.25.2s, started a game on Skeld with the same settings as shown in your screenshot. After sabotaging the reactor and waiting for the cooldown to end, I clicked "Play again" on all clients, then finally clicked it on the host. All 10 players rejoined correctly. I even tried it multiple times with different endings, like sabotaging oxygen instead or by voting out the impostor. While I appreciate your clear steps, I'm unable to reproduce them on a clean checkout of the Impostor codebase (a13fee1). Next time please double check if your issues occur there too. |
That is very odd as I also tried it on a clean checkout of Impostor. Maybe it's something overloading my local network? For me it's 100% repro rate. |
Weird, I'm running into a different issue though when I have anticheat enabled, could you flip that option on your side and retest? Network overload could be an option, I'm testing against a server running on localhost. It may also be worth mentioning that I'm running everything on Linux. |
Just had my issue happen again with 4 players on Polus. I think it's a threading issue. I've changed it to use a concurrentdictionary for _allobjectsfast instead of a dictionary. Will see how that goes. |
Upon further testing, it seems that making _allobjectsfast a concurrent dictionary instead of a regular dictionary seems to have fixed the issue. So it seems as though it was a threading issue all along. |
Bug Report
Base Information
I confirm:
Symptoms
[14:04:47 ERR] Invoking data received failed System.IndexOutOfRangeException: Index was outside the bounds of the array. at System.Collections.Generic.Dictionary
2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)at System.Collections.Generic.Dictionary
2.Add(TKey key, TValue value) at Impostor.Server.Net.State.Game.AddNetObject(InnerNetObject obj) in Z:\GitHub\skeld.net 2.0\Impostor\src\Impostor.Server\Net\State\Game.Data.cs:line 404 at Impostor.Server.Net.State.Game.HandleGameDataAsync(IMessageReader parent, ClientPlayer sender, Boolean toPlayer) in Z:\GitHub\skeld.net 2.0\Impostor\src\Impostor.Server\Net\State\Game.Data.cs:line 169 at Impostor.Server.Net.Client.HandleMessageAsync(IMessageReader reader, MessageType messageType) in Z:\GitHub\skeld.net 2.0\Impostor\src\Impostor.Server\Net\Client.cs:line 177 at Impostor.Server.Net.Hazel.HazelConnection.ConnectionOnDataReceived(DataReceivedEventArgs e) in Z:\GitHub\skeld.net 2.0\Impostor\src\Impostor.Server\Net\Hazel\HazelConnection.cs:line 71 at Impostor.Hazel.Connection.InvokeDataReceived(MessageReader msg, MessageType messageType) in Z:\GitHub\skeld.net 2.0\Impostor\src\Impostor.Hazel\Hazel\Connection.cs:line 185
Reproduction
100% repro rate. Have 10 clients connected, have the game end, then click Play Again on all clients. Make sure host is the last to click Play Again. They all try to spawn in, and then the symptoms start.
The text was updated successfully, but these errors were encountered: