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

Constantly having huge desync issues on macOS M series. #14375

Closed
ShadowRoi opened this issue Feb 16, 2024 · 13 comments
Closed

Constantly having huge desync issues on macOS M series. #14375

ShadowRoi opened this issue Feb 16, 2024 · 13 comments
Labels
macOS Not a bug The behaviour is working as intended and won't be changed. @ Server / Client / Env.

Comments

@ShadowRoi
Copy link
Contributor

Minetest version

5.8.0

Irrlicht device

OSX

Operating system and version

macOS Sonoma 14.2.1

CPU model

M1 Pro

GPU model

M1 Pro

Active renderer

OpenGL 2.1

Summary

After a lot of debugging there seems to be a very awkward issue and desync issue, mostly when rendering new chucks in Mineclonia/ MineClone 2. Whenever I attempt to generate new chunks, at random times it starts to have terrible desync issue(checked with lagometer), with that being said duly note that when I attempt generating super flat world or other smaller games in minetest this didn't occur.

Something important to note is that when I installed bare metal Linux on my MacBook, this issue was not occurring.
If I can help with any way and can provide any more information please contact me, I would be glad to help.

Steps to reproduce

  • start a world in mineclonia/mineclone 2
  • start moving around and generating new chucks
  • using lagometer you can spot dramatic "lag" occurring at times often, visually you see mobs constantly being teleported back to sync.
@ShadowRoi ShadowRoi added the Unconfirmed bug Bug report that has not been confirmed to exist/be reproducible label Feb 16, 2024
@wsor4035 wsor4035 added the macOS label Feb 16, 2024
@sfan5
Copy link
Member

sfan5 commented Feb 16, 2024

What is the "lagometer" and what does it indicate? If it's the server lag value this sounds more like a server problem even though your description makes it sound like a client problem.

To debug this issue it a log with --verbose taken during a game session that reproduces the problem would be very helpful.

@ShadowRoi
Copy link
Contributor Author

Lagometer is a tool that was made by Warr, check this video right here as it will provide a visual perspective on the issue
https://www.youtube.com/watch?v=IGuU7KarfNY
This issue actually happens very often, not just by rendering new chunks.

If possible let me know how I can use verbose on the Mac, how do I run that command?

@ShadowRoi
Copy link
Contributor Author

ShadowRoi commented Feb 17, 2024

@sfan5 Alright here I provided the file below, what I did is go into the world, fly a little around and it occurred near the end for around 20 seconds and when it stopped I exited. To me this seems like a really nasty bug
(https://github.com/minetest/minetest/files/14317095/Untitled.txt)

@sfence
Copy link
Contributor

sfence commented Feb 17, 2024

@ShadowRoi
If you have Minetest installed via brew, you should be able to call Minetest directly from the terminal by calling minetest.

If you have Minetest installed in the Applications directory then command /Applications/minetest.app/Contents/MacOS/minetest should work.

@ShadowRoi
Copy link
Contributor Author

ShadowRoi commented Feb 17, 2024

@sfence i did it its all good. I have provided above the file with the verbose

@sfan5
Copy link
Member

sfan5 commented Feb 17, 2024

Aside from the problem: sudo ./minetest --verbose
Please don't do this, Minetest does not need root access to your system so don't give it that.

From INFO[Server]: collisionMoveSimple: maximum step interval exceeded, lost movement details! I gather that it's the server that is lagging.
Since you're generating lots of new world the on_generated callback(s) are a prime source for log.

The next steps would be:

  • Enabling the engine profiler using profiler_print_interval = 15
  • Enabling the mod profiler using profiler.load = true. Note that you need to enter /profiler dump in chat at the end of your session to receive the data.
  • Repeating the debug session

@ShadowRoi
Copy link
Contributor Author

@sfan5 Alright, this time it barely generated new chucks but there still this issue again which I logged, Yes I know sudo. It won't let me run it if I don't use sudo, I don't know what is macOS smoking. Anyways here is the log. Let me know if anything else. Also Minetest is being emulated from x86 to arm64 with Rosetta, I don't know if it's related
Untitled.txt

@sfence
Copy link
Contributor

sfence commented Feb 17, 2024

@ShadowRoi
try ./minetest instead of ./ minetest.
With ./ minetest, it try to execute directory ./ with minetest as parameter.

@sfan5
Copy link
Member

sfan5 commented Feb 20, 2024

Untitled.txt

You forgot the --verbose so the engine profiler output is missing.
Doesn't matter though because the Lua profiler tells the entire story:

 instrumentation                                         |    min µs |    max µs |    avg µs | min % | max % | avg %
-------------------------------------------------------- | --------- | --------- | --------- | ----- | ----- |
 mcl_mapgen_core:                                        |         0 |   2358176 |     28025 |   0.0 |  99.6 |   2.6
  - on_generated[1] ...................................  |     38406 |   2358176 |    840758 |  20.6 |  99.6 |  79.5

For every chunk¹ generated MineClone took on average 840ms and up to 2 seconds of processing time.
This work happens on the server thread and blocks everything else from happening (including player and entity movement processing).
Now consider that by default the server should be able to run its entire processing every 90ms².
In conclusion this means the desync / lag you were describing is caused by MCL's processing of generated map parts. This is not something we can fix.
In fact in the upcoming version the engine will offer new way of hooking the map generator that doesn't cause lag (#13092).

¹: A chunk is an unit larger than a block (16x16x16 nodes), but not so large that it should take e.g. half a second to generate.
²: In singleplayer the engine even aims for lower values such as 16ms.

@sfan5 sfan5 closed this as completed Feb 20, 2024
@sfan5 sfan5 added @ Server / Client / Env. Not a bug The behaviour is working as intended and won't be changed. and removed Unconfirmed bug Bug report that has not been confirmed to exist/be reproducible @ Client rendering labels Feb 20, 2024
@sfan5
Copy link
Member

sfan5 commented Feb 21, 2024

Also Minetest is being emulated from x86 to arm64 with Rosetta, I don't know if it's related

I forgot to mention: Apple's emulation is supposedly very good but this will of course reduce the performance of Minetest itself and any Lua code. Would also explain why you didn't see the issue on Linux.
Prefer native builds whenever possible.

@ShadowRoi
Copy link
Contributor Author

@sfan5 So what happens with this? We know now it's a LuaJIT issue on ARM devices now which I think this hasn't be resolved even on the latest version of LuaJIT, soooo... now yes I don't know shit compared to you I am pretty new in programming but I can only think 2 solutions:

  1. (Best solution) somehow fix that allocation problem idk how or if its possible and enjoy all the neat LuaJIT optimization performance features OR
  2. (Bad Solution) Fallback to Lua which will also reduce really bad the overall performance

If I can do anything else let me know 👍

@sfan5
Copy link
Member

sfan5 commented Feb 27, 2024

Nothing.
Nobody here has the resources or expertise to fix LuaJIT. Falling back to Lua is a choice you can make when compiling MT.

@ShadowRoi
Copy link
Contributor Author

@sfan5 Well I completely understand but non tech users won't be compiling it. In my opinion a true and quick fix that can be integrated in 5.9.0 so this will make it painless is just to make a quick script that If on macOS and ARM then disable JIT. Because I know that even having LuaJIT you can just disable it. That will make it completely painless easy for every non tech user out there and will help into making Minetest a more Multi-cross platform that will work out of the box. It's a simple quick fix and there won't be people coming over and over reporting this issue. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
macOS Not a bug The behaviour is working as intended and won't be changed. @ Server / Client / Env.
Projects
None yet
Development

No branches or pull requests

5 participants