mycontroller-org / mycontroller-v1-legacy

The Open Source Controller
http://www.MyController.org
Apache License 2.0
147 stars 90 forks source link

Backup returns HTTP Error 400 #319

Closed Redferne closed 7 years ago

Redferne commented 7 years ago

On the daily build from 29nov (latest?) it is not possible to create backup.

26570:org.h2.jdbc.JdbcSQLException: Out of memory.; SQL statement: 26602:Caused by: java.lang.OutOfMemoryError: Java heap space

Complete log here: https://drive.google.com/file/d/0B9erfGyVgWBleU5leFBSSzNiQUk/view?usp=drivesdk

jkandasa commented 7 years ago

@Redferne let me check this locally

jkandasa commented 7 years ago

@Redferne I am unable to reproduce this issue. Can you try in your location once again?

Looks like your database has corrupted!

Redferne commented 7 years ago

Just tried the daily build and backup does not work. Following is printed in the log:

2016-12-16 12:33:43,503 ERROR [Acme.Utils.ThreadPool(4)-PooledThread: Acme.Serve.Serve$ServeConnection@afc201] [org.mycontroller.standalone.db.DataBaseUtils:207] Exception, backup failed!
org.h2.jdbc.JdbcSQLException: Out of memory.; SQL statement:
SCRIPT TO ? COMPRESSION ZIP [90108-176]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)
    at org.h2.message.DbException.get(DbException.java:167)
    at org.h2.message.DbException.convert(DbException.java:288)
    at org.h2.command.Command.executeQuery(Command.java:207)
    at org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:193)
    at org.mycontroller.standalone.db.DataBaseUtils.backupDatabase(DataBaseUtils.java:203)
    at org.mycontroller.standalone.backup.Backup.backup(Backup.java:72)
    at org.mycontroller.standalone.api.BackupApi.backupNow(BackupApi.java:182)
    at org.mycontroller.standalone.api.BackupApi.backupNow(BackupApi.java:193)
    at org.mycontroller.standalone.api.jaxrs.BackupHandler.backupNow(BackupHandler.java:107)
    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:497)
    at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
    at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
    at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
    at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
    at org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
    at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
    at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
    at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.OutOfMemoryError: Java heap space
    at org.h2.store.Data.readString(Data.java:221)
    at org.h2.store.Data.readString(Data.java:206)
    at org.h2.store.Data.readValue(Data.java:792)
    at org.h2.index.PageDataLeaf.readRow(PageDataLeaf.java:626)
    at org.h2.index.PageDataLeaf.getRowAt(PageDataLeaf.java:336)
    at org.h2.index.PageDataCursor.nextRow(PageDataCursor.java:102)
    at org.h2.index.PageDataCursor.next(PageDataCursor.java:68)
    at org.h2.command.dml.ScriptCommand.generateInsertValues(ScriptCommand.java:403)
    at org.h2.command.dml.ScriptCommand.query(ScriptCommand.java:301)
    at org.h2.command.CommandContainer.query(CommandContainer.java:91)
    at org.h2.command.Command.executeQuery(Command.java:197)
    at org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:193)
    at org.mycontroller.standalone.db.DataBaseUtils.backupDatabase(DataBaseUtils.java:203)
    at org.mycontroller.standalone.backup.Backup.backup(Backup.java:72)
    at org.mycontroller.standalone.api.BackupApi.backupNow(BackupApi.java:182)
    at org.mycontroller.standalone.api.BackupApi.backupNow(BackupApi.java:193)
    at org.mycontroller.standalone.api.jaxrs.BackupHandler.backupNow(BackupHandler.java:107)
    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:497)
    at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
    at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
    at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
    at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
    at org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
2016-12-16 12:33:43,512 ERROR [Acme.Utils.ThreadPool(4)-PooledThread: Acme.Serve.Serve$ServeConnection@afc201] [org.mycontroller.standalone.db.DataBaseUtils:215] Unable to close backup database connection!
org.h2.jdbc.JdbcSQLException: The database has been closed [90098-176]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)
    at org.h2.message.DbException.get(DbException.java:178)
    at org.h2.message.DbException.get(DbException.java:154)
    at org.h2.message.DbException.get(DbException.java:143)
    at org.h2.engine.Database.checkPowerOff(Database.java:490)
    at org.h2.engine.Session.close(Session.java:669)
    at org.h2.jdbc.JdbcConnection.close(JdbcConnection.java:383)
    at org.mycontroller.standalone.db.DataBaseUtils.backupDatabase(DataBaseUtils.java:213)
    at org.mycontroller.standalone.backup.Backup.backup(Backup.java:72)
    at org.mycontroller.standalone.api.BackupApi.backupNow(BackupApi.java:182)
    at org.mycontroller.standalone.api.BackupApi.backupNow(BackupApi.java:193)
    at org.mycontroller.standalone.api.jaxrs.BackupHandler.backupNow(BackupHandler.java:107)
    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:497)
    at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
    at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
    at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
    at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
    at org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
    at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
    at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
    at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
    at java.lang.Thread.run(Thread.java:745)
2016-12-16 12:33:43,516 ERROR [Acme.Utils.ThreadPool(4)-PooledThread: Acme.Serve.Serve$ServeConnection@afc201] [org.mycontroller.standalone.api.jaxrs.BackupHandler:109] Error,
org.mycontroller.standalone.exceptions.McException: Database backup failed!
    at org.mycontroller.standalone.backup.Backup.backup(Backup.java:79)
    at org.mycontroller.standalone.api.BackupApi.backupNow(BackupApi.java:182)
    at org.mycontroller.standalone.api.BackupApi.backupNow(BackupApi.java:193)
    at org.mycontroller.standalone.api.jaxrs.BackupHandler.backupNow(BackupHandler.java:107)
    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:497)
    at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
    at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
    at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
    at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
    at org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
    at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
    at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
    at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
    at java.lang.Thread.run(Thread.java:745)
jkandasa commented 7 years ago

@Redferne can you paste your MyController server details.

I want the following screenshots from GUI,

Thank you!

Redferne commented 7 years ago
MyController
Version
0.0.3.Final-SNAPSHOT
Database schema revision
1.03.05 - 2016 Nov 18
Database type
H2 database embedded
Database version
1.3.176 (2014-04-05)
Git commit:branch
fa8215b1cfd0cf549ee7841f77440daf0fd10b42:development
Built on
2016-12-16T11:08:47+0530
Build JDK
1.8.0_111
Build tool
Apache Maven 3.3.9
Java virtual machine specification
VM vendor
Oracle Corporation
VM name
Java HotSpot(TM) Client VM
VM version
1.8.0_65-b17
Java home
/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre
Operating system
Operating system
Linux
Architecture
arm
Version/Kernel
4.4.37-v7+
Location
/home/pi/tools/mycontroller/
`Java home
/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre
Java vendor url
http://java.oracle.com/
VM name
Java HotSpot(TM) Client VM
VM vendor
Oracle Corporation
VM version
25.65-b01
Specification vendor
Oracle Corporation
Specification version
1.8
Management specification version
1.2
Up time
54 minutes 17 seconds
Heap memory
Used: 43 MB, Committed: 61 MB, Init: 8 MB, Max: 96 MB
Non heap memory
Used: 28 MB, Committed: 31 MB, Init: 0 MB, Max: n/a
Threads count
Current: 58, Peak: 59, Total started: 1356, Daemon: 28
Class loading details
Loaded: 7129, Unloaded: 414, Total loaded: 7543
Garbage collector - Copy
Collection time: 30659, Collection count: 994, Last GC duration: 20
Garbage collector - MarkSweepCompact
Collection time: 16034, Collection count: 35, Last GC duration: 573`
Operating system
Linux
Architecture
arm
Version/Kernel
4.4.37-v7+
Available process
4
System load average
66.00 %
System cpu load
0.00 %
Process cpu
Load: 0.00 %, Time: 1311200 milliseconds
Physical memory (RAM)
Free: 82 MB, Total: 862 MB
Swap space
Free: 0 MB, Total: 0 MB
Committed virtual memory size
224 MB
User working directory
/home/pi/tools/mycontroller/bin
Backup location
/home/pi/tools/mycontroller/backup/
Automatic backup settings
OFF
Redferne commented 7 years ago

If my database is corrupted in anyway. Is it possible to perform a recovery similar to MariaDB?

jkandasa commented 7 years ago

@Redferne Yes, looks like your database corrupted.

Kindly refer the following links to perform recover operation. https://www.qvera.com/kb/index.php/619/how-to-recover-corrupt-h2-database http://www.h2database.com/html/advanced.html#using_recover_tool

Redferne commented 7 years ago

Great! Which version of the jar tool to I use?

Redferne commented 7 years ago

Eventually managed to recover all settings from corrupted databases and recreate it. However all sensor history was lost. It was just too damaged to repair, I manually edited the .sql file to remove all invalid entries but was not successful. Gave up after 4 hours.

jkandasa commented 7 years ago

@Redferne

Great! Which version of the jar tool to I use?

You can use: 1.3.176 (2014-04-05)

Eventually managed to recover all settings from corrupted databases and recreate it. However all sensor history was lost. It was just too damaged to repair, I manually edited the .sql file to remove all invalid entries but was not successful. Gave up after 4 hours.

I am sorry for this. Could you share your corrupted database? Let me try to recover it.