cuberite / cuberite

A lightweight, fast and extensible game server for Minecraft

Home Page:https://cuberite.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash on startup (Segmentation fault) on OpenWRT mips

loss-and-quick opened this issue · comments

Client version: unkown
Server OS: OpenWRT
Cuberite Commit id: ca705be

Expected behavior

Didn't crash on startup

Actual behavior

It crashes on startup

Steps to reproduce the behavior

Compile this project using OpenWRT SDK for ramips/mt7621 with cmake ... -DNO_NATIVE_OPTIMIZATION=YES ..

Server log

[b1072b10|16:22:56] --- Started Log ---
[b1072b10|16:22:56] Cuberite local build (id: Unknown)
[b1072b10|16:22:56] from commit approx: ca705be2649a205caac2a449704b55dd029ea13b built at: approx: 2023-10-18 23:32:02 +0300
[b1072b10|16:22:56] Creating new server instance...
[b1072b10|16:22:56] Reading server config...
[b1072b10|16:22:56] Regenerating settings.ini, all settings will be reset
[b1072b10|16:22:56] Starting server...
[b1072b10|16:22:56] Compatible clients: 1.8.x-1.14.4
[b1072b10|16:22:56] Compatible protocol versions 47, 107, 108, 109, 110, 210, 315, 316, 335, 338, 340, 393, 401, 477, 480, 485, 490, 498
[b1072b10|16:22:57] Generating protocol encryption keypair...
[b1072b10|16:22:57] Regenerating webadmin.ini, all settings will be reset
[b1072b10|16:22:57] Initialising WebAdmin...
[b1072b10|16:22:57] The webadmin is enabled but has no users configured. To add new users, edit webadmin.ini
[b1072b10|16:22:57] WebServer: The server will run in unsecured HTTP mode.
[b1072b10|16:22:57] Put a valid HTTPS certificate in file 'webadmin/httpscert.crt' and its corresponding private key to 'webadmin/httpskey.pem' (without any password) to enable HTTPS support
[b1072b10|16:22:57] Loading settings...
[b1072b10|16:22:58] Creating default ranks...
[b1072b10|16:22:58] Default ranks created.
[b1072b10|16:22:58] Loading crafting recipes from crafting.txt...
[b1072b10|16:22:59] Loaded 789 crafting recipes
[b1072b10|16:22:59] Loaded 1.12.2 380 recipe book
[b1072b10|16:22:59] Cannot open file "Protocol/1.13/base.recipes.txt", no recipe book recipes will be available!
[b1072b10|16:22:59] Cannot open file "Protocol/1.14.4/base.recipes.txt", no recipe book recipes will be available!
[b1072b10|16:22:59] Loading furnace recipes...
[b1072b10|16:22:59] Loaded 67 furnace recipes and 66 fuels
[b1072b10|16:22:59] Loading brewing recipes...
[b1072b10|16:22:59] Loaded 49 brewing recipes
[b1072b10|16:22:59] Loading worlds...
[b1072b10|16:22:59] cWorld::cWorld("world")
[b1072b10|16:22:59] Failed to load scoreboard from "world/data/scoreboard.dat": basic_ios::clear: iostream error
[b1072b10|16:22:59] Cannot read world settings from "world/world.ini", defaults will be used.
[b1072b10|16:22:59] Allowed mob: bat
[b1072b10|16:22:59] Allowed mob: cavespider
[b1072b10|16:22:59] Allowed mob: chicken
[b1072b10|16:22:59] Allowed mob: cow
[b1072b10|16:22:59] Allowed mob: creeper
[b1072b10|16:22:59] Allowed mob: guardian
[b1072b10|16:22:59] Allowed mob: horse
[b1072b10|16:22:59] Allowed mob: mooshroom
[b1072b10|16:22:59] Allowed mob: ocelot
[b1072b10|16:22:59] Allowed mob: pig
[b1072b10|16:22:59] Allowed mob: rabbit
[b1072b10|16:22:59] Allowed mob: sheep
[b1072b10|16:22:59] Allowed mob: silverfish
[b1072b10|16:22:59] Allowed mob: skeleton
[b1072b10|16:22:59] Allowed mob: slime
[b1072b10|16:22:59] Allowed mob: spider
[b1072b10|16:22:59] Allowed mob: squid
[b1072b10|16:22:59] Allowed mob: wolf
[b1072b10|16:22:59] Allowed mob: zombie
[b1072b10|16:22:59] Chosen a new random seed for world: 1335985483
[b1072b10|16:22:59] Using a cache for biomegen of size 16.
[b1072b10|16:22:59] Enabling multicache for biomegen of length 128.
[b1072b10|16:23:00] Invalid biome ("BambooJungle") specified in AllowedBiomes in cubeset file Prefabs/SinglePieceStructures/JungleTemple.cubeset. Skipping the biome.
[b1072b10|16:23:00] Invalid biome ("BambooJungleHills") specified in AllowedBiomes in cubeset file Prefabs/SinglePieceStructures/JungleTemple.cubeset. Skipping the biome.
[b1072b10|16:23:01] cWorld::cWorld("world_nether")
[b1072b10|16:23:01] Failed to load scoreboard from "world_nether/data/scoreboard.dat": basic_ios::clear: iostream error
[b1072b10|16:23:01] Cannot read world settings from "world_nether/world.ini", defaults will be used.
[b1072b10|16:23:01] Allowed mob: blaze
[b1072b10|16:23:01] Allowed mob: ghast
[b1072b10|16:23:01] Allowed mob: magmacube
[b1072b10|16:23:01] Allowed mob: witherskeleton
[b1072b10|16:23:01] Allowed mob: zombiepigman
[b1072b10|16:23:01] Chosen a new random seed for world: 717257826
[b1072b10|16:23:01] cWorld::cWorld("world_the_end")
[b1072b10|16:23:01] Failed to load scoreboard from "world_the_end/data/scoreboard.dat": basic_ios::clear: iostream error
[b1072b10|16:23:01] Cannot read world settings from "world_the_end/world.ini", defaults will be used.
[b1072b10|16:23:01] Chosen a new random seed for world: 1637737994
[b1072b10|16:23:02] Loading plugin manager...
[b1072b10|16:23:02] -- Loading Plugins --
[b1072b10|16:23:03] [Core] Initialised!
[b1072b10|16:23:03] [ChatLog] Initialized ChatLog v.3
[b1072b10|16:23:03] -- Loaded 2 Plugins --
[b1072b10|16:23:03] Loading MonsterConfig...
[b1072b10|16:23:03] Starting Authenticator...
[b1072b10|16:23:03] Starting worlds...
[b1072b10|16:23:03] Generating random spawnpoint...
Segmentation fault

