-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Promote the dangling Variant fix to release builds #1589
Comments
Thanks for writing this proposal! This is so needed. Big thumbs up for the 3.2+ fix - release builds are simply broken as they are. Note that we don't have any warning in Debug builds about that, but Release builds crash systematically and invariably. As for 4.0, it sounds reasonable to compare the 3.2 with the fix performance to the mechanism in 4.0 and decide accordingly. Regarding FWIW, instead of To sum up - a big YES to this proposal which we fully endorse. We can also poor money and beer non-exclusively to get this in. |
I still think adding this on release is just a bad idea. If you don't get errors in the debug build but it crashes on release then this is probably a bug and/or unrelated. In this situation, the dangling pointer should always crash on debug. While to you it may be better to have this fix, other users probably prefer to fix the errors reported and expect the release build to run as fast as possible. Instead, I think the course of action should be: |
@oeleo1 also by the way, is_instance_valid is completely trustworthy in recent 3.2 builds as well as 4.0, it was not trustworthy in previous 3.x builds, so it may be a misunderstanding from your part. |
|
Ah that may be still the case of 3.2, but in 4.0 this function is 100% trustworthy |
Just a heads up, this is likely to be accepted for 3.2. The part for 4.0 won't probably be needed because there things are meant to work better out from the box. When I confirm that's the case, I'll remove the relevant part and limit this proposal for 4.0. |
Okay. Two points I'd like to draw your attention on:
I personally don't see a problem with this going in and I've tried to argument my understanding, but hey, this is what proposals are for - debate about pros and cons. Long live Godot! |
The editor relies on functionality only available in debug mode, so I'm afraid that's not possible. |
@Calinou - not possible today indeed, but it doesn't have to be that way. Editor and build mode can be dissociated. |
Whatever you do, a good piece of documentation has to be written describing the proper usage at the very least, and the existing limitations which most users are likely not even aware of. One has to be aware of a possibility that people may already rely on "bug-as-a-feature" effect even in production, and even what seems to be proper fixes can be seen as regressions in existing projects. |
Is the "proper usage" to rely on |
I whole-heartedly support making release work the same as debug even if there is a small performance hit. In my mind this is a major problem for a few reasons:
Edited for typos and clarity. |
I can't even get a clear answer here on the bug tracker. I don't know if |
@remram44, let me quote https://docs.godotengine.org/en/stable/classes/class_weakref.html:
|
What does "still works however does not have any effect" mean in this context? Does it mean anything in any context? If it doesn't have "any" effect, in what sense does it "work"? |
Yes, it does. It means that it won't give errors and will tell you back what object it is referencing, regardless it's |
Thank you so much for the answer! I will see if I can help improve the docs. I believe for example that simply removing "it does not have any effect on the object" would be a clear improvement, since I cannot see what information this part of the sentence adds. |
Implemented for 3.4 by godotengine/godot#51796. Relevant changes still need to be forward-ported to |
Describe the project you are working on:
It's not really related to my project, but to game projects from many people.
Describe the problem or limitation you are having in your project:
The problem is that the current dangling
Variant
fix (godotengine/godot#38119 plus some fixups) only applies to debug (or release_debug) builds, so people is getting bitten by crashes or wrong logic related to the lack of that protection on production. While it's true that the editor will warn you about those situations at dev time, there are usually still states a game can be in that are hard to cover in testing, but can very well happen to users.Describe the feature / enhancement and how it helps to overcome the problem or limitation:
The idea is to have the following:
Variant
fix is applied on pure release builds, too. The performance measurements that have been done so far make this completely reasonably: you get extra robustness at the same performance (theoretically a bit worse, but negligible; but even better, as shown in some tests).Godot 4.0: here it would be soon enough to take this some steps further:--
Finally get rid of things likeis_instance_valid
.--
Enable decayment of freed objects tonull
(that was initially in the fix for 3.2, but was removed because it was a change of behavior).--
Compare performance of the current approach to protection in 4.0 (quickObjectDB
checks) to the one in 3.2 and leave the fastest.UPDATE: I'm "deprecating" the list of ideas for 4.0, since I'd like to check the state of things again and refine the proposal for it. Let's focus on 3.x for now.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
I think it's already pretty clear.
If this enhancement will not be used often, can it be worked around with a few lines of script?:
If a developer could really ensure the lifetime of every object in their game is perfectly tracked, maybe some (or a lot of) scripting would fix the problem. But that's not the case.
Is there a reason why this should be core and not an add-on in the asset library?:
This is hardcore core stuff, so not possible.
The text was updated successfully, but these errors were encountered: