godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.18k stars 21.2k forks source link

Heavy use of coroutines can trigger random GDScript error opcodes in random files (with invalid error line report) #35228

Closed fian46 closed 1 year ago

fian46 commented 4 years ago

Godot version: 3.1.1

OS/device including version: Linux mint 19.3

Issue description: the error is not appear in debugger but appear in log files. i enable file logging in project setting

this is the output in log file

ERROR: Condition ' (ip + 5) > _code_size ' is true. Breaking..: At: modules/gdscript/gdscript_function.cpp:441:call() - Condition ' (ip + 5) > _code_size ' is true. Breaking..: SCRIPT ERROR: Internal Script Error! - opcode #38 (report please). At: res://general_script/culling_job.gd:39:culling_job.start() - Internal Script Error! - opcode #38 (report please).

sometimes it work just fine but sometimes it just stop running and freeze

Steps to reproduce: i am not sure what is wrong

Minimal reproduction project: -

Chaosus commented 4 years ago

Can you provide an example ? - otherwise It's hard to determine what to fix.

fian46 commented 4 years ago

hi i found the trigger of the bug, it happened when i trying to save my script in editor while my game is still running. i think it still a bug too right ? when i disabled sync script change and sync scene change from debug menu the problem goes away.

fian46 commented 4 years ago

i also find another issue in 3.1.1 when you exit the editor the sync script change and sync scene change is not saved when you opened the editor again in the future. i am not sure if this is intended but as user it is not pleasant.

KoBeWi commented 3 years ago

Can anyone still reproduce this bug in Godot 3.2.3 or any later release?

If yes, please ensure that an up-to-date Minimal Reproduction Project (MRP) is included in this report (a MRP is a zipped Godot project with the minimal elements necessary to reliably trigger the bug). You can upload ZIP files in an issue comment with a drag and drop.

HaSa1002 commented 3 years ago

I can verify this bug in 3.3, but as it occurs randomly, I haven't found a reliable way to reproduce this. But I got an error in a line in my script (160) whereas the script only has 92 lines. I am going to dig deeper. Maybe I can isolate the problem more as I continue working on my project.

HaSa1002 commented 3 years ago

Maybe it is not so random. I guess this is heavily tied to coroutines (and they are known to be problematic with script hot reload). I can provide a project privately, where you can save any script and will get a random opcode in a random file. It is not a mrp, but it would be a project usable to cause the error reliablely. In three tries, I got the opcode 0, 2, 6, 22 and 38.

c64cosmin commented 3 years ago

I can confirm that I have the same problem. Not using the coroutine solves the issue. Changing a scene or changing a script will trigger random errors, One of which is the one above, other error can be random variables in other object's scripts to be Nil.

akien-mga commented 2 years ago

This sounds pretty difficult to debug without a clear way to reproduce it with a MRP. I appreciate that making a MRP for this is not trivial though so it's understandable, I just wanted to make expectations clear.

If the opcodes and error lines are seemingly random there might be some kind of race condition.

HaSa1002 commented 2 years ago

As I have stated, I can share a project on rocket chat if someone has time to look into it (although to be fair I don't even remember which project it has been, but that is solvable 😅 )

Edit: I actually think, I know which project it has been

c64cosmin commented 2 years ago

@akien-mga What is an MRP? I could try to make a small project that tries to replicate the bug. Though after doing some reading thru the documentation, The issue occurs because the hanging state of the couroutine gets invalidated by the changing scene/script source. Hot loading puts the whole system in an invalid state. Disclaimer : I am just supposing what might happen, I am not familiar with the source code of the Godot engine.

KoBeWi commented 2 years ago

What is an MRP?

Minimal Reproduction Project, i.e.

a small project that tries to replicate the bug.

Calinou commented 2 years ago

@c64cosmin Can you (or anyone else) still reproduce this bug in Godot 3.5.1 or any later release?

If yes, please ensure that an up-to-date Minimal Reproduction Project (MRP) is included in this report (a MRP is a zipped Godot project with the minimal elements necessary to reliably trigger the bug). You can upload ZIP files in an issue comment with a drag and drop.

Calinou commented 1 year ago

Closing due to lack of response. Please comment if you can still reproduce this bug.

PS: Since no minimal reproduction project was included in the original bug report, please upload one as well to ease troubleshooting.