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

Internal Script Error! - opcode #24 (report please). #54748

Open
aypm-dev opened this issue Nov 8, 2021 · 6 comments
Open

Internal Script Error! - opcode #24 (report please). #54748

aypm-dev opened this issue Nov 8, 2021 · 6 comments

Comments

@aypm-dev
Copy link

aypm-dev commented Nov 8, 2021

Godot version

v3.3.4.stable.official

System information

Windows 10, GLES3, Intel HD Graphics 2500

Issue description

Godot rarely prints the error: "Internal Script Error! - opcode #24 (report please)." and crashes the game, when you create a timer using yield(get_tree()) in a function and then recalling the function inside itself.

I call the function inside itself to make an infinity loop. Now I know that it crashes, so I replace it with a while(true) loop.
I couldn't find the same error at GitHub so I'm reporting it.

Steps to reproduce

This is my function, it seems to crash, I hope it isn't only in my project, but looks like yield(get_tree().create_timer(1), "timeout") has been causing similar errors. #42379 or #45224

func Idling():
	var cooldown= 13
	cooldown+= rand_range(-2, 6)
	yield(get_tree().create_timer(cooldown), "timeout")
	yield($Sprite, "animation_finished")
	$Sprite.animation = "Idling" 
	Idling()

I replaced the function with a while loop and nothing seems to append since.

func Idling():
	while(true):
		var cooldown = 13
		cooldown += rand_range(-2, 6)
		yield(get_tree().create_timer(cooldown), "timeout")
		yield($Sprite, "animation_finished")
		$Sprite.animation = "Idling" 

"HOW TO:"
Create a script with this code inside:
"it crashes my game without the message, but It should work"

func _ready():
        Function()

func Function():
	yield(get_tree().create_timer(5), "timeout")
        Fuction()

Minimal reproduction project

No response

@Calinou
Copy link
Member

Calinou commented Nov 8, 2021

In general, I'd expect infinite chains of yield() to crash as they aren't designed to handle this scenario.

@aypm-dev
Copy link
Author

aypm-dev commented Nov 9, 2021

It happened again, this time is "Internal Script Error! - opcode #28 (report please).", but with the while(true) loop.

Oh, and this is in the debug menu:

" (Sorry, if it's in Spanish xd)
E 0:03:04.330 _get_variant: Bad code! (unknown addressing mode).
<Error de C++>Method failed. Returning: __null
<Fuente C++> modules/gdscript/gdscript_function.cpp:130 @ _get_variant()
NPC.gd:84 @ ()
"

I'm changing to timer nodes haha.

@cesarizu
Copy link
Contributor

cesarizu commented Dec 4, 2021

The same thing is happening for me without any loop, only when running from the editor. When running from the command line it doesn't happen:

func _ready():
	animation_player.play("first")
	# Some code
	yield(animation_player, "animation_finished")
	animation_player.queue("second")
	# Some more code

Backtrace:

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v3.4.1.rc1.official (7b0801c7fb4416625fb9ca124b41b93677689420)
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib64/libc.so.6(+0x56430) [0x7ff996577430] (??:0)
[2] /home/cesar/opt/godot/Godot_v3.4.1-rc1_x11.64() [0xa9c2d7] (??:0)
[3] /home/cesar/opt/godot/Godot_v3.4.1-rc1_x11.64() [0xabe3ac] (??:0)
[4] /home/cesar/opt/godot/Godot_v3.4.1-rc1_x11.64() [0xabefd4] (??:0)
[5] /home/cesar/opt/godot/Godot_v3.4.1-rc1_x11.64() [0xa75630] (??:0)
[6] /home/cesar/opt/godot/Godot_v3.4.1-rc1_x11.64() [0x2b65d99] (??:0)
[7] /home/cesar/opt/godot/Godot_v3.4.1-rc1_x11.64() [0x2b6618d] (??:0)
[8] /home/cesar/opt/godot/Godot_v3.4.1-rc1_x11.64() [0x2b66e6c] (??:0)
[9] /home/cesar/opt/godot/Godot_v3.4.1-rc1_x11.64() [0x22cedc8] (??:0)
[10] /home/cesar/opt/godot/Godot_v3.4.1-rc1_x11.64() [0x22cf980] (??:0)
[11] /home/cesar/opt/godot/Godot_v3.4.1-rc1_x11.64() [0x1d86d76] (??:0)
[12] /home/cesar/opt/godot/Godot_v3.4.1-rc1_x11.64() [0x1d9c74c] (??:0)
[13] /home/cesar/opt/godot/Godot_v3.4.1-rc1_x11.64() [0x9d6441] (??:0)
[14] /home/cesar/opt/godot/Godot_v3.4.1-rc1_x11.64() [0x94534d] (??:0)
[15] /lib64/libc.so.6(+0x405c0) [0x7ff9965615c0] (??:0)
[16] /lib64/libc.so.6(__libc_start_main+0x7e) [0x7ff99656167c] (??:0)
[17] /home/cesar/opt/godot/Godot_v3.4.1-rc1_x11.64() [0x95901e] (??:0)
-- END OF BACKTRACE --
================================================================

