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

The engine crashes when re-importing .gtlf file #91764

Closed
caioraphael1 opened this issue May 9, 2024 · 10 comments · Fixed by #92279
Closed

The engine crashes when re-importing .gtlf file #91764

caioraphael1 opened this issue May 9, 2024 · 10 comments · Fixed by #92279

Comments

@caioraphael1
Copy link

caioraphael1 commented May 9, 2024

Tested versions

Bugs in 4.3dev6
Works in 4.3dev5

System information

Windows 10, Ryzen 3 3300x, 16gb RAM 2666mhz, GTX 1660 6gb.

Issue description

As shown in the video, if I click on re-import the engine crashes, giving a loop of errors in the console.

This all started once I decided to move the .gtlf file across folders in the filesystem. I did this using godot drag and drop. When moving the file, the engine crashed. After that, I started getting these errors.

I've tried deleting the .godot and the related .import file, but nothing has changed.

Video.sem.titulo.Feito.com.o.Clipchamp2.mp4

I do not extract any materials or animations from the .gltf file. The only way I interact with this model is through putting a script in its inherited scene. The .gltf file is not used anywhere except in the inherited scene, and the inherited scene is only used once, inside a character.

I've tried re-exporting the file from blender, but nothing has changed.

image
image

This is what's inside the moved folder:

image

And inside the sub-folder Witch.

image

Considering that maybe this could be a problem, I don't export the .blend file, I always use the .gltf exported.

I tried moving the .gltf file to a new project, and it works normally, so I don't think an MRP makes much sense. I don't know what's causing the error, but it's unsettling how much the engine crashes with me when using the file system.

Steps to reproduce

Move a .gltf file across folders~, I guess.

Minimal reproduction project (MRP)

I tried moving the .gltf file to a new project, and it works normally, so I don't think an MRP makes much sense.

@Rubonnek
Copy link
Member

Rubonnek commented May 9, 2024

Possibly related to #91726.

Please include the logs shown to the issue in text form.

@caioraphael1
Copy link
Author

caioraphael1 commented May 9, 2024

Possibly related to #91726.

Please include the logs shown to the issue in text form.

where are those stored? The log is not inside AppData\Roaming\Godot\app_userdata\_project_name\logs

@Rubonnek
Copy link
Member

Rubonnek commented May 9, 2024

where are those stored? The log is not inside AppData\Roaming\Godot\app_userdata\_project_name\logs

Alternatively you can open the Command Prompt, then type:

/path/to/godot -e --path /path/to/project

And reproduce the crash. Then simply copy/paste the logs into the issue.

@caioraphael1
Copy link
Author

caioraphael1 commented May 9, 2024

where are those stored? The log is not inside AppData\Roaming\Godot\app_userdata\_project_name\logs

Alternatively you can open the Command Prompt, then type:

/path/to/godot -e --path /path/to/project

And reproduce the crash. Then simply copy/paste the logs into the issue.

this wasn't working, so I created a shortcut to the .exe file and pasted -e --path {the project folder} in its properties. With this the project was directly launched, but still, there's log file in the AppData\Roaming\Godot\app_userdata\_project_name\logs. I've tried running the .exe as administrator, but it's still no saving the log.

@caioraphael1
Copy link
Author

I can print the console recording and send screenshots, if necessary.

@caioraphael1
Copy link
Author

I've just confirmed that this bug does not happen in the 4.3-dev5, only in the 4.3-dev6.

@akien-mga akien-mga added this to the 4.3 milestone May 10, 2024
@akien-mga akien-mga moved this from Unassessed to Release Blocker in 4.x Release Blockers May 10, 2024
@akien-mga
Copy link
Member

CC @godotengine/import

If someone has time to bisect the regression, according to the above reports this should be checked between 89f70e9 (good) and 64520fe (bad).

@matheusmdx
Copy link
Contributor

matheusmdx commented May 14, 2024

Bisecting points to #87888 as the culprit:

image

My console showed some errors before the crash, here's the errors + backtrace:

EditorFileSystem: Importing file: res://new folder/Hestia_forUpload.gltf
Using present mode: Enabled
ERROR: Can't open file from path 'res://new folder/Hestia_forUpload.bin'.
   at: (core\io\file_access.cpp:753)
glTF: Total buffers: 1
glTF: Total buffer views: 305
glTF: Total accessors: 305
Total materials: 2
glTF: type mat4 component type: Float stride: 64 amount 96
glTF: accessor offset 0 view offset: 179500 total buffer len: 0 view len 6144
ERROR: Condition "(int)(offset + buffer_end) > buffer.size()" is true. Returning: ERR_PARSE_ERROR
   at: GLTFDocument::_decode_buffer_view (modules\gltf\gltf_document.cpp:1334)
ERROR: Condition "skin->inverse_binds.size() != joints.size()" is true. Returning: ERR_PARSE_ERROR
   at: GLTFDocument::_parse_skins (modules\gltf\gltf_document.cpp:4478)
ERROR: Condition "err != OK" is true. Returning: ERR_PARSE_ERROR
   at: GLTFDocument::_parse_gltf_state (modules\gltf\gltf_document.cpp:7189)
ERROR: Condition "err != OK" is true. Returning: err
   at: GLTFDocument::_parse (modules\gltf\gltf_document.cpp:6852)
ERROR: Condition "err != OK" is true. Returning: err
   at: GLTFDocument::append_from_file (modules\gltf\gltf_document.cpp:7370)
ERROR: Error importing 'res://new folder/Hestia_forUpload.gltf'.
   at: (editor\editor_file_system.cpp:2137)
Generated 'res://new folder/Hestia_forUpload.gltf' preview in 576 usec
Using present mode: Enabled
Using present mode: Enabled
EditorFileSystem: Importing file: res://new folder/Hestia_forUpload.gltf
Using present mode: Enabled
ERROR: Can't open file from path 'res://new folder/Hestia_forUpload.bin'.
   at: (core\io\file_access.cpp:753)
glTF: Total buffers: 1
glTF: Total buffer views: 305
glTF: Total accessors: 305
Total materials: 2
glTF: type mat4 component type: Float stride: 64 amount 96
glTF: accessor offset 0 view offset: 179500 total buffer len: 0 view len 6144
ERROR: Condition "(int)(offset + buffer_end) > buffer.size()" is true. Returning: ERR_PARSE_ERROR
   at: GLTFDocument::_decode_buffer_view (modules\gltf\gltf_document.cpp:1334)
ERROR: Condition "skin->inverse_binds.size() != joints.size()" is true. Returning: ERR_PARSE_ERROR
   at: GLTFDocument::_parse_skins (modules\gltf\gltf_document.cpp:4478)
ERROR: Condition "err != OK" is true. Returning: ERR_PARSE_ERROR
   at: GLTFDocument::_parse_gltf_state (modules\gltf\gltf_document.cpp:7189)
ERROR: Condition "err != OK" is true. Returning: err
   at: GLTFDocument::_parse (modules\gltf\gltf_document.cpp:6852)
ERROR: Condition "err != OK" is true. Returning: err
   at: GLTFDocument::append_from_file (modules\gltf\gltf_document.cpp:7370)
ERROR: Error importing 'res://new folder/Hestia_forUpload.gltf'.
   at: (editor\editor_file_system.cpp:2137)
ERROR: Condition "p_child->data.parent != this" is true.
   at: Node::remove_child (scene\main\node.cpp:1599)
ERROR: Attempt to disconnect a nonexistent connection from 'Hestia_forUpload:<Node3D#1873159450706>'. Signal: 'replacing_by', callable: 'EditorNode::set_edited_scene'.
   at: (core\object\object.cpp:1469)
ERROR: Parameter "p_node" is null.
   at: Node::is_ancestor_of (scene\main\node.cpp:1951)
ERROR: Error calling from signal 'node_added' to callable: 'Node3DEditor::Node3DEditor::_node_added': Cannot convert argument 1 from Object to Object.
   at: Object::emit_signalp (core\object\object.cpp:1214)

================================================================
CrashHandlerException: Program crashed
Engine version: Godot Engine v4.3.dev.custom_build (04dd299cbac614c0ff2306b8d3cd60dcd86abd8e)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[0] Node::is_inside_tree (C:\Users\Matheus\Downloads\Godot Source\scene\main\node.h:454)
[1] Node::is_inside_tree (C:\Users\Matheus\Downloads\Godot Source\scene\main\node.h:454)
[2] Node::is_part_of_edited_scene (C:\Users\Matheus\Downloads\Godot Source\scene\main\node.cpp:2574)
[3] TileMapLayerEditor::_node_change (C:\Users\Matheus\Downloads\Godot Source\editor\plugins\tiles\tile_map_layer_editor.cpp:3668)
[4] call_with_variant_args_helper<TileMapLayerEditor,Node *,0> (C:\Users\Matheus\Downloads\Godot Source\core\variant\binder_common.h:309)
[5] call_with_variant_args<TileMapLayerEditor,Node *> (C:\Users\Matheus\Downloads\Godot Source\core\variant\binder_common.h:419)
[6] CallableCustomMethodPointer<TileMapLayerEditor,Node *>::call (C:\Users\Matheus\Downloads\Godot Source\core\object\callable_method_pointer.h:104)
[7] Callable::callp (C:\Users\Matheus\Downloads\Godot Source\core\variant\callable.cpp:58)
[8] Object::emit_signalp (C:\Users\Matheus\Downloads\Godot Source\core\object\object.cpp:1202)
[9] Object::emit_signal<Node *> (C:\Users\Matheus\Downloads\Godot Source\core\object\object.h:933)
[10] SceneTree::node_added (C:\Users\Matheus\Downloads\Godot Source\scene\main\scene_tree.cpp:129)
[11] Node::_propagate_enter_tree (C:\Users\Matheus\Downloads\Godot Source\scene\main\node.cpp:303)
[12] Node::_set_tree (C:\Users\Matheus\Downloads\Godot Source\scene\main\node.cpp:3180)
[13] Node::_add_child_nocheck (C:\Users\Matheus\Downloads\Godot Source\scene\main\node.cpp:1553)
[14] Node::add_child (C:\Users\Matheus\Downloads\Godot Source\scene\main\node.cpp:1581)
[15] EditorNode::reload_instances_with_path_in_edited_scenes (C:\Users\Matheus\Downloads\Godot Source\editor\editor_node.cpp:5795)
[16] EditorNode::_resources_reimported (C:\Users\Matheus\Downloads\Godot Source\editor\editor_node.cpp:1052)
[17] call_with_variant_args_helper<EditorNode,Vector<String> const &,0> (C:\Users\Matheus\Downloads\Godot Source\core\variant\binder_common.h:304)
[18] call_with_variant_args<EditorNode,Vector<String> const &> (C:\Users\Matheus\Downloads\Godot Source\core\variant\binder_common.h:419)
[19] CallableCustomMethodPointer<EditorNode,Vector<String> const &>::call (C:\Users\Matheus\Downloads\Godot Source\core\object\callable_method_pointer.h:104)
[20] Callable::callp (C:\Users\Matheus\Downloads\Godot Source\core\variant\callable.cpp:58)
[21] Object::emit_signalp (C:\Users\Matheus\Downloads\Godot Source\core\object\object.cpp:1202)
[22] Node::emit_signalp (C:\Users\Matheus\Downloads\Godot Source\scene\main\node.cpp:3905)
[23] Object::emit_signal<Vector<String> > (C:\Users\Matheus\Downloads\Godot Source\core\object\object.h:933)
[24] EditorFileSystem::reimport_files (C:\Users\Matheus\Downloads\Godot Source\editor\editor_file_system.cpp:2444)
[25] EditorFileSystem::_update_scan_actions (C:\Users\Matheus\Downloads\Godot Source\editor\editor_file_system.cpp:697)
[26] EditorFileSystem::_notification (C:\Users\Matheus\Downloads\Godot Source\editor\editor_file_system.cpp:1274)
[27] EditorFileSystem::_notificationv (C:\Users\Matheus\Downloads\Godot Source\editor\editor_file_system.h:138)
[28] Object::notification (C:\Users\Matheus\Downloads\Godot Source\core\object\object.cpp:902)
[29] SceneTree::_process_group (C:\Users\Matheus\Downloads\Godot Source\scene\main\scene_tree.cpp:982)
[30] SceneTree::_process (C:\Users\Matheus\Downloads\Godot Source\scene\main\scene_tree.cpp:1059)
[31] SceneTree::process (C:\Users\Matheus\Downloads\Godot Source\scene\main\scene_tree.cpp:536)
[32] Main::iteration (C:\Users\Matheus\Downloads\Godot Source\main\main.cpp:4010)
[33] OS_Windows::run (C:\Users\Matheus\Downloads\Godot Source\platform\windows\os_windows.cpp:1577)
[34] widechar_main (C:\Users\Matheus\Downloads\Godot Source\platform\windows\godot_windows.cpp:181)
[35] _main (C:\Users\Matheus\Downloads\Godot Source\platform\windows\godot_windows.cpp:206)
[36] main (C:\Users\Matheus\Downloads\Godot Source\platform\windows\godot_windows.cpp:220)
[37] WinMain (C:\Users\Matheus\Downloads\Godot Source\platform\windows\godot_windows.cpp:234)
[38] __scrt_common_main_seh (D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
[39] <couldn't map PC to fn name>
-- END OF BACKTRACE --
================================================================

And here how was my project when the crash happens:
image

@akien-mga akien-mga moved this from Release Blocker to Immediate Blocker in 4.x Release Blockers May 17, 2024
@TokageItLab
Copy link
Member

I assume this has been fixed by #91122 already

@SaracenOne SaracenOne self-assigned this May 17, 2024
@SaracenOne
Copy link
Member

SaracenOne commented May 17, 2024

I've been investigating this and I think I know where the issue lies. Its related to the way the Skeleton3D node creates a physical bone simulator node as an ownerless child. In what might be an oversight of my implementation of the reimport system, the system actually attempts to save and copy all nodes, including ownerless ones. This is likely resulting in a cascading effect of broken references.

A more universal and reliable fix for this I think is to change the way the reimport system to have it not copy ownerless nodes, and instead, maybe, make a function call to all the nodes to give them an oppertunity to recreate any missing ownerless nodes, which I think makes sense since ownerless nodes are generally considered transient.

The only question I think remains is how we make the scene tree away of if a reimport happened in case an ownerless node needs to be rebuilt manually. In this specific case, its recreated by the ready function, but there may be other situations where this is not the case. This was originally going to be covered by a NOTIFICATION_, but it was agreed upon that this was probably the wrong approach, so it may make sense to use a named function call instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment