linkis icon indicating copy to clipboard operation
linkis copied to clipboard

[Bug] Stream closed whille starting dss-workflow-server dependencing linkis-mybatis

Open DevotedTangLiu opened this issue 2 years ago • 1 comments

Search before asking

  • [X] I searched the issues and found no similar issues.

Linkis Component

linkis-commons

Steps to reproduce

  1. i packaged dss server 1.1.1 whith linkis 1.1.1 myself, with nothing changed
  2. installed linkis and dss
  3. started other server successfully, while dss-workflow-server failed with a Stream closed problem
  4. it happened most of times when i started or restarted the dss-workflow-server
  5. while i set a dubug port and tried to remote debug the server, it seemed to work fine.
  6. It happens while initing MybatisConfigurationfactory, which defined in linkis-mybatis
  7. i tried to change linkis-mybatis version from 1.1.1 to 1.3.2, it also happened.
  8. it seems to be a problem of bean initializing and quoting at the same time, which makes afterPropertiesSet concurrent happens.
  9. i tried to make the thread sleep a second after setting properties and before sessionFactoryBean returned, it worked and the server started successfully.

logs as follows:

2023-05-25 15:05:26.955 [INFO ] [main                                    ] o.e.j.s.h.ContextHandler (916) [doStart] - Started o.s.b.w.e.j.JettyEmbeddedWebAppContext@49522bdf{application,/,[file:///tmp/jet
ty-docbase.9005.5524503979471506177/],AVAILABLE}
2023-05-25 15:05:26.956 [INFO ] [main                                    ] o.e.j.s.Server (415) [doStart] - Started @5486ms
2023-05-25 15:05:27.258 [INFO ] [main                                    ] o.r.Reflections (229) [scan] - Reflections took 226 ms to scan 17 urls, producing 306 keys and 2818 values
2023-05-25 15:05:27.333 [INFO ] [main                                    ] o.a.l.c.c.Configuration$ (41) [info] - gatewayUrl is http://192.168.9.107:9001
2023-05-25 15:05:27.599 [INFO ] [Linkis-Default-Scheduler-Thread-1       ] o.a.l.c.c.Configuration$ (41) [info] - gatewayUrl is http://192.168.9.107:9001
2023-05-25 15:05:27.635 [INFO ] [main                                    ] o.a.l.m.DataSourceUtils (76) [buildDataSource] - Database connection address information(数据库连接地址信息)=jdbc:mysql://192.168
.9.10:3306/new_dss?characterEncoding=UTF-8
2023-05-25 15:05:27.693 [INFO ] [Linkis-Default-Scheduler-Thread-1       ] o.a.l.h.d.DWSHttpClient (119) [org$apache$linkis$httpclient$AbstractHttpClient$$addAttempt$1] - invoke http://192.168.9.107:9001/
api/rest_j/v1/contextservice/heartbeat taken: 68
2023-05-25 15:05:27.693 [INFO ] [main                                    ] o.a.l.m.MybatisConfigurationFactory$$EnhancerBySpringCGLIB$$bbaef335 (36) [info] - Mybatis typeAliasesPackage=com.webank.wedatasp
here.dss.workflow.entity,com.webank.wedatasphere.dss.framework.appconn.entity
2023-05-25 15:05:27.694 [INFO ] [main                                    ] o.a.l.m.MybatisConfigurationFactory$$EnhancerBySpringCGLIB$$bbaef335 (36) [info] - Mybatis mapperLocations=classpath*:com/webank/
wedatasphere/dss/workflow/dao/impl/*.xml,classpath*:com/webank/wedatasphere/dss/framework/appconn/dao/impl/*.xml
2023-05-25 15:05:27.694 [INFO ] [main                                    ] o.a.l.m.MybatisConfigurationFactory$$EnhancerBySpringCGLIB$$bbaef335 (36) [info] - Mybatis configLocation=classpath:/mybatis-conf
ig.xml
2023-05-25 15:05:27.741 [WARN ] [main                                    ] o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext (559) [refresh] - Exception encountered during context initializat
ion - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'RPCReceiveRestful': Unsatisfied dependency expressed through field 'org$a
pache$linkis$rpc$RPCReceiveRestful$$receiverChoosers'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'DSSWorkflowChooser': Unsatisfied
 dependency expressed through field 'workflowManager'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'defaultWorkFlowManager': Unsatis
fied dependency expressed through field 'flowService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'DSSFlowServiceImpl': Unsatisfied
 dependency expressed through field 'flowMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flowMapper' defined in URL [jar:file:/cims/new
/dss/dss/lib/dss-orchestrator/dss-workflow-server/dss-workflow-server-1.1.1.jar!/com/webank/wedatasphere/dss/workflow/dao/FlowMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while sett
ing bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/ap
ache/linkis/mybatis/MybatisConfigurationFactory.class]: Invocation of init method failed; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: java.io.
IOException: Stream closed
2023-05-25 15:05:27.741 [INFO ] [main                                    ] c.a.d.p.DruidDataSource (2029) [close] - {dataSource-0} closing ...
2023-05-25 15:05:27.747 [INFO ] [main                                    ] o.e.j.s.session (149) [stopScavenging] - node0 Stopped scavenging
2023-05-25 15:05:27.749 [INFO ] [main                                    ] o.e.j.s.h.ContextHandler (1154) [doStop] - Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext@49522bdf{application,/,[file:///tmp/jet
ty-docbase.9005.5524503979471506177/],STOPPED}
2023-05-25 15:05:27.765 [INFO ] [main                                    ] o.s.b.a.l.ConditionEvaluationReportLoggingListener (136) [logMessage] -

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-05-25 15:05:27.790 [ERROR] [main                                    ] o.s.b.SpringApplication (834) [reportFailure] - Application run failed org.springframework.beans.factory.UnsatisfiedDependencyExc
eption: Error creating bean with name 'RPCReceiveRestful': Unsatisfied dependency expressed through field 'org$apache$linkis$rpc$RPCReceiveRestful$$receiverChoosers'; nested exception is org.springframewo
rk.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'DSSWorkflowChooser': Unsatisfied dependency expressed through field 'workflowManager'; nested exception is org.springframewo
rk.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'defaultWorkFlowManager': Unsatisfied dependency expressed through field 'flowService'; nested exception is org.springframewo
rk.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'DSSFlowServiceImpl': Unsatisfied dependency expressed through field 'flowMapper'; nested exception is org.springframework.be
ans.factory.BeanCreationException: Error creating bean with name 'flowMapper' defined in URL [jar:file:/cims/new/dss/dss/lib/dss-orchestrator/dss-workflow-server/dss-workflow-server-1.1.1.jar!/com/webank/
wedatasphere/dss/workflow/dao/FlowMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory
.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/apache/linkis/mybatis/MybatisConfigurationFactory.class]: Invocation of init method failed; ne
sted exception is org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: java.io.IOException: Stream closed

        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:660) ~[spring-beans-5.2.15.RE
LEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1425) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) ~[spring-context-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:755) ~[spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:402) ~[spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
        at org.apache.linkis.DataWorkCloudApplication.main(DataWorkCloudApplication.java:121) ~[linkis-module-1.1.1.jar:1.1.1]
        at com.webank.wedatasphere.dss.workflow.DSSWorkflowServerApplication$.main(DSSWorkflowServerApplication.scala:37) ~[dss-workflow-server-1.1.1.jar:?]
        at com.webank.wedatasphere.dss.workflow.DSSWorkflowServerApplication.main(DSSWorkflowServerApplication.scala) ~[dss-workflow-server-1.1.1.jar:?]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'DSSWorkflowChooser': Unsatisfied dependency expressed through field 'workflowManager'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'defaultWorkFlowManager': Unsatisfied dependency expressed through field 'flowService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'DSSFlowServiceImpl': Unsatisfied dependency expressed through field 'flowMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flowMapper' defined in URL [jar:file:/cims/new/dss/dss/lib/dss-orchestrator/dss-workflow-server/dss-workflow-server-1.1.1.jar!/com/webank/wedatasphere/dss/workflow/dao/FlowMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/apache/linkis/mybatis/MybatisConfigurationFactory.class]: Invocation of init method failed; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: java.io.IOException: Stream closed

        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:660) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1425) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1525) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1489) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1355) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1265) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:657) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        ... 21 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'defaultWorkFlowManager': Unsatisfied dependency expressed through field 'flowService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'DSSFlowServiceImpl': Unsatisfied dependency expressed through field 'flowMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flowMapper' defined in URL [jar:file:/cims/new/dss/dss/lib/dss-orchestrator/dss-workflow-server/dss-workflow-server-1.1.1.jar!/com/webank/wedatasphere/dss/workflow/dao/FlowMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/apache/linkis/mybatis/MybatisConfigurationFactory.class]: Invocation of init method failed; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: java.io.IOException: Stream closed
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:660) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1425) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
....

Expected behavior

The server should starts normally.

Your environment

  • Linkis version used: 1.1.1 / 1.3.2
  • Environment name and version:
    • hive-2.3.3
    • scala-2.11.12
    • jdk 1.8.0_171
    • ....

Anything else

almost happened each time. but it works fine if i starts remote debugging while it starts or sleep the thread for a second before sessionFactoryBean returning.

Are you willing to submit a PR?

  • [X] Yes I am willing to submit a PR!

DevotedTangLiu avatar Jun 13 '23 02:06 DevotedTangLiu

:blush: Welcome to the Apache Linkis community!!

We are glad that you are contributing by opening this issue.

Please make sure to include all the relevant context. We will be here shortly.

If you are interested in contributing to our website project, please let us know! You can check out our contributing guide on :point_right: How to Participate in Project Contribution.

Community

WeChat Assistant WeChat Public Account

Mailing Lists

Name Description Subscribe Unsubscribe Archive
[email protected] community activity information subscribe unsubscribe archive

github-actions[bot] avatar Jun 13 '23 02:06 github-actions[bot]