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

/thaw 100000 crashes the server #4289

Open
wsw70 opened this Issue Aug 20, 2018 · 4 comments

Comments

Projects
None yet
4 participants
@wsw70
Copy link

wsw70 commented Aug 20, 2018

Client version: 1.12
Server OS: Ubuntu 18.4
Commit id: 89017df

Expected behavior

Some kind of safety net when issuing a command which crashes the server.

Actual behavior

Server crashed. The log is

     [19:38:52] Player PX_Viva is executing command "/thaw 100000" in world "world" at world age 502343.
Err  [19:39:12] Deadlock detected: world world has been stuck at age 502343. Aborting the server.
     [19:39:12] CS at 0x7f19796f9790, World world clients: RecursionCount = 1, ThreadIDHash = c53908d2e67e5952
     [19:39:12] CS at 0x7f1978fa8160, World world players: RecursionCount = 0, ThreadIDHash = c53908d2e67e5952
     [19:39:12] CS at 0x7f19796f9740, World world tasks: RecursionCount = 0, ThreadIDHash = c53908d2e67e5952
     [19:39:12] CS at 0x20af2d0, World world chunkmap: RecursionCount = 0, ThreadIDHash = c53908d2e67e5952
     [19:39:12] CS at 0x7f19787a2790, World world_nether clients: RecursionCount = 0, ThreadIDHash = 8a0a14db126294f5
     [19:39:12] CS at 0x7f1978051160, World world_nether players: RecursionCount = 0, ThreadIDHash = 8a0a14db126294f5
     [19:39:12] CS at 0x7f19787a2740, World world_nether tasks: RecursionCount = 0, ThreadIDHash = 8a0a14db126294f5
     [19:39:12] CS at 0x3499490, World world_nether chunkmap: RecursionCount = 0, ThreadIDHash = 8a0a14db126294f5
     [19:39:12] CS at 0x7f19737fa790, World world_the_end clients: RecursionCount = 0, ThreadIDHash = 59ba7f776a9d828a
     [19:39:12] CS at 0x7f19730a9160, World world_the_end players: RecursionCount = 0, ThreadIDHash = 59ba7f776a9d828a
     [19:39:12] CS at 0x7f19737fa740, World world_the_end tasks: RecursionCount = 0, ThreadIDHash = 59ba7f776a9d828a
     [19:39:12] CS at 0x34c5f30, World world_the_end chunkmap: RecursionCount = 0, ThreadIDHash = 59ba7f776a9d828a
     [19:39:12] CS at 0x20c31a0, cLuaState plugin ChatLog: RecursionCount = 0, ThreadIDHash = 39018edce4119b82
     [19:39:12] CS at 0x347af20, cLuaState plugin TestLuaRocks: RecursionCount = 0, ThreadIDHash = f457bd22cac02869
     [19:39:12] CS at 0x34803d0, cLuaState plugin NetworkTest: RecursionCount = 0, ThreadIDHash = f457bd22cac02869
     [19:39:12] CS at 0x3484880, cLuaState plugin DumpInfo: RecursionCount = 0, ThreadIDHash = f457bd22cac02869
     [19:39:12] CS at 0x348cf00, cLuaState plugin ProtectionAreas: RecursionCount = 0, ThreadIDHash = f457bd22cac02869
     [19:39:12] CS at 0x34c7090, cLuaState plugin WorldEdit: RecursionCount = 1, ThreadIDHash = c53908d2e67e5952
     [19:39:12] CS at 0x34c7740, cLuaState plugin APIDump: RecursionCount = 0, ThreadIDHash = f457bd22cac02869
     [19:39:12] CS at 0x4590e00, cLuaState plugin HookNotify: RecursionCount = 0, ThreadIDHash = f457bd22cac02869
     [19:39:12] CS at 0x4590f30, cLuaState plugin Debuggers: RecursionCount = 0, ThreadIDHash = f457bd22cac02869
     [19:39:12] CS at 0x4591060, cLuaState plugin Core: RecursionCount = 0, ThreadIDHash = c53908d2e67e5952
Err  [19:39:12]   D:    | Cuberite has encountered an error and needs to close
Err  [19:39:12] Details | SIGABRT: Server self-terminated due to an internal fault
Err  [19:39:12] Cuberite Jenkins clang x64 Release (master) build id: #1004
Err  [19:39:12] from commit id: 89017dfbbcb0750c07fe067f2b61cde94e4dc875 built at: Fri 17 Aug 15:46:50 UTC 2018

Steps to reproduce the behavior

Issuing /thaw 100000 by an 11 years old player (though the age may not matter)

@NiLSPACE

This comment has been minimized.

Copy link
Member

NiLSPACE commented Aug 21, 2018

The problem is that the amount of work required is so big the server thinks something has gone wrong. To fix this WorldEdit has to either block large requests or split them up in smaller chunks.

@wsw70

This comment has been minimized.

Copy link

wsw70 commented Aug 21, 2018

@NiLSPACE : yes, and that would mean that the server trusts the plugin to never go wrong.

This is probably a matter of philosophy but I believe that the server should be immune to this by limiting what a plugin can request from it (and abort the request, worst case). Or, to put it differently, never trust the user (without offloading this trust on the plugin)

@Pokechu22

This comment has been minimized.

Copy link
Contributor

Pokechu22 commented Aug 21, 2018

I would say that the deadlock detector is assuming stuff can go wrong and plugins can get caught in an infinite loop, and making sure things are handled in that case. Though aborting might be better than just crashing; I'm not sure how achievable that would be.

@Cl1608Ho

This comment has been minimized.

Copy link
Member

Cl1608Ho commented Aug 21, 2018

as a matter of philosophy, i strongly do not recommend limiting plugin's capabilities.

first thing: plugins are arbitrary code that runs in the server's context. if this code takes a long time for some computation, that's gonna take resources and might block the server. this is not the fault of the server and should not be attempted to be stopped (plus, if a plugin is blocking nonstop, the server can't even abort it without going into undefined state, which is basically why the deadlock detector provokes a crash)
second category, plugins running few instructions that result in heavy computation on cuberite's side. this can definitely be optimized, but i think appears only in those "set area of blocks" thing. we should split into chunks and process asynchronously.
third category, plugins running a lot of instructions that each result in small computation on cuberite's side but add up to a lot of work for the server. we should not care about those as the individual operation runs fine and even a bunch of those wont affect performance (otherwise i consider them heavy). it's at the plugin's discretion to handle these gracefully and split them over several ticks, etc.....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment