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

Database queries are run on the primary server thread #1920

Open
2 tasks done
seyfahni opened this issue Jul 3, 2022 · 0 comments
Open
2 tasks done

Database queries are run on the primary server thread #1920

seyfahni opened this issue Jul 3, 2022 · 0 comments
Labels
Bug A bug in the code or in a documentation. Confirmed Something is confimed.

Comments

@seyfahni
Copy link
Member

seyfahni commented Jul 3, 2022

Confirm the following

  • I use the latest release or dev-build. I also checked that this problem hasn't already been fixed in a newer dev-build.
  • There are no open or closed issues that are related to my problem.

BetonQuest version information

BetonQuest version: 2.0.0-DEV-331
Server version: git-Paper-386 (MC: 1.18.2)

Hooked into: Citizens (2.0.29-SNAPSHOT (build 2493)), LuckPerms (5.4.9), PlaceholderAPI (2.11.1), ProtocolLib (4.8.0), Vault (1.7.3-b131), WorldEdit (7.2.10-SNAPSHOT+6117-e21ab6a), WorldGuard (7.0.6+1cff55f), mcMMO (2.1.210-SNAPSHOT)

Expected behaviour

No SQL query is ever executed on the primary server thread.

Actual behaviour

Every time BetonQuest.getPlayerData() or BetonQuest.getOfflinePlayerData() is called for a player that is not yet present in the playerDataMap a new PlayerData object is created.
During the creation of that object loadAllPlayerData() is called, which executes SQL queries. As no care was taken for when that method is called, it is used from the primary server thread on many occasions.

Steps to reproduce

  1. Configure a debugger to only break on the primary server thread in the PlayerData constructor.
  2. Start the server and attach the debugger.
  3. Join the server. Order is important, this has to happen after attaching the debugger!
  4. Do some quests until the debugger triggers (the first time your player data is used).
  5. Step through the loadAllPlayerData() and watch the SQL queries execute.

Error, Warning, Exception or Thread Dump

No response

Additional information

No response

@seyfahni seyfahni added Bug A bug in the code or in a documentation. Confirmed Something is confimed. labels Jul 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in the code or in a documentation. Confirmed Something is confimed.
Projects
Status: Todo
Development

No branches or pull requests

1 participant