Unhandled exception executing command 'setplayerspawn' in plugin HomeSpawnPlus v2.0-SNAPSHOT-b602
afroman84 opened this issue · 8 comments
this is the pastebin: http://pastebin.com/Haikkva4
this occurs when i try to setplayerspawn to that player. Using last build, 602.
My best guess as to what's going on here is that a PlayerSpawn was set to a specific Spawn and then that Spawn was later deleted. Then when a strategy tries to use that PlayerSpawn, it tries to look up the referenced Spawn and gets the Entity is deleted error (since the referenced Spawn no longer exists).
Does this explanation match what is happening on your server? ie. you are using PlayerSpawn's as part of your events and you've deleted Spawns that players may have used?
I'll have to think on how best to handle this. Ideally the DB would maintain referential integrity, but the databases ability to do so is not easily consistent across the various DB platforms that are supported (MySQL, various versions of Sqlite are the two most common). So I will likely have to add some checks in the application itself to prevent this situation from occurring and give the admin options for deleting spawns that PlayerSpawn objects are already tied to.
Oh. Upon inspection of the code base to consider how to add this protection, it turns out it's already there:
When a spawn is deleted, this method is called and the first thing it does before deleting the Spawn is delete any PlayerSpawn objects that were associated with it. This means, barring some error with this code executing when you deleted a spawn (should be an error stack trace), it should not be possible for the situation I suggested to happen.
Could you upload a copy of your HSP database? If it's SQLite, the HomeSpawnPlus.db is what I need, if it's MySQL, you'd have to take a backup of your tables and ZIP them up. I can then load it up and look through it for inconsistencies. It's also possible this stack trace is related to a runtime issue with the EBEANS server and it might be cleared on server reboot; examining your database should tell me whether that's the case or not.
Yes I rebooted and tried but seems the same error; could i correct manually
the db looking for that player and modifying the spawn correspondent entry?
Or do I still until you find out how to menage this situation? It is not a
urgent issue but maybe it will happen again when a player who had that
deleted spawnpoint will die and not have a bed trying to look for a player
local spawn.
Il giorno Mar 3 Feb 2015 23:47 andune [email protected] ha scritto:
Have you rebooted the server between the time you deleted the spawn point
and the time that you tried to run this /setplayerspawn command? If not,
could you try rebooting the server and then run the same /setplayerspawn
command?If you get the same stack trace after a reboot, that will rule out an
ebeans cache issue and means the problem is in the database itself. Which
will be a bit harder to troubleshoot (since the previously linked code
should prevent this so I've no idea why it would be happening at this
point), but at least I'll know the scope of the problem.—
Reply to this email directly or view it on GitHub
#32 (comment).
If you're familiar with SQL, yes this is easily correctable. Something like so:
select id, spawn_id from hsp_playerspawn where player_name='luisancraft';
Examine the output. For each spawn_id returned:
select * from hsp_spawn where id=x;
One of them will not return a row (because the spawn was deleted). Let's assume it was id=20. So now you've found the id of the spawn that was deleted and you can mass-cleanup your entire playerSpawn table in one go:
delete from hsp_playerspawn where spawn_id=20;
You might consider running a "select * from" before "delete from" just to be sure you're deleting the right data. (and it's always good to make a backup copy before you start mucking with your database)
Ideally, that last "delete from hsp_playerspawn" query you're running was run by HSP prior to deleting the Spawn (that was the linked code). For some reason that didn't happen. If you find a stack trace error from your logs from when you deleted the spawn, that might help me find out why.
You guess right, I had a spawnpoint that I deleted because I found out that
the default world spawn concurs with the other created spawn points.
So I deleted the spawnpoint that was in the same coordinates of the default
one, if I didn't I would have a spawn point with the double chance to be
selected.
I will send you the database dump or the sql as soon as possible, but as I
said I delete one previously set spawnpoint for being at the same position
of the default one.
Il 03/Feb/2015 22:55 "andune" [email protected] ha scritto:
Oh. Upon inspection of the code base to consider how to add this
protection, it turns out it's already there:When a spawn is deleted, this method is called and the first thing it does
before deleting the Spawn is delete any PlayerSpawn objects that were
associated with it. This means, barring some error with this code executing
when you deleted a spawn (should be an error stack trace), it should not be
possible for the situation I suggested to happen.Could you upload a copy of your HSP database? If it's SQLite, the
HomeSpawnPlus.db is what I need, if it's MySQL, you'd have to take a backup
of your tables and ZIP them up. I can then load it up and look through it
for inconsistencies. It's also possible this stack trace is related to a
runtime issue with the EBEANS server and it might be cleared on server
reboot; examining your database should tell me whether that's the case or
not.—
Reply to this email directly or view it on GitHub
#32 (comment).
Have you rebooted the server between the time you deleted the spawn point and the time that you tried to run this /setplayerspawn command? If not, could you try rebooting the server and then run the same /setplayerspawn command?
If you get the same stack trace after a reboot, that will rule out an ebeans cache issue and means the problem is in the database itself. Which will be a bit harder to troubleshoot (since the previously linked code should prevent this so I've no idea why it would be happening at this point), but at least I'll know the scope of the problem.
Ok, so what do you think of this query: update hsp_playerspawn set
spawn_id='11' where spawn_id='3'
Of course 3 is the deleted spawn and 11 is the other spawn.
Will this fix possible errors from all players with the deleted spawn_id?
What do the X Y and z columns mean in the hsp_playerspawn table? Are them
the spawn_id coordinates?
Il 04/Feb/2015 00:12 "andune" [email protected] ha scritto:
If you're familiar with SQL, yes this is easily correctable. Something
like so:select id, spawn_id from hsp_playerspawn where player_name='luisancraft';
Examine the output. For each spawn_id returned:
select * from hsp_spawn where id=x;
One of them will not return a row (because the spawn was deleted). Let's
assume it was id=20. So now you've found the id of the spawn that was
deleted and you can mass-cleanup your entire playerSpawn table in one go:delete from hsp_playerspawn where spawn_id=20;
You might consider running a "select * from" before "delete from" just to
be sure you're deleting the right data.Ideally, that last "delete from hsp_playerspawn" query you're running was
run by HSP prior to deleting the Spawn (that was the linked code). For some
reason that didn't happen. If you find a stack trace error from your logs
from when you deleted the spawn, that might help me find out why.—
Reply to this email directly or view it on GitHub
#32 (comment).
I updated the table with that query and no more errors on /setplayerspawn
luisancraft 11 (the default world spawn spawn_id). Happy =)
May I suggest you to have a sort of command which returns player' s
informations like what is his spawnpoint and where and if he has a bed and
where?
How could this problem be avoided in future by the plugin itself? I'll try
to find the log of that day I deleted the spawn, but if I remember well no
errors where launched when I deleted it.
Thank you so much for your support.
Il 04/Feb/2015 03:37 "Alessandro" [email protected]
ha scritto:
Ok, so what do you think of this query: update hsp_playerspawn set
spawn_id='11' where spawn_id='3'
Of course 3 is the deleted spawn and 11 is the other spawn.
Will this fix possible errors from all players with the deleted spawn_id?
What do the X Y and z columns mean in the hsp_playerspawn table? Are them
the spawn_id coordinates?
Il 04/Feb/2015 00:12 "andune" [email protected] ha scritto:If you're familiar with SQL, yes this is easily correctable. Something
like so:select id, spawn_id from hsp_playerspawn where player_name='luisancraft';
Examine the output. For each spawn_id returned:
select * from hsp_spawn where id=x;
One of them will not return a row (because the spawn was deleted). Let's
assume it was id=20. So now you've found the id of the spawn that was
deleted and you can mass-cleanup your entire playerSpawn table in one go:delete from hsp_playerspawn where spawn_id=20;
You might consider running a "select * from" before "delete from" just to
be sure you're deleting the right data.Ideally, that last "delete from hsp_playerspawn" query you're running was
run by HSP prior to deleting the Spawn (that was the linked code). For some
reason that didn't happen. If you find a stack trace error from your logs
from when you deleted the spawn, that might help me find out why.—
Reply to this email directly or view it on GitHub
#32 (comment)
.