[Bug] not support none serializable class org.apache.dubbo.rpc.model.ProviderModel
- Dominant language
- Java
- Stars
- 41.6k
- Forks
- 26.4k
- Avg merge
- 15h 13m
- Merged PRs (30d)
- 4
Description
### Pre-check
- [X] I am sure that all the content I provide is in English.
### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no similar issues.
### Apache Dubbo Component
Java SDK (apache/dubbo)
### Dubbo Version

```
17
2022.0.0
2022.0.0.0
3.0.2
3.2.10
5.0.0
```
默认序列化是fastjson2
fastjson2 version: 2.0.47
### Steps to reproduce this issue
interface
```
public interface OperationLogDubboService {
Result addLog(AddRecordTO addRecord);
}
@Data
public class Result implements Serializable {
private static final long serialVersionUID = -7971660878293684618L;
private String message;
private Boolean success;
private Integer code;
private T data;
}
```
### What you expected to happen
The dubbo rpc invoke success, but throw these errors below:
dubbo接口调用成功了,但是会报下面的异常:
不知道是dubbo问题还是fastjson2问题
```
[]2024-03-12T10:00:52.283+08:00 ERROR 26542 --- [DubboServerHandler-192.168.5.235-thread-1] o.a.d.r.p.i.DefaultParamDeepCopyUtil : [DUBBO] Unable to deep copy parameter to target class., dubbo version: 3.2.10, current host: 192.168.5.235, error code: 4-6. This may be caused by , go to https://dubbo.apache.org/faq/4/6 to find instructions.
java.io.IOException: org.apache.dubbo.common.serialize.SerializationException: com.alibaba.fastjson2.JSONException: not support none serializable class org.apache.dubbo.rpc.model.ProviderModel
at org.apache.dubbo.common.serialize.DefaultSerializationExceptionWrapper.handleToIOException(DefaultSerializationExceptionWrapper.java:353)
at org.apache.dubbo.common.serialize.DefaultSerializationExceptionWrapper.access$000(DefaultSerializationExceptionWrapper.java:27)
at org.apache.dubbo.common.serialize.DefaultSerializationExceptionWrapper$ProxyObjectOutput.writeObject(DefaultSerializationExceptionWrapper.java:319)
at org.apache.dubbo.rpc.protocol.injvm.DefaultParamDeepCopyUtil.copy(DefaultParamDeepCopyUtil.java:49)
at org.apache.dubbo.rpc.protocol.injvm.InjvmInvoker.rebuildValue(InjvmInvoker.java:332)
at org.apache.dubbo.rpc.protocol.injvm.InjvmInvoker.lambda$doInvoke$0(InjvmInvoker.java:155)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run$$$capture(CompletableFuture.java:1768)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at org.apache.dubbo.common.threadlocal.InternalRunnable.run(InternalRunnable.java:39)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.apache.dubbo.common.serialize.SerializationException: com.alibaba.fastjson2.JSONException: not support none serializable class org.apache.dubbo.rpc.model.ProviderModel
... 12 common frames omitted
Caused by: com.alibaba.fastjson2.JSONException: not support none serializable class org.apache.dubbo.rpc.model.ProviderModel
at com.alibaba.fastjson2.writer.ObjectWriterAdapter.errorOnNoneSerializable(ObjectWriterAdapter.java:682)
at com.alibaba.fastjson2.writer.OWG_13_12_ProviderModel.writeJSONB(Unknown Source)
at com.alibaba.fastjson2.writer.OWG_12_9_RpcInvocation.writeJSONB(Unknown Source)
at com.alibaba.fastjson2.writer.OWG_11_5_AsyncRpcResult.writeJSONB(Unknown Source)
at com.alibaba.fastjson2.JSONB.toBytes(JSONB.java:1276)
at org.apache.dubbo.common.serialize.fastjson2.FastJson2ObjectOutput.writeObject(FastJson2ObjectOutput.java:107)
at org.apache.dubbo.common.serialize.DefaultSerializationExceptionWrapper$ProxyObjectOutput.writeObject(DefaultSerializationExceptionWrapper.java:317)
... 9 common frames omitted
```
### Anything else
_No response_
### Are you willing to submit a pull request to fix on your own?
- [ ] Yes I am willing to submit a pull request on my own!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
Contributor guide
Research direction
Reproduce the supplied OperationLogDubboService case with Dubbo 3.2.10, Java 17, and fastjson2 2.0.47, then start from DefaultParamDeepCopyUtil and InjvmInvoker in the stack trace. Trace how ProviderModel reaches FastJson2ObjectOutput and determine whether the failure is in Dubbo's deep-copy path or fastjson2 handling; done means the invocation no longer emits this serialization error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100