sqld icon indicating copy to clipboard operation
sqld copied to clipboard

JWT expiration issue?

Open penberg opened this issue 2 years ago • 2 comments

Dan Kochetov of Drizzle team reports that:

Something weird happens now. Using the non-expiry token randomly returns the "Client is closed" error, but when I restart the server it works fine again. Maybe related to the fact that I've generated a 2nd non-expiry token and try to use the new one when the old one fails, which always seem to work, and after that the old one starts to work as well.

Let's look into how multiple JWT tokens might cause this to happen.

penberg avatar Mar 31 '23 19:03 penberg

I don't think this is the problem, but just to share my observations:

I have been looking at the code and one crazy idea is the logic to mitigate clock skew in the JWT validation library code: https://github.com/Keats/jsonwebtoken/blob/master/src/validation.rs#L38 That is, a token has additional 60 seconds leeway by default (and we use the default). So as the token is expiring, there is a ~60 second window where the token might be expired or not expired, if there's some clock skew. But it does seem very unlikely that you hit this.

penberg avatar Mar 31 '23 19:03 penberg

Is that still an issue @penberg ?

MarinPostma avatar Aug 28 '23 13:08 MarinPostma