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

DynamicThreadPoolRegisterParameter#threadFactory序列化异常 #1085

Closed
wulangcode opened this issue Mar 7, 2023 · 3 comments
Closed

DynamicThreadPoolRegisterParameter#threadFactory序列化异常 #1085

wulangcode opened this issue Mar 7, 2023 · 3 comments
Assignees
Labels
in: hippo4j-server type: bug Something isn't working
Milestone

Comments

@wulangcode
Copy link
Member

BUG 报告

在开始报告错误之前,请确保认真查看了以下步骤:

请在提交问题之前回答这些问题,谢谢。

你使用了哪个项目?hippo4j config 还是 hippo4j server?

hippo4j config、hippo4j server

你使用了哪个版本?

最新版本

预期行为

客户端注册服务端不报错。

实际行为

image

org.springframework.http.converter.HttpMessageConversionException: Type definition error: [simple type, class java.util.concurrent.ThreadFactory]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `java.util.concurrent.ThreadFactory` (no Creators, like default constructor, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information
 at [Source: (PushbackInputStream); line: 1, column: 295] (through reference chain: cn.hippo4j.common.model.register.DynamicThreadPoolRegisterWrapper["parameter"]->cn.hippo4j.common.model.register.DynamicThreadPoolRegisterParameter["threadFactory"])

原因分析(如果可以)

ThreadFactoryBuilder#build(cn.hippo4j.common.design.builder.ThreadFactoryBuilder) 中使用了Executors.defaultThreadFactory()

问题重现步骤

1.拉取最新版本代码,删除服务端数据库中数据,走服务器中未定义的动态线程池配置的逻辑,让客户端自己注册
2.启动服务端
3.启动hippo4j-spring-boot-starter-example示例模块

解决方案

  1. DynamicThreadPoolRegisterParameter#threadFactory的属性上加上,@JsonIgnore不进行序列化。查看服务端接口并未使用客户端上传上来的ThreadFactory字段。

用于重现此问题的示例代码(例如 GitHub 链接)

@magestacks
Copy link
Member

magestacks commented Mar 8, 2023

客户端线程池注册服务端有单独的 API,该流程是否走的自主注册 API?

@wulangcode
Copy link
Member Author

GlobalThreadPoolManage.dynamicRegister(registerWrapper);
image

@magestacks magestacks added type: bug Something isn't working in: hippo4j-server labels Apr 15, 2023
@magestacks magestacks added this to the 1.5.0 milestone Apr 15, 2023
@magestacks magestacks self-assigned this Apr 15, 2023
@magestacks
Copy link
Member

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: hippo4j-server type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants