-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Conversation
83695ec
to
024d8d9
Compare
Codecov Report
@@ 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
Flags with carried forward coverage won't be shown. Click here to find out 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; |
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.
👍 good catch! perhaps a comment that this is not thread safe.
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.
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.
Good catch!
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.