com.sk89q.worldguard.protection.managers.storage.StorageException: Failed to save the region data to the database
LadyCailinBot opened this issue ยท 1 comments
WORLDGUARD-4120 - Reported by prettydude
My server recently has been upgraded to version 1.14.3 with latest dev builds of WorldEdit & WorldGuard. Players peacefully played several hours, created around 100 regions when this error appeared in the console. I stopped server immediately and tried to investigate it, but failed to find the cause. Started the server again in hope that WG will delete corrupted reference, but when player tried to claim new region it appeared again. I would be grateful if you could help fix this issue. Thanks.
com.sk89q.worldguard.protection.managers.storage.StorageException: Failed to save the region data to the database
at com.sk89q.worldguard.protection.managers.storage.sql.SQLRegionDatabase.saveChanges(SQLRegionDatabase.java:270) ~[worldguard-bukkit-7.0.1-SNAPSHOT-dist.jar:7.0.1-SNAPSHOT]
at com.sk89q.worldguard.protection.managers.RegionManager.saveChanges(RegionManager.java:135) ~[worldguard-bukkit-7.0.1-SNAPSHOT-dist.jar:7.0.1-SNAPSHOT]
at com.sk89q.worldguard.protection.managers.RegionContainerImpl$BackgroundSaver.run(RegionContainerImpl.java:228) [worldguard-bukkit-7.0.1-SNAPSHOT-dist.jar:7.0.1-SNAPSHOT]
at java.util.TimerThread.mainLoop(Timer.java:555) [?:1.8.0_101]
at java.util.TimerThread.run(Timer.java:505) [?:1.8.0_101]
Caused by: java.sql.BatchUpdateException: Cannot add or update a child row: a foreign key constraint fails (`database`.`wg_region_cuboid`, CONSTRAINT `fk_wg_region_cuboid_region` FOREIGN KEY (`region_id`, `world_id`) REFERENCES `wg_region` (`id`, `world_id`) ON DELETE CASCADE ON UPDATE CASC)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_101]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_101]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_101]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_101]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[spigot-1.14.3.jar:git-Spigot-9a643a6-eb2e657]
at com.mysql.jdbc.Util.getInstance(Util.java:408) ~[spigot-1.14.3.jar:git-Spigot-9a643a6-eb2e657]
at com.mysql.jdbc.SQLError.createBatchUpdateException(SQLError.java:1163) ~[spigot-1.14.3.jar:git-Spigot-9a643a6-eb2e657]
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1823) ~[spigot-1.14.3.jar:git-Spigot-9a643a6-eb2e657]
at com.mysql.jdbc.PreparedStatement.executeBatchInternal(PreparedStatement.java:1307) ~[spigot-1.14.3.jar:git-Spigot-9a643a6-eb2e657]
at com.mysql.jdbc.StatementImpl.executeBatch(StatementImpl.java:970) ~[spigot-1.14.3.jar:git-Spigot-9a643a6-eb2e657]
at com.sk89q.worldguard.protection.managers.storage.sql.RegionInserter.insertCuboids(RegionInserter.java:125) ~[?:?]
at com.sk89q.worldguard.protection.managers.storage.sql.RegionInserter.apply(RegionInserter.java:184) ~[?:?]
at com.sk89q.worldguard.protection.managers.storage.sql.DataUpdater.executeSave(DataUpdater.java:129) ~[?:?]
at com.sk89q.worldguard.protection.managers.storage.sql.DataUpdater.saveChanges(DataUpdater.java:73) ~[?:?]
at com.sk89q.worldguard.protection.managers.storage.sql.SQLRegionDatabase.saveChanges(SQLRegionDatabase.java:268) ~[?:?]
... 4 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`database`.`wg_region_cuboid`, CONSTRAINT `fk_wg_region_cuboid_region` FOREIGN KEY (`region_id`, `world_id`) REFERENCES `wg_region` (`id`, `world_id`) ON DELETE CASCADE ON UPDATE CASC)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_101]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_101]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_101]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_101]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[spigot-1.14.3.jar:git-Spigot-9a643a6-eb2e657]
at com.mysql.jdbc.Util.getInstance(Util.java:408) ~[spigot-1.14.3.jar:git-Spigot-9a643a6-eb2e657]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936) ~[spigot-1.14.3.jar:git-Spigot-9a643a6-eb2e657]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3978) ~[spigot-1.14.3.jar:git-Spigot-9a643a6-eb2e657]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3914) ~[spigot-1.14.3.jar:git-Spigot-9a643a6-eb2e657]
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530) ~[spigot-1.14.3.jar:git-Spigot-9a643a6-eb2e657]
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683) ~[spigot-1.14.3.jar:git-Spigot-9a643a6-eb2e657]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2495) ~[spigot-1.14.3.jar:git-Spigot-9a643a6-eb2e657]
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1903) ~[spigot-1.14.3.jar:git-Spigot-9a643a6-eb2e657]
at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2124) ~[spigot-1.14.3.jar:git-Spigot-9a643a6-eb2e657]
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1801) ~[spigot-1.14.3.jar:git-Spigot-9a643a6-eb2e657]
at com.mysql.jdbc.PreparedStatement.executeBatchInternal(PreparedStatement.java:1307) ~[spigot-1.14.3.jar:git-Spigot-9a643a6-eb2e657]
at com.mysql.jdbc.StatementImpl.executeBatch(StatementImpl.java:970) ~[spigot-1.14.3.jar:git-Spigot-9a643a6-eb2e657]
at com.sk89q.worldguard.protection.managers.storage.sql.RegionInserter.insertCuboids(RegionInserter.java:125) ~[?:?]
at com.sk89q.worldguard.protection.managers.storage.sql.RegionInserter.apply(RegionInserter.java:184) ~[?:?]
at com.sk89q.worldguard.protection.managers.storage.sql.DataUpdater.executeSave(DataUpdater.java:129) ~[?:?]
at com.sk89q.worldguard.protection.managers.storage.sql.DataUpdater.saveChanges(DataUpdater.java:73) ~[?:?]
at com.sk89q.worldguard.protection.managers.storage.sql.SQLRegionDatabase.saveChanges(SQLRegionDatabase.java:268) ~[?:?]
... 4 more```
Comment by prettydude
Some more details. It looks like a player has deleted and created a region with the same name before WG managed to save the changes.
[13:57:55] [Server thread/INFO]: wallstrom issued server command: /region delete home1
[13:58:03] [Server thread/INFO]: wallstrom issued server command: /region claim home1
[13:58:10] [Timer-2/WARN]: [WorldGuard] Failed to save the region data for 'world' during a periodical save