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-2031] Fix hessian2 serialization infinit recursion(StackOverflowError) when object's writeReplace method returns the object itself #2032

Closed
wants to merge 1 commit into from

Conversation

nobodyiam
Copy link
Contributor

What is the purpose of the change

Fix #2031

Brief changelog

When the object's writeReplace return itself, then just serialize it as the normal object. No need to do another recursive call, which will cause infinite recursion.

Verifying this change

Check the newly added unit test case: Hessian2WriteReplaceTest.java

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a GITHUB_issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a GITHUB issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [Dubbo-XXX] Fix UnknownException when host config not exist #XXX. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn clean install -DskipTests & mvn clean test-compile failsafe:integration-test to make sure unit-test and integration-test pass.
  • If this contribution is large, please follow the Software Donation Guide.

… object's writeReplace method returns the object itself.
@codecov-io
Copy link

Codecov Report

Merging #2032 into 2.5.x will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##            2.5.x    #2032      +/-   ##
==========================================
+ Coverage   28.42%   28.43%   +<.01%     
==========================================
  Files         791      791              
  Lines       41736    41737       +1     
  Branches     8529     8530       +1     
==========================================
+ Hits        11863    11866       +3     
+ Misses      27799    27794       -5     
- Partials     2074     2077       +3
Impacted Files Coverage Δ
.../alibaba/com/caucho/hessian/io/JavaSerializer.java 69.27% <100%> (+5.39%) ⬆️
...om/alibaba/dubbo/rpc/filter/ActiveLimitFilter.java 83.33% <0%> (-5.56%) ⬇️
...mon/serialize/support/dubbo/GenericDataOutput.java 66.66% <0%> (-4.22%) ⬇️
...ba/dubbo/remoting/transport/netty/NettyServer.java 68.42% <0%> (-3.51%) ⬇️
...mmon/serialize/support/dubbo/GenericDataInput.java 59.45% <0%> (-2.32%) ⬇️
...ibaba/com/caucho/hessian/io/SerializerFactory.java 61.2% <0%> (+0.71%) ⬆️
.../alibaba/com/caucho/hessian/io/Hessian2Output.java 24.22% <0%> (+0.86%) ⬆️
...libaba/com/caucho/hessian/util/IdentityIntMap.java 39.28% <0%> (+8.33%) ⬆️

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 430fb4c...b372577. Read the comment docs.

@lovepoem
Copy link
Member

lovepoem commented Jul 5, 2018

https://github.com/dubbo/hessian-lite alse need ix

@nobodyiam
Copy link
Contributor Author

@lovepoem

Thanks for reminding me, I just opened a pr for hessian-lite project: apache/dubbo-hessian-lite#1

@chickenlj chickenlj added this to the 2.6.3 milestone Jul 9, 2018
@lovepoem
Copy link
Member

lovepoem commented Jul 13, 2018

apache/dubbo-hessian-lite#1 was merged

And 2.5.x and 2.6.x will remove hessian-lite module via #2074 and #2073 , use https://github.com/dubbo/hessian-lite directly. so close this pr

If milestone 2.6.3 will use this feature, should release https://github.com/dubbo/hessian-lite, and upgrade the hessian-lite version of 2.5.x and 2.6.x branches

@lovepoem lovepoem closed this Jul 13, 2018
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.

None yet

4 participants