Plots are no longer claimable after some time - Database Error
Server Implementation
Paper
Server Version
1.21.3 (1.21.3-82-5a60ffb)
Describe the bug
After some time, players are unable to claim plots anymore. Neither /p auto nor /p claim work. In the console, I receive the following message repeatedly: [PlotSquared/Claim] Failed to add plot to database: 12,17. This occurs for every attempted claim. There are no further stack traces in the logs.
However, when shutting down the server, to fix the issue, multiple exceptions appear:
In the meantime, the server freezes and does not shut down, so I have to kill it.
To Reproduce
I'm not sure how exactly to reproduce this issue, as it has only happened about once or twice per month over the last few years. However, today alone it occurred three times on a freshly set up server where many plot commands are being executed. This server was just launched today, and with 100 players actively using it, a lot of plot-related commands are being run.
Expected behaviour
Players should be able to continuously claim plots without issues, and database interactions should function reliably.
Screenshots / Videos
No response
Error log (if applicable)
No response
Plot Debugpaste
I prefer not to include a debugpaste as it may contain sensitive plugin and data information. However, I have discussed this with Pierre, and he has a debugpaste available.
PlotSquared Version
PlotSquared-7.4.1-Premium
Checklist
- [ ] I have included a Plot debugpaste.
- [x] I am using the newest build from https://www.spigotmc.org/resources/77506/ and the issue still persists.
Anything else?
- I'm using MySQL as the database backend,
mariadb:11 - The database connection is confirmed to be stable, all other actions can still be executed - e.g. adding flags etc. and other servers are also connected to the MySQL Service.
But you've not given us any configuration or even the full error
But you've not given us any configuration or even the full error
The relevant configs: https://gist.github.com/ByteExceptionM/97bef06ba2c7b1ccd2c7c8f369f2a907
And yes, it is unfortunately the entire error. As I already wrote, there is no stacktrace for the message Failed to add plot to database. See here.
When we were writing in DMs, my first thought after seeing Can't call commit when autocommit=true was some kind of race condition. After looking at the code, PS sets auto commit to false where required / applicable, but as we don't do connection pooling (i think?) maybe the connection is used with auto commit somewhere between disabling auto commit and committing a batch statement. Or it was just missed somewhere. But I haven't looked further into it.
is there another plugin potentially reusing the P2 db connectionm and/or messing with it somehow?
Not that I know of. There is no other plugin that works in direct connection with the PlotSquared database. However, I can also send you the debug paste if you need it. Feel free to add me on Discord, "masel.io"
I have the same bug. This may be because PlotSquared doesn't really advertise to be bungeecord friendly and instead uses worlds to identify plots. That means that Plots on different Servers inside the same world will also use the same fricking plot claims but the plugin doesn't know how to directly handle it so it just tells you it failed to add it to the database.
This is a massive oversight, as it makes the SQL-Storage completely(!) useless as this can't even be seen as a sync feature as the other server thinks it is not even claimed.
Will this be fixed? Is this expected/known? I can't find anybody talking about bungeecord....but why should one use sql on a single server instance...
Greetings :) Hope I could help...
Yeah you should never be using one database for multiple servers for P2......
This is not an "oversight"... It does not make SQL useless? It was never designed for multiple servers, and likely never will be. That's a choice you need to make to be able to support yourself. One should use SQL on a single server because you're better able to keep it backed up, it doesn't necessarily take up storage space on your actual server, it can be more performant...
I am only using a single database for one server, but it is running on a large MySQL instance. The issue described by @PaBox, regarding multiple servers sharing the same database, does not apply to my setup.
The assumption that BungeeCord is causing this issue does not make sense in the context of how PlotSquared and SQL work. BungeeCord itself has no impact on database operations or plot management - it simply acts as a proxy for player connections. PlotSquared runs entirely on the backend server, and all database transactions happen independently of BungeeCord. Whether a player joins via a proxy or directly does not change how PlotSquared interacts with the database.
Additionally, PlotSquared identifies plots based on world names, so if multiple servers use the same world name in a shared database, there’s no way to differentiate them. This would cause overlapping plot claims, data inconsistencies, and failed transactions - essentially breaking the system. So you definitely shouldn't use it that way.
I am only using a single database for one server, but it is running on a large MySQL instance. The issue described by @PaBox, regarding multiple servers sharing the same database, does not apply to my setup.
The assumption that BungeeCord is causing this issue does not make sense in the context of how PlotSquared and SQL work. BungeeCord itself has no impact on database operations or plot management - it simply acts as a proxy for player connections. PlotSquared runs entirely on the backend server, and all database transactions happen independently of BungeeCord. Whether a player joins via a proxy or directly does not change how PlotSquared interacts with the database.
Additionally, PlotSquared identifies plots based on world names, so if multiple servers use the same world name in a shared database, there’s no way to differentiate them. This would cause overlapping plot claims, data inconsistencies, and failed transactions - essentially breaking the system. So you definitely shouldn't use it that way.
I think you are misunderstanding what I meant. Yes Bungeecord is not the reason why it is no working. But yet, it is - or more the generell idea of a proxy. You see, with multiverse for example there is no proxy, 1 Server, multiple worlds possible. In this scenario, there is only 1 plugin and so mysql does not really make sense over sqlite and plot claims are referenced by a world-name, BUT NO SERVERNAME! (maybe perfomance? Could you tell me the reason you are using mysql?) This means, running different servers with the same world-name (like "world") will lead to plotsquared instances being confused, as a claimed plot from another server will have the same entry as a claimed plot on another server and there is NO way to differentiate, as you said. So the solution would be adding an sql table column called "server-name".
P.S. As stated, I don't understand the mysql database if there is no ability to share it when using the same world names :) Any help is appreciated ^^
P.P.S. This is what your own issue says: "The database connection is confirmed to be stable, all other actions can still be executed - e.g. adding flags etc. and other servers are also connected to this database" - you definitly have a proxy or not, you said multiple servers...
You can also add me on discord if you want: @pabox
I think you are misunderstanding what I meant. Yes Bungeecord is not the reason why it is no working. But yet, it is - or more the generell idea of a proxy. You see, with multiverse for example there is no proxy, 1 Server, multiple worlds possible. In this scenario, there is only 1 plugin and so mysql does not really make sense over sqlite and plot claims are referenced by a world-name, BUT NO SERVERNAME! (maybe perfomance? Could you tell me the reason you are using mysql?) This means, running different servers with the same world-name (like "world") will lead to plotsquared instances being confused, as a claimed plot from another server will have the same entry as a claimed plot on another server and there is NO way to differentiate, as you said. So the solution would be adding an sql table column called "server-name".
P.S. As stated, I don't understand the mysql database if there is no ability to share it when using the same world names :) Any help is appreciated ^^
Then change the table prefix in the database settings... That's what it's there for...
I think you are misunderstanding what I meant. Yes Bungeecord is not the reason why it is no working. But yet, it is - or more the generell idea of a proxy. You see, with multiverse for example there is no proxy, 1 Server, multiple worlds possible. In this scenario, there is only 1 plugin and so mysql does not really make sense over sqlite and plot claims are referenced by a world-name, BUT NO SERVERNAME! (maybe perfomance? Could you tell me the reason you are using mysql?) This means, running different servers with the same world-name (like "world") will lead to plotsquared instances being confused, as a claimed plot from another server will have the same entry as a claimed plot on another server and there is NO way to differentiate, as you said. So the solution would be adding an sql table column called "server-name". P.S. As stated, I don't understand the mysql database if there is no ability to share it when using the same world names :) Any help is appreciated ^^
Then change the table prefix in the database settings... That's what it's there for...
But why should you use mysql if you DONT centralize the data? The reason I wanted to merge it is for /plot home for example - changing the index does only seperate the databade which was NOT my point. I always WANT to centrilaze data, thats what a database is for in most cases. The only way its not POSSIBLE to work is because a servername identifier is missing from the sql dataset.
I am studying it so I know what I am talking about ...
Ok so in the end, plotsquared just has no support for conmecting proxy setups/multiple instances together, but independent instances will work.
Will @author state what the other servers are, if no other mc-servers?
Ok so in the end, plotsquared just has no support for conmecting proxy setups/multiple instances together, but independent instances will work.
Will @author state what the other servers are, if no other mc-servers?
You must have misunderstood. I was talking about other minecraft servers that are connected to MySQL - with the MySQL service. I did not mean that there are other minecraft servers that use the same database. I just wanted to emphasise that the MySQL service is reachable, not that several servers use the same database.
I have changed this in my issue so that it is easier to understand.
Nvm, you said every plot is affected - so no matter where you try to save?
Ok so in the end, plotsquared just has no support for conmecting proxy setups/multiple instances together, but independent instances will work. Will @author state what the other servers are, if no other mc-servers?
You must have misunderstood. I was talking about other minecraft servers that are connected to MySQL - with the MySQL service. I did not mean that there are other minecraft servers that use the same database.
Are you sure its not the same database? Because going by the error there is already a plot there...have you tried changing the prefix on one server to see where it saves? Or are you generally using 1 database per server?
Yes, I am very sure. As described above, the error does not occur immediately, but only once every few months. I have a network with over 1,000,000 plots in all databases. So the error should have happened much earlier if the servers were using the same database. The Minecraft servers have also been running for almost 7 years now. I would definitely have noticed if there was an error there.
Oh lol maybe a storage problem? Probably not...
Maybe try with a newer jar? Could be corrupted...We also have a server with around 200 different players and 200+plots. We have never seen this problem.
Its also mysql exclusive, right? With SQLite, it doesnt happen?
Oh lol maybe a storage problem? Probably not...
Maybe try with a newer jar? Could be corrupted...We also have a server with around 200 different players and 200+plots. We have never seen this problem.
Its also mysql exclusive, right? With SQLite, it doesnt happen?
hard drive has enough free space, if that's what you mean. And the write speed should not be an issue either. MySQL runs on a dedicated machine with good hardware.
I'm already just about up and running with the latest PlotSquared. I have never tried it with SQLite. I can't just change it easiyl. I have been running MySQL since the beginning, for 7 years now.
We need the full log. The SQL manager in P2 does play around with autocommit, and it could be caused by a race condition, or an error somewhere causing autocommit not to be (re)set. Is it consistently on server shutdown?
Oh lol maybe a storage problem? Probably not... Maybe try with a newer jar? Could be corrupted...We also have a server with around 200 different players and 200+plots. We have never seen this problem. Its also mysql exclusive, right? With SQLite, it doesnt happen?
hard drive has enough free space, if that's what you mean. And the write speed should not be an issue either. MySQL runs on a dedicated machine with good hardware.
I'm already just about up and running with the latest PlotSquared. I have never tried it with SQLite. I can't just change it easiyl. I have been running MySQL since the beginning, for 7 years now.
I dont mean because of version, but corruption. There is a command to switch between sqlite and mysql. But I just say this because you could test it in your setup to see if it makes a difference regarding the error. Maybe autocommiting isnt handled right somewhere in the code - sqlite has much simpler construction.
We need the full log. The SQL manager in P2 does play around with autocommit, and it could be caused by a race condition, or an error somewhere causing autocommit not to be (re)set. Is it consistently on server shutdown?
I can send you a log via DM. I'd have to prepare it for you, as there are almost 200 players per server online at any one time, so there's a lot of data in there. And the error that no more plots can be claimed occurs spontaneously, when this error occurs, the exception with autocommit is thrown when shutting down the server.
I can send you a log via DM. I'd have to prepare it for you, as there are almost 200 players per server online at any one time, so there's a lot of data in there. And the error that no more plots can be claimed occurs spontaneously, when this error occurs, the exception with autocommit is thrown when shutting down the server.
Just need the full log of the shutdown + error. There's a little bit of stacktrace and potentially context lost in the screenshot
I can send you a log via DM. I'd have to prepare it for you, as there are almost 200 players per server online at any one time, so there's a lot of data in there. And the error that no more plots can be claimed occurs spontaneously, when this error occurs, the exception with autocommit is thrown when shutting down the server.
Just need the full log of the shutdown + error. There's a little bit of stacktrace and potentially context lost in the screenshot
Here is the logs after PlotSquared is disabled: https://api.mclo.gs/1/raw/6gxMzx3. The logs then stop because I then killed the container, because nothing happened for a few minutes.
I checked the shutdown again, there were no other anomalies, no errors, no warnings, no exceptions. If you still want the complete shutdown, I would add you on Discord and send it to you there.
Could you potentially share the part of that log output?
(Including surrounding lines)
Could you potentially share the part of that log output?
(Including surrounding lines)
Sure: https://api.mclo.gs/1/raw/OOLXMPj