Cuberite Forum
Server down on multiworld - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Discussion (https://forum.cuberite.org/forum-5.html)
+--- Thread: Server down on multiworld (/thread-2125.html)



Server down on multiworld - DrMasik - 09-18-2015

I found stable solution for server down Sad

There are 2 players. First login to World1, second - World2. Default for all other players - World0. All names are lowercase.

When player spawn, I check login (GetName()) and move it to needed world (World1 or World2) into home as building. So, let show me cut of code:
function Initialize(Plugin)
-- ... Cut some code
  cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_SPAWNED, MyOnPlayerSpawned);
-- ... Cut some code
end

function MyOnPlayerSpawned(Player)
-- Cut some code

  if Player:GetName() == 'test1' then
    Player:MoveToWorld("world1");
  elseif Player:GetName() == 'test2' then
    Player:MoveToWorld("world2");
  end

  return false;
end

-- Cut some code

And there I have 2 bugs:
1. Player test1 into there home building, but, in world0. Home "copy" from world1 in to world0 and destroy world0 area where home "copy".
2. When player disconnect - server go down (core dump).

Server console log:
Code:
Info: [11:16:34] Player test1 has left the game
Error: [11:16:34]   D:    | MCServer has encountered an error and needs to close
Error: [11:16:34] Details | SIGSEGV: Segmentation fault
Error: [11:16:34] MCServer local build build id: Unknown
Error: [11:16:34] from commit id: approx: 4231dcf7e134a699cfdb7a88ff8116a123259480 built at: approx: 2015-08-16 10:26:59 +0200
Error: [11:16:34]   D:    | MCServer has encountered an error and needs to close
Error: [11:16:34] Details | SIGABRT: Server self-terminated due to an internal fault
Error: [11:16:34] MCServer local build build id: Unknown
Error: [11:16:34] from commit id: approx: 4231dcf7e134a699cfdb7a88ff8116a123259480 built at: approx: 2015-08-16 10:26:59 +0200
Abort trap (core dumped)



RE: Server down on multiworld - DrMasik - 09-22-2015

I'm download Windows version of server (buid 102) and catch when server goin down.
What I did:
1. Connect to server.
2. Server use HOOK_PLAYER_SPAWNED to run callback function MyOnPlayerSpawned -> Teleport player to world2.
3. I'm wait 5 seconds and disconnect.
4. Connect again to server.
(5.) Server use HOOK
6. I'm user /teleport to back to default world.
7. I'm disconnect.
8. Server going down with player count = (-1).

Code and screen shoot.

-- ...
    local OnAllChunksAvailable = function()
      console_log(func_name .." -> chunks redy for player ID ".. a_player:GetUniqueID(), 1);
      a_player:MoveToWorld("world2");
      a_player:TeleportToCoords(-8, 62, 3);
      a_player:SetGameMode(1);
    end

    -- Get world default spawn point
    local world = cRoot:Get():GetWorld("world2");
    local SpawnX = world:GetSpawnX();
    local SpawnZ = world:GetSpawnZ();

    -- Get player last bed position
    local PlayerX = (-8);
    local PlayerZ = 3;

    world:ChunkStay({{PlayerX, PlayerZ}, {SpawnX, SpawnZ}}, OnChunkAvailable, OnAllChunksAvailable);

-- ...

Any help or ideas?


RE: Server down on multiworld - Seadragon91 - 09-22-2015

Cuberite can not run well with two worlds at the moment.
Look here: 2286, 2056

Run cuberite with only one world or you could run multiple server instances of cuberite and connect them over bungeecord, that works fine.


RE: Server down on multiworld - DrMasik - 09-22-2015

(09-22-2015, 06:47 AM)Seadragon91 Wrote: Cuberite can not run well with two worlds at the moment.
Look here: 2286, 2056

Run cuberite with only one world or you could run multiple server instances of cuberite and connect them over bungeecord, that works fine.

Thank you. I spent more than 36 hours.... Thank you very much to links.
Where I can read about "bungeecord"?

Any link to source code for analyze?


RE: Server down on multiworld - Seadragon91 - 09-22-2015

Okay here a tutorial for it. Follow it step for step.
Choose a folder (i choose the name root for them) where you want to set up two servers and bungecord.

Bungeecord

  1. Create a folder named bungecord
  2. Download from this page http://ci.md-5.net/job/BungeeCord/ the file BungeeCord.jar and place it in the folder name bungeecord
  3. From cmd or terminal run
    Code:
    java -jar BungeeCord.jar
  4. After startup type end to stop bungeecord
  5. You have a file named config.yml open it with an editor
  6. Change the line host: 0.0.0.0:25577 to host: 0.0.0.0:25565
  7. Under servers change from lobby the port 25565 to 25566
  8. And add this lines under restricted: false from lobby:
    Code:
    world:
        motd: 'Another world'
        address: localhost:25567
        restricted: false

Cuberite lobby
  1. Add a cuberite server to the root and change the name to Cuberite_lobby
  2. Start the server and stop after finish
  3. Open the settings.ini
  4. Under section [Authentication]:
  5. Change Authenticate=1 to Authenticate=0
  6. Change AllowBungeeCord=0 to AllowBungeeCord=1
  7. Change the Ports=25565 to Ports=25566

Do the same steps above with another cuberite server and change the Ports=25565 to Ports=25567.
Start bungeecord and both cuberite servers. In the console of the cuberite servers will come from one the error, that the port 8080 is already in use. You change the port in the file webadmin.ini.

Connect to localhost with your minecraft client. And check if you can swap with the command
Code:
/server world
to the second server.

One problem with that is you would have to setup the permissions every time for both servers.

If something is unclear or not working, just post and ask.


RE: Server down on multiworld - LogicParrot - 08-28-2016

It's worth noting that this thread is old. World travel is pretty stable now.


RE: Server down on multiworld - ThuGie - 08-28-2016

Then why did you bump it ?
Pretty sure people notice its something from 2015..


RE: Server down on multiworld - DrMasik - 08-28-2016

(08-28-2016, 04:34 AM)LogicParrot Wrote: It's worth noting that this thread is old. World travel is pretty stable now.

I will check it and close or not the thread.


RE: Server down on multiworld - LogicParrot - 08-29-2016

(08-28-2016, 08:55 AM)ThuGie Wrote: Then why did you bump it ?
Pretty sure people notice its something from 2015..

I think we have things from 2014 that are still unfixed.Tongue
So, it's just to let people who stumble across this know this is no longer an issue.