-
-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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
Game crashes in Release exports, no error in Debug (GDScript Pool*Array with type hinted from Array) #48090
Comments
'function signature mismatch' is an error specific to web build. Does it happen if you remove the randomizing part of the portal (to exclude the possibility that one of the scenes is corrupted itself)? |
I'm not sure, but if that's specific to the web build, then maybe it's not actually useful for debugging, doh. It definitely happens on all other platforms as well. However, regarding the randomizing, none of the scenes are corrupted - used to go through them linearly and was still frozen. The randomization was only added toward the end. |
Oh. I must have put that one into my gitignore. Ugh. Let me make a branch that removes it, as it's only used for multiplayer, sorry. |
For now, if you want, you can grab that file from here: https://github.com/GodotNuts/GodotFirebase/blob/main/addons/godot-firebase/firebase/firebase.gd - it'll cause weird bugs not having the data in there, but only if you try multiplayer. Single player should be fine without the config stuff at the top. |
Thanks, I can reproduce a segfault on Linux. I'll grab a stacktrace. |
The crash also happens with 3.2.3-stable so it's not a recent regression. Crashes here:
CC @RandomShaper (in case you're interested in this kind of release-only issue). |
In case anyone needs the branch upon which I've removed the Firebase-related error that Akien reported above, here you are: https://github.com/WolfgangSenff/GOTMJam3/tree/remove-firebase-for-bugfix |
Tested with 3.4-stable, this is still reproducible. |
I've found the issue. This is a simplification from
However, on a debug build, because of The difference of behavior across debug and release is the bug. I'm not sure if what we want is that the coercion to This little scripts shows the magical change of type on debug:
P. S.: Removing the CC @vnen |
@RandomShaper - I actually didn't see this until just now. You are some sort of superman for finding this. That is absolutely baffling, as well as impressive debugging! |
I think that the appropriate solution would be to raise an error in debug here. We use strict typing for a reason, and we don't allow coercion a lot of time when it would've been preferred by some users (see int vs float debacles). Implicit behavior here hides a bug in code, crash or not. So yeah, should be an error as early as possible. And a huge thank you for the investigation @RandomShaper! We just ran into this issue ourselves with a project, and it's a very nasty bug to figure out. This helps immensely. |
I'm not sure if this comment is 3.x specific, but at least on master, the existing code suggests that when the destination is statically typed (hard), a conversion should happen on assignment unless the source is also the same static (hard) type. If conversion is not possible, that's when it's an error. (Though there are cases for emitting warnings even when conversion is possible.) Relevant: godot/modules/gdscript/gdscript_vm.cpp Lines 1096 to 1121 in 9f05867
godot/core/variant/variant.cpp Lines 682 to 706 in 9f05867
So I believe the appropriate solution would be making the release export consistent with debug. But I don't know if there are design differences in this case for 3.x |
The comment is not 3.x specific, but the reported crash is. We haven't tested what happens in master, and GDScript 2 is too buggy for the moment to make a fair assessment anyway. But I don't think that the conversion described by Pedro is expected or desired when you use types. Like I've said, it hides a bug in code, which strict typing is supposed to prevent. We already act very strictly when using floats and ints together and actively avoid any implicit behavior. We also avoid coercion when adding a variant to a string, even though you could implicitly convert it to a string and concatenate (conversion works perfectly fine with string formatting). It's not very relevant if this behavior has been done on purpose or not, as it introduces an inconsistency with how we handle type coercion. To the point where it leads to a crash because that inconsistency wasn't accounted for in release builds. That said, making release builds coerce types the same way as debug build does would solve the problem with the crash specifically. I still want to underline that this hides a bug in code from the developer. So at the very least we should reconsider it for Godot 4 while we can break compatibility. In 3.x we can accept coercion in release to avoid crashing, though I'd say it's still undesired and should be fixed properly. |
But if the design intention is to do conversion when assigning to a hard-typed destination (unless the source is the same hard-type), then it's not "hiding a bug in code from the developer". With this design, the semantics of assigning to a hard-typed variable do include type conversion. What you mention about strings is in fact accounted for within the difference between Line 389 in b4d7d87
With regards to assignments, that doesn't seem to be the case. The only time such assignment is prevented seems to be Conversion when assigning to hard-typed variables is something I'm very fond of about GDScript. If changing that is desired by some, then maybe it should be a proposal. Preventing it would also hurt safe polymorphism / make it very cumbersome to write. |
I wasn't talking about assignments there specifically, sorry. Just general cases of possible coercion that the users run into from time to time.
It very much is, as evident by the fact that only after reading that investigation by Pedro did we realize that we were in fact assigning one type to a variable that is supposed to hold another. It was a relic of old code being refactored, skipped past the developer who did the refactoring, and we were none the wiser. Coercion made us think the code was safe, when it wasn't. IMO crash is irrelevant here, so even if it didn't crash I would still consider that a problem.
Fair. Then, at the very least, it should be a warning that you can disable or silence per line. We have a few such warnings when ints and floats are, again, involved. When you implicitly cast you do something potentially unsafe. And I'm not sure I agree with being very cumbersome to write. We have explicit casting, and we have overloaded constructors that would extend your code by a few characters, but would make the intended logic very clear. |
Fixed by #57851. |
I have looked for a few other issues and while some might be the same, I have a repro project whereas those did not. It's not a minimal project, but it's easy enough to cause the bug with this project. It might be the same or very similar to #46533, not sure, as I didn't test it just with deleting nodes explicitly (mine happens on scene change).
Godot version:
3.3.stable, GLES2 for web exporting (but happens regardless of which system exported for)
OS/device including version:
macOS Catalina, 10.15.5, Radeon Pro 560X, also integrated Intel UHD Graphics 630
Issue description:
When switching scenes in my game while in release mode, the game often freezes. This happens regardless of which system I'm exporting for. It seems very little is listed in the Mac OS logs as well - I actually couldn't find anything. However, it looks like possibly the web export has a bit more information (but note the freeze is definitely not specific to the web build):
Steps to reproduce:
For my testing, I found this always froze on the next screen. Since it's picking scenes at random to send you to next, I don't think it's specific to my code, but it's possible, as I use an inherited root scene for each level.
Minimal reproduction project:
I don't have a minimal reproduction, just the big one. I'm not sure exactly what's causing it, but as it's a crashing bug, I think it's pretty important to include it here anyway:
https://github.com/WolfgangSenff/GOTMJam3
The text was updated successfully, but these errors were encountered: