[halo-dev/halo]docker容器突然停止运行

2023-12-14 813 views
4
是什么版本出现了此问题?

halo1.6

使用的什么数据库?

H2

使用的哪种方式部署?

Docker

发生了什么?

今天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

回答

8

运行恢复工具又报错

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)

0

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

4

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

1

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

0

请提供日志。

5

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