Interesting idea to compile Cuberite for an OpenWRT platform, I guess routers do actually have enough power to run Minecraft now!

Sadly I think this might need some debugging, and I don't think any of the devs would be able to reproduce on our own hardware.

Would you be able to please run this inside GDB and provide the logs of where the segfault occurred, or provide a core dump for us to take a look at?

Would you be able to please run this inside GDB and provide the logs of where the segfault occurred, or provide a core dump for us to take a look at?

How i can do it on OpenWRT?

UPD: @bearbin , I found this guide, but what should I do in the gdb console?

Sadly I think this might need some debugging, and I don't think any of the devs would be able to reproduce on our own hardware.

Isn't it possible to run mips architecture through Qemu?

Would you be able to please run this inside GDB and provide the logs of where the segfault occurred, or provide a core dump for us to take a look at?

How i can do it on OpenWRT?

UPD: @bearbin , I found this guide, but what should I do in the gdb console?

You should just be able to use the run command, which will start cuberite, and when it crashes it should give you a stacktrace (I think you're compiling in debug mode so debug symbols are turned on).

Sadly I think this might need some debugging, and I don't think any of the devs would be able to reproduce on our own hardware.

Isn't it possible to run mips architecture through Qemu?

Possibly, although there's no guarantee that the same error would result as on your hardware. So it's easier to confirm on the real hardware first rather than try and set up a whole emulated VM.

You should just be able to use the run command, which will start cuberite, and when it crashes it should give you a stacktrace (I think you're compiling in debug mode so debug symbols are turned on).

Reading /usr/lib/libstdc++.so.6 from remote target...
Reading /lib/libgcc_s.so.1 from remote target...
[New Thread 10757.10764]
[New Thread 10757.10758]
[New Thread 10757.10759]
[New Thread 10757.10760]
[New Thread 10757.10761]
[New Thread 10757.10762]
[New Thread 10757.10763]
[New Thread 10757.10765]
[New Thread 10757.10766]

Thread 2 "Cuberite" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 10757.10764]
0x008887ac in cChunkDesc::GetChunkX (this=0x0) at /builder/cuberite/src/Generating/ChunkDesc.h:49
49		int GetChunkX() const { return m_Coords.m_ChunkX; }  // Prefer GetChunkCoords() instead

Also i checked dmesg:

[42964.454304] do_page_fault(): sending SIGSEGV to Cuberite for invalid write access to 73d3bfec
[42964.462908] epc = 00b907b4 in Cuberite[400000+10a4000]
[42964.468127] ra  = 00b6aab0 in Cuberite[400000+10a4000]

I guess that at the moment of world creation there is a spike in ram consumption, and since I have ~30MB + 1GB swap free, this is the reason, although usually if some process uses all the ram, the router just hangs intentionally( But Tor works fine, although it consumed about 160 mb ram )

@bearbin , did you checked this