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

optimize: disable listening in the FileConfiguration center in Springboot #3991

Merged
merged 5 commits into from
Sep 1, 2021

Conversation

funky-eyes
Copy link
Contributor

@funky-eyes funky-eyes commented Aug 30, 2021

Ⅰ. Describe what this PR did

springboot中的file已经被SpringBootConfigurationProvider代理,不应该开启其file的listener线程,如果开启,springboot容器关闭后,监听线程依旧在运行,导致出现一堆org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@79c4715d has been closed already 的异常,如果是因为用户自己的业务bug导致springboot容器无法启动,也会出现下述异常,导致用户认为是seata的bug

23:48:56.325 ERROR --- [         fileListener_3_1] io.seata.config.FileConfiguration        : fileListener execute error, dataId :config.type
==>
java.lang.reflect.InvocationTargetException: null
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at io.seata.config.ConfigurationCache.lambda$proxy$1(ConfigurationCache.java:125)
	at io.seata.config.Configuration$$EnhancerByCGLIB$$ff1c2cf2.getLatestConfig(<generated>)
	at io.seata.config.FileConfiguration$FileListener.onChangeEvent(FileConfiguration.java:399)
	at io.seata.config.ConfigurationChangeListener.lambda$onProcessEvent$0(ConfigurationChangeListener.java:62)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
	at java.util.concurrent.FutureTask.run(FutureTask.java)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@79c4715d has been closed already
	at org.springframework.context.support.AbstractApplicationContext.assertBeanFactoryActive(AbstractApplicationContext.java:1093)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1126)
	at io.seata.spring.boot.autoconfigure.provider.SpringBootConfigurationProvider.get(SpringBootConfigurationProvider.java:100)
	at io.seata.spring.boot.autoconfigure.provider.SpringBootConfigurationProvider.get(SpringBootConfigurationProvider.java:85)
	at io.seata.spring.boot.autoconfigure.provider.SpringBootConfigurationProvider.get(SpringBootConfigurationProvider.java:80)
	at io.seata.spring.boot.autoconfigure.provider.SpringBootConfigurationProvider.access$300(SpringBootConfigurationProvider.java:46)
	at io.seata.spring.boot.autoconfigure.provider.SpringBootConfigurationProvider$1.intercept(SpringBootConfigurationProvider.java:63)
	at io.seata.config.FileConfiguration$$EnhancerByCGLIB$$862af1eb.getLatestConfig(<generated>)
	... 15 common frames omitted
<==


Process finished with exit code 130

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@funky-eyes funky-eyes changed the title optimize: disable listening in the File configuration center in Sprin… optimize: disable listening in the File configuration center in Springboot Aug 30, 2021
@funky-eyes funky-eyes changed the title optimize: disable listening in the File configuration center in Springboot optimize: disable listening in the FileConfiguration center in Springboot Aug 30, 2021
Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@slievrly slievrly added this to the 1.5.0 milestone Aug 31, 2021
Copy link
Contributor

@wangliang181230 wangliang181230 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wangliang181230
Copy link
Contributor

pls modify the 1.5.0.md

@codecov-commenter
Copy link

codecov-commenter commented Sep 1, 2021

Codecov Report

Merging #3991 (315f89f) into develop (17b90c4) will increase coverage by 0.07%.
The diff coverage is 75.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #3991      +/-   ##
=============================================
+ Coverage      40.15%   40.23%   +0.07%     
- Complexity      3078     3082       +4     
=============================================
  Files            690      690              
  Lines          23357    23362       +5     
  Branches        2892     2893       +1     
=============================================
+ Hits            9379     9399      +20     
+ Misses         13108    13090      -18     
- Partials         870      873       +3     
Impacted Files Coverage Δ
...ure/provider/SpringApplicationContextProvider.java 0.00% <0.00%> (ø)
...c/main/java/io/seata/config/FileConfiguration.java 46.06% <100.00%> (+2.96%) ⬆️
.../main/java/io/seata/config/ConfigurationCache.java 73.26% <0.00%> (+8.91%) ⬆️
...a/io/seata/config/ConfigurationChangeListener.java 75.00% <0.00%> (+33.33%) ⬆️

@slievrly slievrly merged commit 30c2c75 into apache:develop Sep 1, 2021
UmmizzZ pushed a commit to UmmizzZ/seata that referenced this pull request Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants