jasonw4331 / MyPlot

Plot and protection plugin for PocketMine-MP
https://discord.gg/Qqcpp9Q
MIT License
101 stars 90 forks source link

The selected data provider crashed. JSON will be used instead. #415

Closed JustSxm closed 3 years ago

JustSxm commented 3 years ago

Issue description

"selected data provider crashed" happens on load, I am certain my database details are correct since it works with libasynql.

Steps to reproduce the issue

  1. ...

OS and versions

Other Plugins

I would assume the error happens because my password needs to be between double quotes since some characters occur an error in yaml_parse.

JustSxm commented 3 years ago

The errors comes from MySqlProvider:

if($this->db->connect_error !== ''){
throw new \RuntimeException("Failed to connect to the MySQL database: " . $this->db->connect_error);
}

$this->db->connect_error = NULL

changing to null fixes using the release

JustSxm commented 3 years ago

$stmt = $this->db->prepare("INSERT INTO mergedPlots (`originId`, `mergedId`) VALUES (?,?) ON DUPLICATE KEY UPDATE originId = VALUES(originId), mergedId = VALUES(mergedId);"); is the reason of the crash.

With Master branch

HighTecDev commented 3 years ago

How exactly do you think that this statement triggers a crash? Error message?

JustSxm commented 3 years ago

When you look at the value it returns, it returns false meaning the query failed (because the table mergedPlots does not exist)

BenasPaulikas commented 2 years ago

I'm also experiencing this issue. I'm almost sure about mysql connection.

[17:11:01.419] [Server thread/INFO]: Loading MyPlot v2.1.2
[17:11:01.427] [Server thread/DEBUG]: [MyPlot] Loading Configs
[17:11:01.428] [Server thread/DEBUG]: [MyPlot] Loading MyPlot Generator
[17:11:01.431] [Server thread/DEBUG]: [MyPlot] Loading Languages
[17:11:01.431] [Server thread/DEBUG]: [MyPlot] Loading Data Provider settings
[17:11:01.436] [Server thread/ERROR]: [MyPlot] The selected data provider crashed. JSON will be used instead.

So I've tried executing first mysql statement manually and got error

mysql> CREATE TABLE IF NOT EXISTS plotsV2 (level TEXT, X INT, Z INT, name TEXT, owner TEXT, helpers TEXT, denied TEXT, biome TEXT, pvp INT, price FLOAT, PRIMARY KEY (level, X, Z));
ERROR 1170 (42000): BLOB/TEXT column 'level' used in key specification without a key length

Is it possible to enable more logging ? Currently I don't even know what's the issue but I see that table can't be created

JustSxm commented 2 years ago

No you're not experimenting the same error. Please look at the error you have, it says it all. My error was related to the queries the plugin does itself

BenasPaulikas commented 2 years ago

Excuse me moved to https://github.com/jasonwynn10/MyPlot/issues/479