@cesarizu
Copy link
Contributor

cesarizu commented Dec 4, 2021

I just realized that that backtrace is not very useful. This one is from a 3.5 build from sources:

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v3.5.beta.custom_build (c42e9bd5890e90f0d0ae1690cb445dc2597d9470)
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib64/libc.so.6(+0x56430) [0x7fae008bb430] (??:0)
[2] /home/cesar/src/external/godot/godot3/bin/godot.x11.opt.tools.64() [0x8ac2b4] (/home/cesar/src/external/godot/godot3/modules/gdscript/gdscript_function.cpp:428)
[3] /home/cesar/src/external/godot/godot3/bin/godot.x11.opt.tools.64() [0x8d5190] (/home/cesar/src/external/godot/godot3/modules/gdscript/gdscript_function.cpp:1816)
[4] /home/cesar/src/external/godot/godot3/bin/godot.x11.opt.tools.64() [0x8d5fcd] (/home/cesar/src/external/godot/godot3/./core/reference.h:257)
[5] /home/cesar/src/external/godot/godot3/bin/godot.x11.opt.tools.64() [0x8d7ee0] (/home/cesar/src/external/godot/godot3/./core/method_bind.h:334 (discriminator 4))
[6] /home/cesar/src/external/godot/godot3/bin/godot.x11.opt.tools.64() [0x2f0c2bc] (/home/cesar/src/external/godot/godot3/core/object.cpp:918 (discriminator 1))
[7] /home/cesar/src/external/godot/godot3/bin/godot.x11.opt.tools.64() [0x2f16c11] (/home/cesar/src/external/godot/godot3/./core/variant.h:437)
[8] /home/cesar/src/external/godot/godot3/bin/godot.x11.opt.tools.64() [0x2f17dbc] (/home/cesar/src/external/godot/godot3/core/object.cpp:1280)
[9] /home/cesar/src/external/godot/godot3/bin/godot.x11.opt.tools.64() [0x256ccb5] (/home/cesar/src/external/godot/godot3/./core/variant.h:437)
[10] /home/cesar/src/external/godot/godot3/bin/godot.x11.opt.tools.64() [0x2f09c74] (/home/cesar/src/external/godot/godot3/core/object.cpp:929)
[11] /home/cesar/src/external/godot/godot3/bin/godot.x11.opt.tools.64() [0x1f6c582] (/home/cesar/src/external/godot/godot3/scene/main/scene_tree.cpp:994)
[12] /home/cesar/src/external/godot/godot3/bin/godot.x11.opt.tools.64() [0x1f7692e] (/home/cesar/src/external/godot/godot3/scene/main/scene_tree.cpp:488 (discriminator 2))
[13] /home/cesar/src/external/godot/godot3/bin/godot.x11.opt.tools.64() [0x7be66b] (/home/cesar/src/external/godot/godot3/main/main.cpp:2207)
[14] /home/cesar/src/external/godot/godot3/bin/godot.x11.opt.tools.64() [0x7a2b11] (/home/cesar/src/external/godot/godot3/platform/x11/os_x11.cpp:3705)
[15] /home/cesar/src/external/godot/godot3/bin/godot.x11.opt.tools.64() [0x78b9b5] (/home/cesar/src/external/godot/godot3/platform/x11/godot_x11.cpp:55)
[16] /lib64/libc.so.6(+0x405c0) [0x7fae008a55c0] (??:0)
[17] /lib64/libc.so.6(__libc_start_main+0x7e) [0x7fae008a567c] (??:0)
[18] /home/cesar/src/external/godot/godot3/bin/godot.x11.opt.tools.64() [0x790d25] (/home/abuild/rpmbuild/BUILD/glibc-2.34/csu/../sysdeps/x86_64/start.S:118)
-- END OF BACKTRACE --
================================================================

@cesarizu
Copy link
Contributor

cesarizu commented Dec 15, 2021

So it seems for me the error is caused by enabling "Save on focus loss" on the editor settings. This causes the project to be saved once launched and then it crashes. That explains why running from the command line didn't crash the game either.

@saletrak
Copy link

Happens to me in Godot 4.1, when saving script while game is lunched.

@KoBeWi KoBeWi modified the milestones: 3.5, 3.x Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants