-
-
Notifications
You must be signed in to change notification settings - Fork 435
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
Remove null keys/values before creating concurrent hashmap #2708
Conversation
Hey @romtsn and @adinauer, Could the same thing potentially happen with the tags? |
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
d25f425 | 304.04 ms | 360.30 ms | 56.26 ms |
cc2c183 | 285.52 ms | 340.71 ms | 55.19 ms |
5770a02 | 326.89 ms | 361.60 ms | 34.71 ms |
b5ce73a | 299.49 ms | 336.00 ms | 36.51 ms |
f0de9d9 | 284.78 ms | 325.86 ms | 41.08 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
d25f425 | 1.72 MiB | 2.28 MiB | 565.47 KiB |
cc2c183 | 1.72 MiB | 2.28 MiB | 565.47 KiB |
5770a02 | 1.72 MiB | 2.28 MiB | 565.47 KiB |
b5ce73a | 1.72 MiB | 2.28 MiB | 565.54 KiB |
f0de9d9 | 1.72 MiB | 2.28 MiB | 565.47 KiB |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #2708 +/- ##
============================================
- Coverage 81.07% 81.07% -0.01%
- Complexity 4432 4434 +2
============================================
Files 345 345
Lines 16358 16363 +5
Branches 2219 2221 +2
============================================
+ Hits 13263 13267 +4
Misses 2167 2167
- Partials 928 929 +1
☔ View full report in Codecov by Sentry. |
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.
Another possible solution would be to just surround it with try/catch and not adding any extras.
I'd prefer keeping as much data as possible.
I think moving the null
stripping into CollectionUtils
makes sense.
@@ -444,6 +445,15 @@ public boolean deserializeValue( | |||
return true; | |||
case JsonKeys.EXTRA: | |||
Map<String, Object> deserializedExtra = (Map<String, Object>) reader.nextObjectOrNull(); | |||
if (deserializedExtra != null) { |
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.
Should we do this in CollectionUtils.newConcurrentHashMap
to apply to all places? I presume this problem could happen anywhere we create a ConcurrentHashMap
.
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.
Yeah, I think that would make sense.
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
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
- Remove null keys/values before creating concurrent hashmap ([#2708](https://github.com/getsentry/sentry-java/pull/2708)) If none of the above apply, you can opt out of this check by adding |
📜 Description
Cleanup null values from deserialised extra map before creating a
ConcurrentHashMap
from it.ConcurrentHashMap
cannot handle null keys or values💡 Motivation and Context
Fixes #2681
💚 How did you test it?
📝 Checklist
sendDefaultPII
is enabled.🔮 Next steps