EssentialsX

EssentialsX

2M Downloads

EssentialsX_Economy + PawEconomy = Server halt / Server crash

Tia-Paw opened this issue ยท 5 comments

commented

Type of bug

Other unexpected behaviour

/ess dump all output

https://github.com/Tia-Paw/errors-uploaded/blob/main/error-1.txt

Error log (if applicable)

https://github.com/Tia-Paw/errors-uploaded/blob/main/error-1.txt

Bug description

Using a plugin that's currency takes longer to transmit (PawEconomy/BananoCraft), halts the entire server due to EssentialsX using the main thread for the calculation.

Steps to reproduce

  1. Set up PaperMC server
  2. Add BananoCraft (I forked it, that's why I called it PawEconomy) plugin
  3. Add EssentialsX plugin
  4. Add Vault plugin
  5. Sell to the server with the "/sell hand" command
  6. Watch everything halt until the process is complete, or even crash

Expected behaviour

Server works normal while calculation is done.

Actual behaviour

Server become unresponsive while calculation is done, or crashes.

commented

PawEconomy is making blocking HTTP requests on the main server thread. You will need to ask the author of that plugin to fix it, as this isn't something that Essentials can or would be able to fix.

commented

Is there a reason why the sell function doesn't utilize this?:

Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {}

I am still learning so I might be dense here, but it seems as if this could solve the issue.

No shame in being a beginner, basically: Essentials uses Vault, and the methods provided via that API are synchronous. If the task was to run asynchronously the entire API would need to be designed around that so that results can be passed appropriately. Also not everything is thread-safe (especially if it touches the Bukkit API). The solution is just to not do an HTTP request in your handling code, or handle it async somehow in a way that makes sense in the context of the Vault API.

commented

Is there a reason why the sell function doesn't utilize this?:

Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {}

I am still learning so I might be dense here, but it seems as if this could solve the issue.

commented

Is there a reason why the sell function doesn't utilize this?:

Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {}

I am still learning so I might be dense here, but it seems as if this could solve the issue.

It's not a safe operation to do async, economy plugins may modify gamestate. PawEconomy should be doing the HTTP request async.

commented

Thanks, gotta take a look into that!