Skip to content

Dubbo throws exception when use java serializer #4612

Closed

Description

@qixiaobo

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

Activity

  1. chickenlj commented on Jul 22, 2019

    @chickenlj
    Contributor

    fixed by #4530

  2. chickenlj commented on Jul 22, 2019

    @chickenlj
    Contributor

    Has been released at 2.6.7

  3. qixiaobo commented on Jul 29, 2019

    @qixiaobo
    ContributorAuthor

    Has been released at 2.6.7

    You should say 2.6.x, maybe I think 2.6.8 will

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions