Skip to content
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

Fix thrift deserializer thread safety issue #9299

Merged
merged 1 commit into from
Aug 30, 2022

Conversation

saurabhd336
Copy link
Contributor

@saurabhd336 saurabhd336 commented Aug 30, 2022

InstanceRequestHandler is being shared across multiple netty channels (and potentially different event loop threads), therefore it's channelRead0 function needs to be thread safe. TDeserializer instances are not thread safe hence each thread needs a ThreadLocal copy of it.

@saurabhd336 saurabhd336 force-pushed the thriftDeserializerFix branch from 83695ec to 024d8d9 Compare August 30, 2022 11:24
@codecov-commenter
Copy link

Codecov Report

Merging #9299 (a721620) into master (d1a71d8) will decrease coverage by 34.82%.
The diff coverage is 60.00%.

❗ Current head a721620 differs from pull request most recent head 024d8d9. Consider uploading reports for the commit 024d8d9 to get more accurate results

@@              Coverage Diff              @@
##             master    #9299       +/-   ##
=============================================
- Coverage     69.82%   35.00%   -34.83%     
+ Complexity     4696      183     -4513     
=============================================
  Files          1873     1873               
  Lines         99623    99623               
  Branches      15146    15146               
=============================================
- Hits          69564    34871    -34693     
- Misses        25118    61789    +36671     
+ Partials       4941     2963     -1978     
Flag Coverage Δ
integration1 26.09% <60.00%> (-0.12%) ⬇️
integration2 ?
unittests1 ?
unittests2 15.30% <0.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...e/pinot/core/transport/InstanceRequestHandler.java 39.84% <60.00%> (-25.00%) ⬇️
...in/java/org/apache/pinot/spi/utils/BytesUtils.java 0.00% <0.00%> (-100.00%) ⬇️
.../java/org/apache/pinot/spi/utils/BooleanUtils.java 0.00% <0.00%> (-100.00%) ⬇️
...java/org/apache/pinot/spi/trace/BaseRecording.java 0.00% <0.00%> (-100.00%) ⬇️
...java/org/apache/pinot/spi/trace/NoOpRecording.java 0.00% <0.00%> (-100.00%) ⬇️
...ava/org/apache/pinot/spi/config/table/FSTType.java 0.00% <0.00%> (-100.00%) ⬇️
...ava/org/apache/pinot/spi/config/user/RoleType.java 0.00% <0.00%> (-100.00%) ⬇️
...ava/org/apache/pinot/spi/data/MetricFieldSpec.java 0.00% <0.00%> (-100.00%) ⬇️
...ava/org/apache/pinot/spi/utils/NullValueUtils.java 0.00% <0.00%> (-100.00%) ⬇️
...java/org/apache/pinot/common/tier/TierFactory.java 0.00% <0.00%> (-100.00%) ⬇️
... and 1083 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -73,7 +73,7 @@ public class InstanceRequestHandler extends SimpleChannelInboundHandler<ByteBuf>
private static final int SLOW_QUERY_LATENCY_THRESHOLD_MS = 100;

private final String _instanceName;
private final TDeserializer _deserializer;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 good catch! perhaps a comment that this is not thread safe.

Copy link
Contributor

@walterddr walterddr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

Copy link
Contributor

@Jackie-Jiang Jackie-Jiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@Jackie-Jiang Jackie-Jiang merged commit d0b4f23 into apache:master Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants