You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use golang-jwt/jwt/v4@v4.4.3 to parse jwt string to struct by ParseWithClaims. Our service have 1350 req/sec at peak time. So I monitoring the pods memory and visualize its by grafana see below
After that I dump the heap profiling from our services and visualize its by go tool pprof and selected the sample to inuse_space. Pls See below
Thanks for the detailed issue. Can you please provide more details on the Keyfunc you're passing to ParseWithClaims. Is it as you have written it as a config.secret, or is there a more involved implementation?
Also, are you using custom claims and embedding those provided by this package?
Ideally, I'd like to reproduce this locally to mimic your environment as much as possible.
Now, I already solve this problem. Let's me explain it. In my case I used this as internal service that will received the jwt token from other internal service so when it used it internal decided to ignore error when secret is invalid. So when I fix it by update the secret to correct secret the memory did not leak. But, I still have a question why when I ParseWithClaims and ignore the error it will got memory leak. You can reproduce by heavy call ParseWithClaims function with invalid secret you will found the heap memory leak on pprof report.
Is ParseWithClaims function make a memory leak ?
I use
golang-jwt/jwt/v4@v4.4.3
to parse jwt string to struct by ParseWithClaims. Our service have1350 req/sec
at peak time. So I monitoring the pods memory and visualize its by grafana see belowAfter that I dump the
heap profiling
from our services and visualize its bygo tool pprof
and selected the sample toinuse_space
. Pls See belowGraph view
Source View
My implemented code. See below
The text was updated successfully, but these errors were encountered: