Race condition with `onAuth()` rejection
See original GitHub issueIf the Colyseus server’s room throws a custom application error or returns false from onAuth()
, the Colyseus Unity client sometimes hangs and gets no response.
eg. The below Unity client snippet sometimes never prints either of "Joined room successfully"
or "Error joining room"
.
Client colyseusClient = new Client(COLYSEUS_URL);
Room<GameState> newColyseusRoom;
try {
Debug.Log("Joining room...");
newColyseusRoom = await colyseusClient.JoinOrCreate<GameState>("GameRoom", options);
Debug.Log("Joined room successfully");
} catch (Exception e) {
Debug.Log("Error joining room");
}
With the server snippet:
export default class GameRoom extends Room<GameState> {
onAuth(_client: Client, _options: any): Promise<boolean> {
return false;
}
}
Colyseus Unity client version: 0.13.2
Colyseus Unity server version: 0.13.7
Possibly related:
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
Race Condition - HackTricks
The problem appears when you accept it and automatically sends an authorization_code to the malicious application. Then, this application abuses ...
Read more >Race condition when refreshing access tokens in a web ...
One thing I would have expected is that the OIDC Provider rejects the refresh token used for the second refresh process - whichever...
Read more >Race Conditions in OAuth 2 API implementations | ...
Most of OAuth 2 API implementations seem to have multiple Race Condition vulnerabilities for processing requests for Access Token or Refresh Token.
Read more >How to solve race condition for refresh api token during ...
The problem is that if there are 5 async calls to refresh token endpoint, then we end with desynced, invalid token in our...
Read more >Best practice/solution to handle OAUTH access token ...
Multiple calls to refresh the token will result in a failure because the first request will invalidate the others aka 'race condition'.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@endel I’ve verified that the current master branch resolves this issue: https://github.com/rnd256/minimal-colyseus/tree/onauth-rejection-race-condition-2020-10-11-master-branch
(I can’t comment about performance though, which is something you were worried about before)
FYI I didn’t mean to indicate that I thought one of #118 and #119 was better than the other. #119 just happened to be the one I tested.
@endel unfortunately I’m not well-equipped to measure latency either (my game is not particularly latency-sensitive). Or were you just asking that I verify that the alpha branch fixes this bug?