-
Notifications
You must be signed in to change notification settings - Fork 72
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
Asynchronous block remove #1116
Comments
Comment by PseudoKnight This is a known risk when using threading. Only certain functions are threadsafe and almost none of the Minecraft ones are. The solution is to NEVER put set_block_at() inside a new thread. And in general do not use threads if you don't know the risks. |
Comment by LadyCailin You can, however, use x_run_on_main_thread. That will fix the problem. This stacktrace shouldn't be printing like this, but x_ functions aren't really supported, so, that's ok. Either way, all I would be able to do is improve the error message. In this case, you need to change your code. |
Comment by PseudoKnight Other async block placer plugins basically use a separate thread to calculate how many and which blocks they want to set every tick. Then they send that truncated list to the main thread (eg. x_run_on_main_thread) to set the blocks. They often disable block physics updates when setting the blocks, as that accounts for something like half of the cost of placing blocks. |
Is this issue still meaningful? The |
I have a proposal and a working prototype. We can use optimizeDynamic() in x_new_thread() to add warnings when using functions that return false from runAsync(). It traverses the children unless encountering a closure/iclosure. Works pretty well, but some functions have their runAsync() method configured incorrectly, so we'd have to make sure all There's a few other places where it should stop checking, like proc definitions and binds. This won't catch all cases where a function may be used off the main thread, but will help. (could use SA for better coverage?) Perhaps it might give people a misleading sense of confidence, though. It also doesn't catch run time problems, which are left up to the server. |
CMDHELPER-3118 - Reported by EntryPoint
commandhelper generate error when i wrote set_block_at() in x_new_thread()
look at this screenshot
code:
http://pastebin.com/KXQXmFGa
error log:
http://pastebin.com/V4NqpZRi
The text was updated successfully, but these errors were encountered: