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

Status of async script loading #3743

Closed
TheDGOfficial opened this issue Feb 8, 2021 · 2 comments
Closed

Status of async script loading #3743

TheDGOfficial opened this issue Feb 8, 2021 · 2 comments
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. enhancement Feature request, an issue about something that could be improved, or a PR improving something. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation).

Comments

@TheDGOfficial
Copy link
Contributor

The asynchronous script loading config entry seems to be hidden and has to be manually added to the config to make it work. But, trying on a fresh 1.16.5 server with Skript v2.5.3 using only example scripts, it currently gives this error:

[05:15:04 WARN]: Exception in thread "Thread-5" java.lang.IllegalStateException: PreScriptLoadEvent may only be triggered synchronously.
[05:15:04 WARN]:        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:599)
[05:15:04 WARN]:        at ch.njol.skript.ScriptLoader.lambda$4(ScriptLoader.java:397)
[05:15:04 WARN]:        at ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:420)
[05:15:04 WARN]:        at ch.njol.skript.ScriptLoader.lambda$3(ScriptLoader.java:337)
[05:15:04 WARN]:        at ch.njol.skript.ScriptLoader$AsyncLoaderThread.run(ScriptLoader.java:310)

Few things there:

  • The "Thread-5" is not meaningful, it should be changed to something like "Skript async script loader" or such.

  • Events should have correct async calls to super constructor. (Cause of error)

  • Maybe re-add to the config with a warning in full caps that this may break things.

  • The loader thread is currently started even when this config option is disabled (or non-existent), and loops while (true) forever (it uses queues, which uses LockSupport#park, so it is performance friendly, but an useless thread drains thread stack, still.), so this line should be changed to only start the thread when isAsync method returns true: https://github.com/SkriptLang/Skript/blob/master/src/main/java/ch/njol/skript/ScriptLoader.java#L299

@TPGamesNL
Copy link
Member

TPGamesNL commented Feb 8, 2021

See #3324

Maybe re-add to the config with a warning in full caps that this may break things.

It's still true that asynchronous loading may break stuff, due to #3453

@TPGamesNL TPGamesNL added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. enhancement Feature request, an issue about something that could be improved, or a PR improving something. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation). labels Feb 20, 2021
@TPGamesNL
Copy link
Member

#1780
More things:

  • Log handler errors when reloading, due to Log handler system isn't thread safe #3453 and what's mentioned below
  • Skript gives the message that the script was reloaded before the reloading is done and removes the RedirectingLogHandler, so if a player reloading a script, they won't see any of the errors (they might if they're lucky, it's a race condition), as those will go to console.

@TPGamesNL TPGamesNL added PR available Issues which have a yet-to-be merged PR resolving it completed The issue has been fully resolved and the change will be in the next Skript update. and removed PR available Issues which have a yet-to-be merged PR resolving it labels May 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. enhancement Feature request, an issue about something that could be improved, or a PR improving something. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation).
Projects
None yet
Development

No branches or pull requests

3 participants