dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

Discuss the full replacement of fastjson with fastjson v2 in Dubbo 3.1

Open CrazyHZM opened this issue 2 years ago • 10 comments

The security issues of FastJson v1 continued, causing trouble for some users of Dubbo, At present, FastJson has released the v2 version and solved the security risks in the v1 version. v2: https://github.com/alibaba/fastjson2 In addition, v2 also brings performance improvements. So I propose to replace the v1 version with the v2 version in the 3.1 version. Reason for replacement in version 3.1: considering the compatibility issues of some users.

CrazyHZM avatar May 24 '22 02:05 CrazyHZM

Dubbo has both gson and fastjson dependencies, It is better to keep only one left.

guohao avatar May 24 '22 03:05 guohao

I choose Jackson, but because gson already exists in the project, I choose gson

EarthChen avatar May 24 '22 04:05 EarthChen

How about make an Json interface, and take fastjson, gson, jackson etc as provider implemented the interface, then user could choose it by json provider name configuration?

cheese8 avatar May 24 '22 06:05 cheese8

In addition, Dubbo uses JSON serialization in two places, one is the SPI extension that provides JSON serialization, and the second is the serialization on the core link, such as the JSON serialization of metadata

CrazyHZM avatar May 24 '22 06:05 CrazyHZM

Could I take this issue? @CrazyHZM

cheese8 avatar May 25 '22 03:05 cheese8

Could I take this issue? @CrazyHZM

Let's wait for more ideas.

CrazyHZM avatar May 25 '22 06:05 CrazyHZM

FASTJSON2 is a new implement for json format, we should test the compatiblity of it.

kimmking avatar May 28 '22 22:05 kimmking

FastJson2 will support JDK17 natively, while hessian only support JDK11 and should open jdk module in JDK17 for compatible purpose. Also, Fastjson2 has a high performance gain compared to hessian. We can consider replace hessian to fastjson2 in the future.

AlbumenJ avatar Jun 10 '22 07:06 AlbumenJ

I tried to adapt fastjson2 to Dubbo as the default serializer. All unit test cases pass. Integration tests fail due to package issues. Refer https://github.com/albumenj/dubbo/tree/0424_jdk_17

AlbumenJ avatar Jun 10 '22 07:06 AlbumenJ

gson is much better.

TinyZzh avatar Aug 01 '22 05:08 TinyZzh