-
Notifications
You must be signed in to change notification settings - Fork 550
Closed
Labels
Milestone
Description
问题描述
使用dubbo3.2.11,序列化方式为fastjson2。当服务端模型新增字段并升级了jar包,而客户端未升级到最新jar包版本时,偶发历史字段的丢失
环境信息
- OS信息: Amazon Linux 2023.6.20241111
- JDK信息: openjdk 17.0.11
- 版本信息:Fastjson 2.0.51
重现步骤
服务间通过dubbo3.2.11进行rpc调用,序列化方式默认为fastjson2。服务端接口返回模型新增字段并升级jar包版本,客户端仍使用原jar包版本。例如,在订单的菜品模型中新增以下模型:
@Data
public class FulfillmentItemDTO implements Serializable {
private Long fulfillmentItemId;
private Integer status;
private Long operateTime;
}对比服务端、客户端的日志信息:

菜品的status字段非高版本jar包新增,但客户端反序列化时该字段丢失了。(且在上面的例子中,除了菜品模型外,订单所有模型中的status字段在反序列化时全部丢失了,即使那些模型没有任何变更)
期待的正确结果
低版本客户端反序列化的结果中,高版本jar包新增的字段为null,但历史已有的字段不丢失(也就是最基础的向前兼容)。
相关日志输出
客户端反序列化过程中静默丢失字段,无任何报错。使用丢失的历史字段时可能产生npe
附加信息
如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。
服务端订单日志:
{
"checkGroup": {
"checkGroupId": 1963400958801457210,
"checkGroupNo": "1963400958801457210",
"createdBy": 510501,
"createdTime": 1756949954889,
"deleted": 0,
"lastModifiedBy": 510501,
"modifiedTime": 1756949982975,
"orderTime": 1756949954889,
"orgId": 10507701,
"serverId": 510501,
"tenantId": 507701,
"type": 1,
"uuid": "ade25c8b86ae47568196312e9da9bed8",
"version": 3
},
"checkGroupUuid": "ade25c8b86ae47568196312e9da9bed8",
"checkList": [
{
"bizType": 4,
"cancelTime": 1756949980979,
"cashDiscountTotal": 0,
"checkExtends": [
{
"attributeKey": 300000,
"attributeValue": "{\"voidReason\":\"\",\"selectedReason\":[{\"id\":\"519001\",\"name\":\"味道不好\"}],\"voidQuantity\":0,\"voidSplitItem\":false}",
"checkGroupId": 1963400958801457210,
"checkId": 1963400958817091671,
"createdBy": 510501,
"createdTime": 1756949982949,
"deleted": 0,
"lastModifiedBy": 510501,
"modifiedTime": 1756949982949,
"orgId": 10507701,
"tenantId": 507701,
"uuid": "9eb2db9e048f4123acd7be73d3f73206"
}
],
"checkGroupId": 1963400958801457210,
"checkGuests": [
{
"checkGroupId": 1963400958801457210,
"checkId": 1963400958817091671,
"createdBy": 510501,
"createdTime": 1756949982956,
"deleted": 0,
"lastModifiedBy": 510501,
"modifiedTime": 1756949982956,
"orgId": 10507701,
"tenantId": 507701
}
],
"checkId": 1963400958817091671,
"checkItems": [
{
"appliedTaxes": [
{
"appliedAmount": 0,
"appliedTargetId": "1963400958824095834",
"appliedTargetType": 1,
"appliedTargetUuid": "42b209f15d974f9ca13e37ec92841e8f",
"calType": 4,
"checkGroupId": 1963400958801457210,
"checkId": 1963400958817091671,
"createdBy": 510501,
"createdTime": 1756949982965,
"deleted": 0,
"lastModifiedBy": 510501,
"modifiedTime": 1756949982965,
"orgId": 10507701,
"originalTaxAmount": 0,
"roundingType": 3,
"taxConfigId": "504301",
"taxConfigUuid": "9dddfe02-3c71-4570-97f4-a809a65cd9dc",
"tenantId": 507701,
"uuid": "4923bb37ab2343a1a31af0b4d1faecc3"
}
],
"batchNo": "1756949961036",
"cashDiscountTotal": 0,
"cashPriceTotal": 8.5,
"checkGroupId": 1963400958801457210,
"checkId": 1963400958817091671,
"checkItemId": 1963400958824095834,
"createdBy": 510501,
"createdTime": 1756949962711,
"deleted": 0,
"discountTotal": 0,
"displayQuantity": "1",
"fulfillmentItemDTO": {
"fulfillmentItemId": 1963400958861844562,
"operateTime": 1756949974538,
"status": 2
},
"goodsType": 1,
"itemId": 1033911,
"itemName": "item1",
"itemTotalUnitPrice": 10,
"itemUnitPrice": 10,
"itemUuId": "1958052188584288343",
"lastModifiedBy": 510501,
"menuUuid": "1958052188108800056",
"modifiedTime": 1756949982962,
"orgId": 10507701,
"originalTotal": 10,
"parentQuantity": 1,
"quantity": 1,
"salesCategoryId": 188,
"salesCategoryName": "yw sale category",
"salesCategoryTippable": false,
"sendTime": 1756949961036,
"splitCount": 1,
"status": 4,
"subMenuName": "yw sales category",
"subMenuUuid": "1958052188689145867",
"taxInclusionOptionCode": 2,
"taxTotal": 0,
"tenantId": 507701,
"unitQuantity": 1,
"uuid": "42b209f15d974f9ca13e37ec92841e8f"
},
{
"appliedTaxes": [
{
"appliedAmount": 0,
"appliedTargetId": "1963400958835011640",
"appliedTargetType": 1,
"appliedTargetUuid": "f34460f7ac53491887bd3812468f32fc",
"calType": 4,
"checkGroupId": 1963400958801457210,
"checkId": 1963400958817091671,
"createdBy": 510501,
"createdTime": 1756949982965,
"deleted": 0,
"lastModifiedBy": 510501,
"modifiedTime": 1756949982965,
"orgId": 10507701,
"originalTaxAmount": 0,
"roundingType": 3,
"taxConfigId": "504301",
"taxConfigUuid": "9dddfe02-3c71-4570-97f4-a809a65cd9dc",
"tenantId": 507701,
"uuid": "b25ce054b5a04044bc10daca892ba9d7"
}
],
"batchNo": "1756949961036",
"cashDiscountTotal": 0,
"cashPriceTotal": 8.5,
"checkGroupId": 1963400958801457210,
"checkId": 1963400958817091671,
"checkItemId": 1963400958835011640,
"createdBy": 510501,
"createdTime": 1756949962711,
"deleted": 0,
"discountTotal": 0,
"displayQuantity": "1",
"goodsType": 1,
"itemId": 1033911,
"itemName": "item1",
"itemTotalUnitPrice": 10,
"itemUnitPrice": 10,
"itemUuId": "1958052188584288343",
"lastModifiedBy": 510501,
"menuUuid": "1958052188108800056",
"modifiedTime": 1756949982962,
"orgId": 10507701,
"originalTotal": 10,
"parentQuantity": 1,
"quantity": 1,
"salesCategoryId": 188,
"salesCategoryName": "yw sale category",
"salesCategoryTippable": false,
"sendTime": 1756949961036,
"splitCount": 1,
"status": 4,
"subMenuName": "yw sales category",
"subMenuUuid": "1958052188689145867",
"taxInclusionOptionCode": 2,
"taxTotal": 0,
"tenantId": 507701,
"unitQuantity": 1,
"uuid": "f34460f7ac53491887bd3812468f32fc"
}
],
"checkNo": "2509043375968947590043691",
"checkPayStatus": 0,
"createdBy": 510501,
"createdTime": 1756949954889,
"customerDeliveryFee": 0,
"deleted": 0,
"deviceSn": "kds-1300",
"diningOptionId": 508506,
"diningOptionName": "Dine in 默认",
"discountTotal": 0,
"driverTip": 0,
"hasRefund": 0,
"itemSubTotal": 0,
"lastModifiedBy": 510501,
"modifiedTime": 1756949982945,
"orderMode": 1,
"orderTime": 1756949954889,
"orgId": 10507701,
"paid": 0,
"payType": 2,
"posDisplayNo": "12",
"previewCashPayAmount": 0,
"receivable": 0,
"salesChannel": 1,
"salesSource": 1,
"serverId": 510501,
"serviceChargeTotal": 0,
"status": 400,
"surchargeTotal": 0,
"taxTotal": 0,
"tenantId": 507701,
"tipTotal": 0,
"uuid": "7193dab0a0d742719a38a36902d1543c"
}
],
"orderVersion": 3
}客户端订单日志:
{
"checkGroup": {
"checkGroupId": 1963400958801457210,
"checkGroupNo": "1963400958801457210",
"createdBy": 510501,
"createdTime": 1756949954889,
"deleted": 0,
"lastModifiedBy": 510501,
"modifiedTime": 1756949982975,
"orderTime": 1756949954889,
"orgId": 10507701,
"serverId": 510501,
"tenantId": 507701,
"type": 1,
"uuid": "ade25c8b86ae47568196312e9da9bed8",
"version": 3
},
"checkGroupUuid": "ade25c8b86ae47568196312e9da9bed8",
"checkList": [
{
"bizType": 4,
"cancelTime": 1756949980979,
"cashDiscountTotal": 0,
"checkExtends": [
{
"attributeKey": 300000,
"attributeValue": "{\"voidReason\":\"\",\"selectedReason\":[{\"id\":\"519001\",\"name\":\"味道不好\"}],\"voidQuantity\":0,\"voidSplitItem\":false}",
"checkGroupId": 1963400958801457210,
"checkId": 1963400958817091671,
"createdBy": 510501,
"createdTime": 1756949982949,
"deleted": 0,
"lastModifiedBy": 510501,
"modifiedTime": 1756949982949,
"orgId": 10507701,
"tenantId": 507701,
"uuid": "9eb2db9e048f4123acd7be73d3f73206"
}
],
"checkGroupId": 1963400958801457210,
"checkGuests": [
{
"checkGroupId": 1963400958801457210,
"checkId": 1963400958817091671,
"createdBy": 510501,
"createdTime": 1756949982956,
"deleted": 0,
"lastModifiedBy": 510501,
"modifiedTime": 1756949982956,
"orgId": 10507701,
"tenantId": 507701
}
],
"checkId": 1963400958817091671,
"checkItems": [
{
"appliedTaxes": [
{
"appliedAmount": 0,
"appliedTargetId": "1963400958824095834",
"appliedTargetType": 1,
"appliedTargetUuid": "42b209f15d974f9ca13e37ec92841e8f",
"calType": 4,
"checkGroupId": 1963400958801457210,
"checkId": 1963400958817091671,
"createdBy": 510501,
"createdTime": 1756949982965,
"deleted": 0,
"lastModifiedBy": 510501,
"modifiedTime": 1756949982965,
"orgId": 10507701,
"originalTaxAmount": 0,
"roundingType": 3,
"taxConfigId": "504301",
"taxConfigUuid": "9dddfe02-3c71-4570-97f4-a809a65cd9dc",
"tenantId": 507701,
"uuid": "4923bb37ab2343a1a31af0b4d1faecc3"
}
],
"batchNo": "1756949961036",
"cashDiscountTotal": 0,
"cashPriceTotal": 8.5,
"checkGroupId": 1963400958801457210,
"checkId": 1963400958817091671,
"checkItemId": 1963400958824095834,
"createdBy": 510501,
"createdTime": 1756949962711,
"deleted": 0,
"discountTotal": 0,
"displayQuantity": "1",
"goodsType": 1,
"itemId": 1033911,
"itemName": "item1",
"itemTotalUnitPrice": 10,
"itemUnitPrice": 10,
"itemUuId": "1958052188584288343",
"lastModifiedBy": 510501,
"menuUuid": "1958052188108800056",
"modifiedTime": 1756949982962,
"orgId": 10507701,
"originalTotal": 10,
"parentQuantity": 1,
"quantity": 1,
"salesCategoryId": 188,
"salesCategoryName": "yw sale category",
"salesCategoryTippable": false,
"sendTime": 1756949961036,
"splitCount": 1,
"subMenuName": "yw sales category",
"subMenuUuid": "1958052188689145867",
"taxInclusionOptionCode": 2,
"taxTotal": 0,
"tenantId": 507701,
"unitQuantity": 1,
"uuid": "42b209f15d974f9ca13e37ec92841e8f"
},
{
"appliedTaxes": [
{
"appliedAmount": 0,
"appliedTargetId": "1963400958835011640",
"appliedTargetType": 1,
"appliedTargetUuid": "f34460f7ac53491887bd3812468f32fc",
"calType": 4,
"checkGroupId": 1963400958801457210,
"checkId": 1963400958817091671,
"createdBy": 510501,
"createdTime": 1756949982965,
"deleted": 0,
"lastModifiedBy": 510501,
"modifiedTime": 1756949982965,
"orgId": 10507701,
"originalTaxAmount": 0,
"roundingType": 3,
"taxConfigId": "504301",
"taxConfigUuid": "9dddfe02-3c71-4570-97f4-a809a65cd9dc",
"tenantId": 507701,
"uuid": "b25ce054b5a04044bc10daca892ba9d7"
}
],
"batchNo": "1756949961036",
"cashDiscountTotal": 0,
"cashPriceTotal": 8.5,
"checkGroupId": 1963400958801457210,
"checkId": 1963400958817091671,
"checkItemId": 1963400958835011640,
"createdBy": 510501,
"createdTime": 1756949962711,
"deleted": 0,
"discountTotal": 0,
"displayQuantity": "1",
"goodsType": 1,
"itemId": 1033911,
"itemName": "item1",
"itemTotalUnitPrice": 10,
"itemUnitPrice": 10,
"itemUuId": "1958052188584288343",
"lastModifiedBy": 510501,
"menuUuid": "1958052188108800056",
"modifiedTime": 1756949982962,
"orgId": 10507701,
"originalTotal": 10,
"parentQuantity": 1,
"quantity": 1,
"salesCategoryId": 188,
"salesCategoryName": "yw sale category",
"salesCategoryTippable": false,
"sendTime": 1756949961036,
"splitCount": 1,
"subMenuName": "yw sales category",
"subMenuUuid": "1958052188689145867",
"taxInclusionOptionCode": 2,
"taxTotal": 0,
"tenantId": 507701,
"unitQuantity": 1,
"uuid": "f34460f7ac53491887bd3812468f32fc"
}
],
"checkNo": "2509043375968947590043691",
"checkPayStatus": 0,
"createdBy": 510501,
"createdTime": 1756949954889,
"customerDeliveryFee": 0,
"deleted": 0,
"deviceSn": "kds-1300",
"diningOptionId": 508506,
"diningOptionName": "Dine in 默认",
"discountTotal": 0,
"driverTip": 0,
"hasRefund": 0,
"itemSubTotal": 0,
"lastModifiedBy": 510501,
"modifiedTime": 1756949982945,
"orderMode": 1,
"orderTime": 1756949954889,
"orgId": 10507701,
"paid": 0,
"payType": 2,
"posDisplayNo": "12",
"previewCashPayAmount": 0,
"receivable": 0,
"salesChannel": 1,
"salesSource": 1,
"serverId": 510501,
"serviceChargeTotal": 0,
"surchargeTotal": 0,
"taxTotal": 0,
"tenantId": 507701,
"tipTotal": 0,
"uuid": "7193dab0a0d742719a38a36902d1543c"
}
],
"orderVersion": 3
}Reactions are currently unavailable