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

Dubbo throws exception when use java serializer #4613

Merged
merged 1 commit into from
Jul 22, 2019

Conversation

qixiaobo
Copy link
Contributor

The same problem like 2.6.x.
issues:
#3951
#3698

related-pr:
#2656

Since we have no reason make the method first line before decode!

We can see code from @liangfei0201 below

 // decode request.
            Request req = new Request(id);
            req.setVersion("2.0.0");
            req.setTwoWay((flag & FLAG_TWOWAY) != 0);
            if ((flag & FLAG_EVENT) != 0) {
                req.setEvent(Request.HEARTBEAT_EVENT);
            }
            try {
                Object data;
                if (req.isHeartbeat()) {
                    data = decodeHeartbeatData(channel, deserialize(s, channel.getUrl(), is));
                } else if (req.isEvent()) {
                    data = decodeEventData(channel, deserialize(s, channel.getUrl(), is));
                } else {
                    DecodeableRpcInvocation inv;
                    if (channel.getUrl().getParameter(
                        Constants.DECODE_IN_IO_THREAD_KEY,
                        Constants.DEFAULT_DECODE_IN_IO_THREAD)) {
                        inv = new DecodeableRpcInvocation(channel, req, is, proto);
                        inv.decode();
                    } else {
                        inv = new DecodeableRpcInvocation(channel, req,
                                                          new UnsafeByteArrayInputStream(readMessageData(is)), proto);
                    }
                    data = inv;
                }
                req.setData(data);
            } catch (Throwable t) {
                if (log.isWarnEnabled()) {
                    log.warn("Decode request failed: " + t.getMessage(), t);
                }
                // bad request
                req.setBroken(true);
                req.setData(t);
            }
            return req;

This code works well for java serializer.
We can see no call for method deserialize before DecodeableRpcInvocation.
#4530

@codecov-io
Copy link

Codecov Report

Merging #4613 into master will increase coverage by <.01%.
The diff coverage is 50%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #4613      +/-   ##
============================================
+ Coverage     64.16%   64.17%   +<.01%     
  Complexity      452      452              
============================================
  Files           768      768              
  Lines         32873    32875       +2     
  Branches       5181     5181              
============================================
+ Hits          21093    21097       +4     
+ Misses         9363     9361       -2     
  Partials       2417     2417
Impacted Files Coverage Δ Complexity Δ
...rg/apache/dubbo/rpc/protocol/dubbo/DubboCodec.java 57.28% <50%> (-1.14%) 0 <0> (ø)
.../apache/dubbo/qos/protocol/QosProtocolWrapper.java 69.23% <0%> (-12.83%) 0% <0%> (ø)
...onfig/spring/extension/SpringExtensionFactory.java 80.48% <0%> (-4.88%) 0% <0%> (ø)
...he/dubbo/registry/multicast/MulticastRegistry.java 67.87% <0%> (-1.81%) 0% <0%> (ø)
.../dubbo/remoting/transport/netty4/NettyChannel.java 64.7% <0%> (-1.18%) 0% <0%> (ø)
...g/apache/dubbo/registry/consul/ConsulRegistry.java 61.87% <0%> (-0.63%) 29% <0%> (ø)
...exchange/support/header/HeaderExchangeHandler.java 67.21% <0%> (+2.45%) 0% <0%> (ø) ⬇️
.../apache/dubbo/remoting/transport/AbstractPeer.java 67.39% <0%> (+4.34%) 0% <0%> (ø) ⬇️
.../org/apache/dubbo/remoting/ExecutionException.java 21.05% <0%> (+5.26%) 0% <0%> (ø) ⬇️
...ng/transport/dispatcher/all/AllChannelHandler.java 57.14% <0%> (+5.71%) 0% <0%> (ø) ⬇️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9960d23...27189ed. Read the comment docs.

Copy link
Member

@beiwei30 beiwei30 left a comment

Choose a reason for hiding this comment

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

LGTM.

@beiwei30
Copy link
Member

@qixiaobo would you mind to double check if the same issue still exists on 2.6.x branch?

@beiwei30 beiwei30 merged commit a5e3f54 into apache:master Jul 22, 2019
@qixiaobo
Copy link
Contributor Author

@qixiaobo would you mind to double check if the same issue still exists on 2.6.x branch?
Yeah,I will check. I make pull request here #4530.
We use dubbo 2.6.x most.

@beiwei30
Copy link
Member

ok, it's been merged already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants