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
No longer serialize static fields; use toString as fallback #2309
Conversation
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
221a5df | 350.61 ms | 391.58 ms | 40.97 ms |
4ca1d7b | 328.46 ms | 368.22 ms | 39.76 ms |
54cebc8 | 331.12 ms | 385.14 ms | 54.02 ms |
54cebc8 | 300.86 ms | 341.43 ms | 40.57 ms |
2c5f172 | 310.20 ms | 357.16 ms | 46.96 ms |
2c5f172 | 289.18 ms | 307.56 ms | 18.38 ms |
7300956 | 324.20 ms | 353.79 ms | 29.58 ms |
c5ccd8a | 329.98 ms | 365.52 ms | 35.54 ms |
d4087ee | 278.00 ms | 313.86 ms | 35.86 ms |
4ca1d7b | 331.33 ms | 335.78 ms | 4.45 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
221a5df | 1.73 MiB | 2.29 MiB | 581.39 KiB |
4ca1d7b | 1.73 MiB | 2.29 MiB | 579.88 KiB |
54cebc8 | 1.73 MiB | 2.29 MiB | 579.43 KiB |
54cebc8 | 1.73 MiB | 2.29 MiB | 579.43 KiB |
2c5f172 | 1.73 MiB | 2.29 MiB | 580.10 KiB |
2c5f172 | 1.73 MiB | 2.29 MiB | 580.10 KiB |
7300956 | 1.73 MiB | 2.29 MiB | 578.69 KiB |
c5ccd8a | 1.74 MiB | 2.33 MiB | 607.44 KiB |
d4087ee | 1.73 MiB | 2.29 MiB | 579.50 KiB |
4ca1d7b | 1.73 MiB | 2.29 MiB | 579.88 KiB |
Previous results on branch: fix/locale-serialization
Startup times
Revision | Plain | With Sentry | Diff |
---|---|---|---|
7b8722b | 355.58 ms | 386.42 ms | 30.84 ms |
2d20f2d | 309.22 ms | 351.43 ms | 42.21 ms |
f38142c | 294.94 ms | 370.86 ms | 75.92 ms |
97a2d6f | 326.71 ms | 369.06 ms | 42.35 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
7b8722b | 1.73 MiB | 2.29 MiB | 581.28 KiB |
2d20f2d | 1.73 MiB | 2.32 MiB | 607.79 KiB |
f38142c | 1.73 MiB | 2.32 MiB | 607.42 KiB |
97a2d6f | 1.73 MiB | 2.32 MiB | 607.82 KiB |
GSON handles this by having |
I agree going with explicit |
@stefanosiano there's Only doing the conversions in Should we add them to both? |
sentry/src/main/java/io/sentry/JsonReflectionObjectSerializer.java
Outdated
Show resolved
Hide resolved
@adinauer yeah, i meant explicitly handling the |
Codecov ReportBase: 80.09% // Head: 80.13% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #2309 +/- ##
============================================
+ Coverage 80.09% 80.13% +0.03%
- Complexity 3431 3443 +12
============================================
Files 242 242
Lines 12756 12789 +33
Branches 1703 1714 +11
============================================
+ Hits 10217 10248 +31
- Misses 1890 1891 +1
- Partials 649 650 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
I assume it's sufficient to duplicate the simpler serialization stuff into |
I've updated the code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@stefanosiano do you want to take another look or can I go ahead and merge? |
fixture.getSUT().serialize(fixture.writer, fixture.logger, calendar) | ||
verify(fixture.writer).beginObject() | ||
verify(fixture.writer).name("year") | ||
verify(fixture.writer).value(2022L as java.lang.Long) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2022L should be enough, shouldn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It didn't like that. I assume it's some mockito kotlin / java interop thing.
📜 Description
Skip
static
fields when serializing objects using reflection and usetoString()
as a fallback in case there were no fields on the object.💡 Motivation and Context
Serializing something like
Locale
caused OOM as listing its static fields contained references to other localesthat in turn referenced back(this is actually handled by our circular reference detection) causing an infinite loop. The real problem seems to come from each locale then also dragging in several other things that are costly to serialize.Fixes #2301
💚 How did you test it?
Unit Tests
📝 Checklist
🔮 Next steps