Mineclonia not starting in Minetest 5.5-dev due to faulty find_nodes_in_area() bugfix in Minetest #183
Labels
No Label
blocker
bug
code quality
confirmed
critical
discussion
high priority
incompatibility
incomplete feature
invalid
low priority
missing feauture
needs testing
packet spam
performance
project
regression
translations
unconfirmed
in review
ready for review
No Milestone
No project
No Assignees
3 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Mineclonia/Mineclonia#183
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happened?
In response to the crash from #165 the Minetest core developers changed
minetest.find_nodes_in_area()
to ignore areas outside of coordinates that they think the map generator can actually generate, which is ±31000. Note that in vanilla Minetest the visible map can actually extend beyond that point.Despite a lot of warnings from my side, they merged the faulty bugfix – one that prevents the crash, but introduces numerous subtle other problems due to using the wrong boundary, it is trivial for mods, players or map imports to place nodes outside the generated maps.
The PR #169 includes a self test at game startup that tests if
minetest.find_nodes_in_area()
can actually find all nodes that the test places. The faulty bugfix forminetest.find_nodes_in_area()
makes an assertion in that test case fail.What did I expect?
I expected Minetest core developers to actually know how their engine works at the map boundaries.
I expected Minetest core developers to take my warnings seriously.
Apparently I was way too optimistic.
How to get it to happen
4b9094ddc2
in Minetest commit 87ab97da2.Environment
Mineclonia commit
4b9094ddc2
Minetest commit 87ab97da2
TL;DR: The self test fails due to the Minetest engine now being buggy around coordinates with x/y/z > ±31000. Basically, nodes can exist in those coordinates, but they will not be found by
minetest.find_nodes_in_area()
.this is kind of funny ngl.
While i suppose you're right about nodes being able to exist there, you have to see that there is no evidence of find_nodes_in_area not working there being a problem – having the game crash on startup however: kind of a problem (evidence: the existence of this issue) If this proves anything it's that these tests should be opt-in. ( #213 )
Lots of code in Mineclonia places nodes and then uses
minetest.find_nodes_in_area()
to find those exact nodes – which is what the test tries to do too.Among the mechanics that use
minetest.find_nodes_in_area()
and could possible interact with coordinates beyond 31000 are:/spawnstruct
(witch hut, end shrine & end portal, desert temple)I am confident that at least some of those will create opportunities for griefers to crash servers in hard to diagnose ways or maybe just create natural sources of lag or crashes, in cases where someone is careless enough to actually run Mineclonia on a Minetest 5.5-dev server.
Are you confident that none of those will be a problem?
Do not shoot the messenger. I think it is perfectly fine to not start the game with an engine version that breaks over 20 mechanics. IIRC no one – you and me included – assumed that the Minetest devs would realistically break the function.
I propose to fix it in the engine. The comment near that assertion also asks to complain to the Minetest engine devs in case the test ever fails. Have you done that or am I the only one so far?
I decided to investigate the lava cooling. It seems that flowing lava touching water beyond x=31000 may be a problem (crash).
Note that the map generator can actually do this on its own.
well the tests make it worse
I suppose you just want to keep it broken then because you're so right.
Among the things not working due to this:
EVERYTHING
"with focus on stability (less crashes)..."
@cora and me chatted about the issue this morning. To reiterate my talking points for others:
I put in the assertion to prevent the game from starting in a known to be buggy state. If the game is started with a buggy engine, it will exhibit buggy behaviour at the map edge in the over 20 features I listed above. Only after I did this did sfan5 actually change Minetest, against my multiple warnings that his solution is wrong. I was not aware that among Minetest core devs “fixing” signed integer overflow is usually done by coming up with a poorly thought-out ad-hoc solution. I know more nowadays – in particular that celeron55 seems to think that checking for signed integer overflow makes software too slow (IMO this is bullshit).
I agree the current solution is bad. In particular, the assertion does not even have an error message! Only by looking at the source code it becomes clear that the problem lies with the engine placing nodes it can not find.
The affected versions of Minetest 5.5-dev have
minetest.find_nodes_in_area()
not working correctly for about 15% of possiblev3s16
coordinates – I calculated this as( ( 2¹⁶ )³ - ( 31000×2 )³ ) / ( ( 2¹⁶ )³ )
. From the set of coordinates that do not work correctly, only 0,05% are wrong in all cases (i.e. the Minetest map generator can and will place nodes there) – I calculated this as ( ( 31006×2 )³ - ( 31000×2 )³ ) / ( 31000×2 )³. Unfortunately, those positions consist of a shell around the map and it is trivial to trigger buggy behaviour (just show up near the map border).Nevertheless, for debugging purposes it is a good idea to turn tests off. I think self tests should be opt-out though, not opt-in.
I think it is my responsibility to fix the crash (arguably, I introduced it) and I have a plan for doing so, consisting of several steps:
I plan to convince others that the default for tests should be that checks are opt-out, not opt-in. If someone wants to run a known-to-be-buggy engine release, they should make a conscious effort to do so. So far, only developers and people who wanted to test unreleased Minetest engine versions had a need for disabling the tests: I had a need for this, sfan5 had a need for this, apparently @cora and @EliasFleckenstein03 have a need for this too.
I plan to propose an error message to the assertion. This is orthogonal to everything else. @cora had complained about my assertions not having any error messages and I brushed it aside. That was a mistake.
I plan to make a PR for the Minetest engine to change the limits to the limits of v3s16. This is a very simple endeavour and its success mostly depends on if I find any core devs that know how to fix a signed integer overflow.
If the previous step fails, I plan to reimplement the buggy parts of
minetest.find_nodes_in_area()
using a voxelmanip, so that the test can stay as it is.If the previous step fails, I plan to change the test so that it does not fail – and open bugs against every feature that does not work anymore near the map border. I would like to avoid this.
Mineclonia not starting due to faulty find_nodes_in_area() bugfix in Minetestto Mineclonia not starting in Minetest 5.5-dev due to faulty find_nodes_in_area() bugfix in MinetestI have sent Minetest a patch: https://github.com/minetest/minetest/issues/11828#issuecomment-993594718
I really don't want to make a controversy about a problem like this which had minor consequences. But I think it shows several attitudes that I think are damaging to the MineClone2/Mineclonia community and that I want to address by using this case as an example.
The criticism is not limited to @erlehmann only.
Before I start my rant however, I want to point out that I think we all agree that sfan5's pull request was faulty and the find_nodes_in_area is currently in a bugged state. Nevertheless, I think that what you did here was wrong.
The main problem here is taking responsibility for something that we can't possibly control. What a selftest like this is essentially trying to do is solve engine issues. MineClone2/Mineclonia cannot and should not attempt to solve (or prevent) engine problems, especially not problems in unreleased engine versions.
If the engine is buggy, that's the engine's problem. There are a lot of engine bugs that Mineclonia does not test at all for, and it is impossible to make the game only start whenever the engine is in a buggy state.
Minetest has > 1k issues open, 268 of them are bugs. The only logical consequence here is to not allow Mineclonia to run until there are no engine bugs.
Taking responsibility for engine issues is malicious in several ways:
The second problem is the motivation behind your actions. As already mentioned, it is impossible to make Mineclonia reliably fail to start with a buggy engine. In some cases however, the impact of the engine bug might be so big (e.g. permanent loss of worlds etc.) that it is justified to take whatever actions are needed to prevent harm.
HOWEVER, it can hardly be said that this is the case here. The creation of the problematic test was at least partly motivated by the will to discredit the Minetest developers for applying a patch that you thought was wrong.
The engine patch is not directly related to Mineclonia. It affects Mineclonia servers as well as minetest_game servers and basically any Minetest content that uses find_nodes_in_area.
Your patch does not benefit Mineclonia users, and your patch harms them because their game does not start.
A malicious patch was applied for egoistical reasons, and you were dishonest about your intentions.
Being egoistic as developers is something that we often like to deny, but I don't think it's good if we're dishonest with each other in the "aftermath", so I'll make the first step and name a few times I myself have not been neutral:
Everyone is egoistic or egocentric once in a while, and while I don't want to justify what I did, applying patches that are entirely harmful on top of that is crossing a bounary.
I believe that your motivation might partly have also been to protect the users. But in that case, such a patch would still have been an exaggerated reaction to the partially buggy state of the engine. Note that your patch could have possibly affected a lot of worlds that are not vulnerable to the engine bug at all (e.g. singleplayer worlds). Enforcing a selftest that knowingly fails, even with a good intend is harmful because:
Reasons on why I still think that you were (partly) egoistially motivated:
There is not a single known fatal problem with the clamping issue, and you are evidently skilled at finding concrete ways to exploit faulty code. As someone who always wants proof before taking action, you claiming that there is going to be problems is not very credible if you can't name an example.
You might argue that "there exists an issue unless proven otherwise", but when there are two issues to compare to each other, it does not make sense to prefer breaking game startup (proven fatal issue) over possible other fatal issues (speculation), especially if the probability of a permanent issue (e.g. wold corruption) is somewhat low.
There are far more severe issues in the engine that can lead to breakage; take https://github.com/minetest/minetest/issues/11742 for example. Yet, no selftest was introduced for these.
Your claim that you would not have expected the minetest devs to "break the engine in such ways" is invalid and I don't see why you actually thought we'd believe that. You made a test about it, so of course you were expecting the test to eventually trigger. You KNEW about sfan5's PR, it was the motivation to make the test in the first place. If you would have not considered the possibility of the PR being merged, you wouldn't have made the test in the first place.
When the PR got merged, which you noticed, you did not disable the test or anything. You were fully aware of very likely breaking the game by making such a test. And you were also aware that you exaggerated the consequences of the engine breakage that would have resulted otherwise.
Conclusion
If you, @erlehmann want to take responsibility for engine problems, I highly encourage you to fork Minetest. You have done this in the past as well. I offer my help in contributing and maintaining that fork. Ngl, sfan5's attitude is fucked.
But please, don't harm the community we both care about by trying to fix engine problems with game code. This also applies to cora and me, who took part in the recent anticheat microhype. Let's fix the problems where they should be fixed.
And erlehmann, I think that you should try to be more honest and neutral. This is not the first time that I think you have tried to discourage someone or made unfair or dishonest claims (for example I don't think that MineClone2/Mineclonia comparison is a topic that you deal with neutrally). I think you are a really cool person and I like hanging out with you on IRC - I also really appreciate the work that you are doing for the MineClone2/Mineclonia community. Therefore I feel bad about publicly pointing out what I think was a mistake of yours, but I think it had to be addressed.
The minetest contribution guidelines explicitly state that you have to make a Pull Request.
I made one for you, hope you're ok with that. https://github.com/minetest/minetest/pull/11858
I agree. Mostly I wanted to avoid having to deal with a ton of buggy behaviour.
That failed assertion probably should have been some kind of annoying debug message.
I am actually not very skilled in finding concrete ways of exploiting code – otherwise I would have turned a few of the UB bugs in Minetest into an inofficial client-sent server-mod interface. Greping the archive of contentdb for
minetest\.find_nodes_in_area
reveals a bunch of mods that now have problems.Quoting myself from https://github.com/minetest/minetest/pull/11858#issuecomment-993855389
I will address the rest of your comments later. I think it is a very good post though, thank you.
I am totally ok with you making it. The reason I did not do it right away: I was told in the past that very small changes (like changing a constant, I guess) do not require two approvals, so I thought maybe I could get my shit past the radar if anyone in the core dev team agreed with me.
fixed by #214