Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating to SQL causes PlayerData save threads to throw NullPointerException #369

Closed
tinyoverflow opened this issue Sep 11, 2018 · 3 comments
Labels
🐛Bug Issue is a validated bug report.

Comments

@tinyoverflow
Copy link

tinyoverflow commented Sep 11, 2018

What behaviour is observed:

Migrating playerdata from filesystem to database results in a NullPointerException. Not a single line gets imported. Importing claimdata works fine.
When this happens, the data has been moved from PlayerData to PlayerData1, but the PlayerData folder still exists while it is empty.

What behaviour is expected:

The migration should work without any issues.

Steps/models to reproduce:

Try to import existing file data. This happens with all PlayerData files.

Spigot/Craftbukkit/Paper and GriefPrevention version:

GriefPrevention 16.9 (happens also on 16.8)
Spigot 1.13.1-R0.1-SNAPSHOT (git-Spigot-500ff5d-b6bf6aa)

Stack trace/error

[23:11:49 WARN]: Exception in thread "Thread-50"
[23:11:49 WARN]: java.lang.NullPointerException
[23:11:49 WARN]: 	at me.ryanhamshire.GriefPrevention.DatabaseDataStore.savePlayerData(DatabaseDataStore.java:522)
[23:11:49 WARN]: 	at me.ryanhamshire.GriefPrevention.DatabaseDataStore.overrideSavePlayerData(DatabaseDataStore.java:517)
[23:11:49 WARN]: 	at me.ryanhamshire.GriefPrevention.DataStore.asyncSavePlayerData(DataStore.java:932)
[23:11:49 WARN]: 	at me.ryanhamshire.GriefPrevention.DataStore$SavePlayerDataThread.run(DataStore.java:1811)

Plugin list (if applicable):

  • GriefPrevention 16.9
  • Vault 1.7.1-b91
@RoboMWM
Copy link

RoboMWM commented Sep 12, 2018

Try with only a few playerdata files, also please list quantity of playerdata files and claims. I suspect a playerdata file may be corrupted.

Also, why are you switching to SQL?

@tinyoverflow
Copy link
Author

tinyoverflow commented Sep 12, 2018

Thank you for your fast reply!

As requested, I've retried it with 2 player- and 76 claim-files. They can be processed by the plugin itself on the production server, so I assume that they're not corrupted. Due to the line in code where this happens, I don't think that this may be related to the files itself.

I also noticed that the mentioned error message above only appears after the plugin itself prints out that the migration itself has been completed.

In the following I'll send you the full log from GriefPrevention:

[02:36:08 INFO]: [GriefPrevention] Enabling GriefPrevention v16.9
[02:36:09 INFO]: [GriefPrevention] Siege Configuration: Material not found: LONG_GRASS.
[02:36:09 INFO]: [GriefPrevention] Siege Configuration: Material not found: THIN_GLASS.
[02:36:09 INFO]: [GriefPrevention] Siege Configuration: Material not found: WOOD.
[02:36:09 INFO]: [GriefPrevention] Siege Configuration: Material not found: WOOL.
[02:36:09 INFO]: [GriefPrevention] Finished loading configuration.
[02:36:10 INFO]: [GriefPrevention] Unable to set next schema version to 3.  Details:
[02:36:10 INFO]: [GriefPrevention] SQL String can not be NULL
[02:36:10 INFO]: [GriefPrevention] 0 total claims loaded.
[02:36:11 INFO]: [GriefPrevention] Customizable messages loaded.
[02:36:11 INFO]: [GriefPrevention] There appears to be some data on the hard drive.  Migrating those data to the database...
[02:36:12 INFO]: [GriefPrevention] 76 total claims loaded.
[02:36:12 INFO]: [GriefPrevention] Customizable messages loaded.
[02:36:13 INFO]: [GriefPrevention] Backed your file system data up to ClaimData1 and PlayerData1.
[02:36:13 INFO]: [GriefPrevention] If your migration encountered any problems, you can restore those data with a quick copy/paste.
[02:36:13 INFO]: [GriefPrevention] When you're satisfied that all your data have been safely migrated, consider deleting those folders.
[02:36:13 INFO]: [GriefPrevention] Data migration process complete.  Reloading data from the database...
[02:36:13 WARN]: Exception in thread "Thread-9"
[02:36:13 WARN]: java.lang.NullPointerException
[02:36:13 INFO]: [GriefPrevention] 76 total claims loaded.
[02:36:13 WARN]: 	at me.ryanhamshire.GriefPrevention.DatabaseDataStore.savePlayerData(DatabaseDataStore.java:522)
[02:36:13 WARN]: 	at me.ryanhamshire.GriefPrevention.DatabaseDataStore.overrideSavePlayerData(DatabaseDataStore.java:517)
[02:36:13 WARN]: 	at me.ryanhamshire.GriefPrevention.DataStore.asyncSavePlayerData(DataStore.java:932)
[02:36:13 WARN]: 	at me.ryanhamshire.GriefPrevention.DataStore$SavePlayerDataThread.run(DataStore.java:1811)
[02:36:13 WARN]: Exception in thread "Thread-8"
[02:36:13 WARN]: java.lang.NullPointerException
[02:36:13 WARN]: 	at me.ryanhamshire.GriefPrevention.DatabaseDataStore.savePlayerData(DatabaseDataStore.java:522)
[02:36:13 WARN]: 	at me.ryanhamshire.GriefPrevention.DatabaseDataStore.overrideSavePlayerData(DatabaseDataStore.java:517)
[02:36:13 WARN]: 	at me.ryanhamshire.GriefPrevention.DataStore.asyncSavePlayerData(DataStore.java:932)
[02:36:13 WARN]: 	at me.ryanhamshire.GriefPrevention.DataStore$SavePlayerDataThread.run(DataStore.java:1811)
[02:36:14 INFO]: [GriefPrevention] Customizable messages loaded.
[02:36:14 INFO]: [GriefPrevention] Finished loading data (Database Mode).
[02:36:14 INFO]: [GriefPrevention] GriefPrevention requires Vault for economy integration.
[02:36:14 INFO]: [GriefPrevention] Attempting to load Vault...
[02:36:14 INFO]: [GriefPrevention] Vault loaded successfully!
[02:36:14 INFO]: [GriefPrevention] Looking for a Vault-compatible economy plugin...
[02:36:14 INFO]: [GriefPrevention] ERROR: Vault was unable to find a supported economy plugin.  Either install a Vault-compatible economy plugin, or set both of the economy config variables to zero.
[02:36:14 INFO]: [GriefPrevention] Boot finished.

This test server uses a local mariadb instance (version 10.3.9) started in Docker. The tables itself are being created. Also the claimdata is migrated:
screenshot


Also, why are you switching to SQL?

We want easy access to the claim- and player-data from outside (a webinterface for example).

@RoboMWM
Copy link

RoboMWM commented Sep 19, 2018

Fun. So it's closing the database on the main thread while there still are other threads attempting to save PlayerData to it. He just closes it and then re-instantiates a new instance of DatabaseDataStore. Not sure why... but I just removed that so it remains open. I don't recommend using SQL especially since for what GP needs to do, SQL hardly provides any benefits (if anything, the extra overhead compared to flatfiles is a detriment).

@RoboMWM RoboMWM changed the title Migrating PlayerData crashes with NullPointerException Migrating to SQL causes PlayerData save threads to throw NullPointerException Sep 19, 2018
@RoboMWM RoboMWM added the 🐛Bug Issue is a validated bug report. label Sep 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛Bug Issue is a validated bug report.
Projects
None yet
Development

No branches or pull requests

2 participants