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

docker容器突然停止运行 #4060

Closed
airwb opened this issue Jun 11, 2023 · 9 comments
Closed

docker容器突然停止运行 #4060

airwb opened this issue Jun 11, 2023 · 9 comments
Labels
kind/support Categorizes issue or PR as a support question. triage/duplicate Indicates an issue is a duplicate of other open issue.

Comments

@airwb
Copy link

airwb commented Jun 11, 2023

是什么版本出现了此问题?

halo1.6

使用的什么数据库?

H2

使用的哪种方式部署?

Docker

在线站点地址

No response

发生了什么?

今天docker容器突然停止运行

相关日志输出

org.h2.jdbc.JdbcSQLNonTransientConnectionException: File corrupted while reading record: null. Possible solution: use the recovery tool [90030-199]
	at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addAsRegistrationBean(ServletContextInitializerBeans.java:175) ~[spring-boot-2.5.12.jar:2.5.12]
	at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addAsRegistrationBean(ServletContextInitializerBeans.java:170) ~[spring-boot-2.5.12.jar:2.5.12]
	at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addAdaptableBeans(ServletContextInitializerBeans.java:155) ~[spring-boot-2.5.12.jar:2.5.12]
	at org.springframework.boot.web.servlet.ServletContextInitializerBeans.<init>(ServletContextInitializerBeans.java:87) ~[spring-boot-2.5.12.jar:2.5.12]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationContext.java:260) ~[spring-boot-2.5.12.jar:2.5.12]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:234) ~[spring-boot-2.5.12.jar:2.5.12]
	at org.springframework.boot.web.embedded.jetty.ServletContextInitializerConfiguration.callInitializers(ServletContextInitializerConfiguration.java:65) ~[spring-boot-2.5.12.jar:2.5.12]
	at org.springframework.boot.web.embedded.jetty.ServletContextInitializerConfiguration.configure(ServletContextInitializerConfiguration.java:54) ~[spring-boot-2.5.12.jar:2.5.12]
	at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:498) ~[jetty-webapp-9.4.45.v20220203.jar:9.4.45.v20220203]
	at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1409) ~[jetty-webapp-9.4.45.v20220203.jar:9.4.45.v20220203]
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:916) ~[jetty-server-9.4.45.v20220203.jar:9.4.45.v20220203]
	at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:288) ~[jetty-servlet-9.4.45.v20220203.jar:9.4.45.v20220203]
	at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:524) ~[jetty-webapp-9.4.45.v20220203.jar:9.4.45.v20220203]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) ~[jetty-util-9.4.45.v20220203.jar:9.4.45.v20220203]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169) ~[jetty-util-9.4.45.v20220203.jar:9.4.45.v20220203]
	at org.eclipse.jetty.server.Server.start(Server.java:423) ~[jetty-server-9.4.45.v20220203.jar:9.4.45.v20220203]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110) ~[jetty-util-9.4.45.v20220203.jar:9.4.45.v20220203]
	at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97) ~[jetty-server-9.4.45.v20220203.jar:9.4.45.v20220203]
	at org.eclipse.jetty.server.Server.doStart(Server.java:387) ~[jetty-server-9.4.45.v20220203.jar:9.4.45.v20220203]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) ~[jetty-util-9.4.45.v20220203.jar:9.4.45.v20220203]
	at org.springframework.boot.web.embedded.jetty.JettyWebServer.initialize(JettyWebServer.java:123) ~[spring-boot-2.5.12.jar:2.5.12]
	at org.springframework.boot.web.embedded.jetty.JettyWebServer.<init>(JettyWebServer.java:90) ~[spring-boot-2.5.12.jar:2.5.12]
	at org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory.getJettyWebServer(JettyServletWebServerFactory.java:429) ~[spring-boot-2.5.12.jar:2.5.12]
	at org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory.getWebServer(JettyServletWebServerFactory.java:170) ~[spring-boot-2.5.12.jar:2.5.12]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:182) ~[spring-boot-2.5.12.jar:2.5.12]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:160) ~[spring-boot-2.5.12.jar:2.5.12]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.18.jar:5.3.18]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.12.jar:2.5.12]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.5.12.jar:2.5.12]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:448) ~[spring-boot-2.5.12.jar:2.5.12]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:339) ~[spring-boot-2.5.12.jar:2.5.12]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1365) ~[spring-boot-2.5.12.jar:2.5.12]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[spring-boot-2.5.12.jar:2.5.12]
	at run.halo.app.Application.main(Application.java:21) ~[classes/:1.6.1]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[na:na]
	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[application/:na]
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) ~[application/:na]
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[application/:na]
	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) ~[application/:na]
