JWT expiration issue?
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.
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.
Is that still an issue @penberg ?