nov / json-jwt

JSON Web Token and its family (JSON Web Signature, JSON Web Encryption and JSON Web Key) in Ruby
MIT License
299 stars 80 forks source link

Thread safety? #50

Closed FranklinYu closed 6 years ago

FranklinYu commented 7 years ago

For example, given a $jwk which is a JSON::JWK::Set, would there be race condition when multiple threads do JSON::JWT.decode(token, $jwk) simultaneously?

nov commented 7 years ago

why did you think so?

FranklinYu commented 7 years ago

I didn't "think so"; I was just wondering whether thread safety was in mind when developing this library, because (surprisingly?) not every library author would like to consider such cases. Some would even explicitly state in README like

This library is not meant for threaded Ruby applications

, so race condition is not considered bug there. It is not obvious what is mutated in each method, and I would like to double check before I optimize the production code.