Caused by: java.lang.IllegalStateException: File corrupted in chunk 5664, expected page length 4..3072, got 1919905652 [1.4.199/6]
	at org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:883) ~[h2-1.4.199.jar:1.4.199]
	at org.h2.mvstore.MVStore.readBufferForPage(MVStore.java:1055) ~[h2-1.4.199.jar:1.4.199]
	at org.h2.mvstore.MVStore.readPage(MVStore.java:2186) ~[h2-1.4.199.jar:1.4.199]
	at org.h2.mvstore.MVMap.readPage(MVMap.java:554) ~[h2-1.4.199.jar:1.4.199]
	at org.h2.mvstore.Page$NonLeaf.getChildPage(Page.java:1086) ~[h2-1.4.199.jar:1.4.199]
	at org.h2.mvstore.Cursor.traverseDown(Cursor.java:165) ~[h2-1.4.199.jar:1.4.199]
	at org.h2.mvstore.Cursor.<init>(Cursor.java:31) ~[h2-1.4.199.jar:1.4.199]
	at org.h2.mvstore.Cursor.<init>(Cursor.java:27) ~[h2-1.4.199.jar:1.4.199]
	at org.h2.mvstore.MVMap.cursor(MVMap.java:660) ~[h2-1.4.199.jar:1.4.199]
	at org.h2.mvstore.MVStore.readStoreHeader(MVStore.java:792) ~[h2-1.4.199.jar:1.4.199]
	at org.h2.mvstore.MVStore.<init>(MVStore.java:401) ~[h2-1.4.199.jar:1.4.199]
	at org.h2.mvstore.MVStore$Builder.open(MVStore.java:3343) ~[h2-1.4.199.jar:1.4.199]
	at org.h2.mvstore.db.MVTableEngine$Store.open(MVTableEngine.java:162) ~[h2-1.4.199.jar:1.4.199]
	... 139 common frames omitted
2023-06-11 14:57:57.499  WARN 7 --- [           main] o.h.e.j.e.i.JdbcEnvironmentInitiator     : HHH000342: Could not obtain connection to query metadata

附加信息

No response

@ruibaby
Copy link
Member

ruibaby commented Jun 11, 2023

应该是 h2 数据库因为某种原因而损坏。

/traige duplicate

#2740

@airwb
Copy link
Author

airwb commented Jun 11, 2023

应该是 h2 数据库因为某种原因而损坏。

/traige duplicate

#2740

大佬,能挽救吗?

@ruibaby
Copy link
Member

ruibaby commented Jun 11, 2023

H2 有恢复工具,可以尝试一下:

http://h2database.com/html/advanced.html#using_recover_tool

@ruibaby ruibaby added triage/duplicate Indicates an issue is a duplicate of other open issue. kind/support Categorizes issue or PR as a support question. labels Jun 11, 2023
@airwb
Copy link
Author

airwb commented Jun 11, 2023

运行恢复工具又报错

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at org.h2.mvstore.MVStoreTool.dump(MVStoreTool.java:221)
at org.h2.tools.Recover.process(Recover.java:343)
at org.h2.tools.Recover.runTool(Recover.java:195)
at org.h2.tools.Recover.main(Recover.java:158)

@JohnNiang
Copy link
Member

这个问题在 Halo 1.x 的时候就经常遇到,目前无解。只能通过最近的备份恢复。同时建议不要在生产环境下使用 H2 作为数据库。

@ruibaby
Copy link
Member

ruibaby commented Jun 12, 2023

运行恢复工具又报错

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at org.h2.mvstore.MVStoreTool.dump(MVStoreTool.java:221) at org.h2.tools.Recover.process(Recover.java:343) at org.h2.tools.Recover.runTool(Recover.java:195) at org.h2.tools.Recover.main(Recover.java:158)

似乎是因为内存不够而 OOM 了,建议把 db 文件下载到本地然后在进行恢复操作。

@Tamrac-web
Copy link

遇到同样的问题,使用docker部署后,几乎马上容器会自动停止运行,会因为是机器内存不足的情况吗

@ruibaby
Copy link
Member

ruibaby commented Jun 14, 2023

遇到同样的问题,使用docker部署后,几乎马上容器会自动停止运行,会因为是机器内存不足的情况吗

请提供日志。

@Tamrac-web
Copy link

遇到同样的问题,使用docker部署后,几乎马上容器会自动停止运行,会因为是机器内存不足的情况吗

请提供日志。

已解决,问题出现在初始管理员账号设置为Usernane,不为admin,修改为admin后正常运行。祝生活愉快。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Categorizes issue or PR as a support question. triage/duplicate Indicates an issue is a duplicate of other open issue.
Projects
None yet
Development

No branches or pull requests

4 participants