-
-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak in 4.13.2 #157
Comments
@Lukasa are you aware of any issues with BoringSSL around memory usage? |
This isn't a BoringSSL issue, it is a JWTKit issue. Note that the patch that updated BoringSSL also tweaked the behaviour of the e05513b#diff-9ac49656898ca44bb3cec2fde11a7146c77fd06a2d23bbaf849354c3ab5356dc This change introduced a memory safety issue that probably also introduced a memory leak. Specifically, the type of Is there a reason this library can't cut over to Crypto now that we support RSA? |
@Lukasa we're already using SwiftCrypto in version 5 (which is in beta), we're keeping version 4 for compatibility reasons |
@owainhunt closing this after #158 but feel free to reopen if the issue isn't resolved |
@ptoffy not resolved, sadly. If anything, 4.13.3 leaks more than 4.13.2. Charts here are the same test (100rps) using 4.13.1, 4.13.2 and 4.13.3. |
This line is now at fault:
This returns a retained RSA pointer ( I recommend making
This will appropriately keep |
This is a legacy branch, so we're just gonna change |
@owainhunt As before, please let us know if the issue still isn't resolved! |
As an aside - that average memory use for the app is insane 😆 |
That's long been one of Swift's great strengths. Very svelte. |
Describe the issue
After upgrading from JWTKit 4.13.1 to 4.13.2, memory use grows linearly with traffic
Vapor version
4.92.5
Operating system and version
Ubuntu Linux 22.04
Swift version
5.10
Steps to reproduce
Update JWTKit from 4.13.1 to 4.13.2. The only change in this version is a bump of the bundled BoringSSL.
Outcome
Memory usage increases with traffic. Graph attached shows memory use before and after reverting from 4.13.2 to 4.13.1, and the traffic over the same period. You can see that memory increases in line with traffic, so the increase slows overnight while traffic is lower. The sharp drops are pods being killed for OOM.
Additional notes
We are using jemalloc.
We have many similar apps, which use JWTKit in two ways:
In both cases, we're using RS256 keys.
All our apps have exhibited this behaviour when updating to 4.13.2, and it's resolved by reverting back to 4.13.1.
This behaviour has been observed on both Swift 5.9.2 and 5.10, Ubuntu 22.04 and 20.04, and against multiple versions of Vapor.
Also discussed on this thread on the Vapor Discord: https://discord.com/channels/431917998102675485/1227934412595925033
The text was updated successfully, but these errors were encountered: