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

Intermittent crash when saving edited script resources #41393

Closed
AberrantWolf opened this issue Aug 20, 2020 · 5 comments · Fixed by #41547
Closed

Intermittent crash when saving edited script resources #41393

AberrantWolf opened this issue Aug 20, 2020 · 5 comments · Fixed by #41547

Comments

@AberrantWolf
Copy link
Contributor

Godot version:
4.0 (5f63682)

OS/device including version:
Windows 10 (10.0.19041)
64-bit build, observed on 64-bit debug/release-debug builds (others not attempted)

Issue description:
The Godot editor crashes (eventually) when saving a modified GDScript resource.

Steps to reproduce:

  1. Create and open a new project.
  2. Turn your scene into a 2D scene (haven't tried with 3D).
  3. Select the root node and add a new script in the "Script" option of the inspector.
  4. Accept the default options.
  5. In the script editor, add or remove whitespace.
  6. Save (via Ctrl+S -- accept the defaults for any prompts which may show up the first time)
  7. Repeat steps 5 and 6 several times (always changing something each time).
  8. After a half-dozen saves, the editor will crash.

I tracked the crash down what appears to be a String assignment/copy on line 1857 of script_editor_plugin.cpp, where the String path is assigned. The assignment goes into the CowData::_ref function, but the incoming reference appears to be invalid, even though if I navigate up the stack frame and examine what appears to be the relevant structures directly, the string which I believe is being assigned appears to be a valid string.

@ThakeeNathees
Copy link
Contributor

I can conform the crash. (I've experience this before didn't know how to reproduce)
backtrace

>	godot.windows.tools.64.exe!CowData<wchar_t>::_ref(const CowData<wchar_t> & p_from) Line 349	C++
 	godot.windows.tools.64.exe!String::String(const String & p_str) Line 354	C++
 	godot.windows.tools.64.exe!Resource::get_path() Line 95	C++
 	godot.windows.tools.64.exe!ScriptEditor::_update_script_names() Line 1857	C++
 	godot.windows.tools.64.exe!ScriptEditor::_filesystem_changed() Line 2422	C++
 	godot.windows.tools.64.exe!call_with_variant_args_helper<ScriptEditor>(ScriptEditor * p_instance, void(ScriptEditor::*)() p_method, const Variant * * p_args, Callable::CallError & r_error, IndexSequence<> __formal) Line 136	C++
 	godot.windows.tools.64.exe!call_with_variant_args<ScriptEditor>(ScriptEditor * p_instance, void(ScriptEditor::*)() p_method, const Variant * * p_args, int p_argcount, Callable::CallError & r_error) Line 158	C++
 	godot.windows.tools.64.exe!CallableCustomMethodPointer<ScriptEditor>::call(const Variant * * p_arguments, int p_argcount, Variant & r_return_value, Callable::CallError & r_call_error) Line 185	C++
 	godot.windows.tools.64.exe!Callable::call(const Variant * * p_arguments, int p_argcount, Variant & r_return_value, Callable::CallError & r_call_error) Line 50	C++
 	godot.windows.tools.64.exe!Object::emit_signal(const StringName & p_name, const Variant * * p_args, int p_argcount) Line 1077	C++
 	godot.windows.tools.64.exe!Object::_emit_signal(const Variant * * p_args, int p_argcount, Callable::CallError & r_error) Line 1009	C++
 	godot.windows.tools.64.exe!MethodBindVarArg<Object>::call(Object * p_object, const Variant * * p_args, int p_arg_count, Callable::CallError & r_error) Line 333	C++
 	godot.windows.tools.64.exe!Object::call(const StringName & p_method, const Variant * * p_args, int p_argcount, Callable::CallError & r_error) Line 797	C++
 	godot.windows.tools.64.exe!Callable::call(const Variant * * p_arguments, int p_argcount, Variant & r_return_value, Callable::CallError & r_call_error) Line 52	C++
 	godot.windows.tools.64.exe!MessageQueue::_call_function(const Callable & p_callable, const Variant * p_args, int p_argcount, bool p_show_error) Line 259	C++
 	godot.windows.tools.64.exe!MessageQueue::flush() Line 306	C++
 	godot.windows.tools.64.exe!SceneTree::iteration(float p_time) Line 415	C++
 	godot.windows.tools.64.exe!Main::iteration() Line 2375	C++
 	godot.windows.tools.64.exe!OS_Windows::run() Line 627	C++
 	godot.windows.tools.64.exe!widechar_main(int argc, wchar_t * * argv) Line 163	C++
 	godot.windows.tools.64.exe!_main() Line 185	C++
 	godot.windows.tools.64.exe!main(int argc, char * * argv) Line 199	C++
 	godot.windows.tools.64.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow) Line 213	C++
 	[Inline Frame] godot.windows.tools.64.exe!invoke_main() Line 102	C++
 	godot.windows.tools.64.exe!__scrt_common_main_seh() Line 288	C++
 	kernel32.dll!00007ffb29437bd4()	Unknown
 	ntdll.dll!00007ffb2ac2ce51()	Unknown

@Xrayez
Copy link
Contributor

Xrayez commented Aug 20, 2020

Reverting #40647 helps the crash with the call stack above, but then I get another crash while repeating the same reproduction steps (Windows 10 too):

godot.windows.tools.64.exe!Node::get_configuration_warning() Line 2675 (d:\src\godot\4\scene\main\node.cpp:2675)
godot.windows.tools.64.exe!SceneTreeEditor::_add_nodes(Node * p_node, TreeItem * p_parent) Line 253 (d:\src\godot\4\editor\scene_tree_editor.cpp:253)
godot.windows.tools.64.exe!SceneTreeEditor::_update_tree() Line 530 (d:\src\godot\4\editor\scene_tree_editor.cpp:530)
godot.windows.tools.64.exe!MethodBind0<SceneTreeEditor>::call(Object * p_object, const Variant * * p_args, int p_arg_count, Callable::CallError & r_error) Line 149 (d:\src\godot\4\core\method_bind.gen.inc:149)
godot.windows.tools.64.exe!Object::call(const StringName & p_method, const Variant * * p_args, int p_argcount, Callable::CallError & r_error) Line 797 (d:\src\godot\4\core\object.cpp:797)
godot.windows.tools.64.exe!Callable::call(const Variant * * p_arguments, int p_argcount, Variant & r_return_value, Callable::CallError & r_call_error) Line 52 (d:\src\godot\4\core\callable.cpp:52)
godot.windows.tools.64.exe!MessageQueue::_call_function(const Callable & p_callable, const Variant * p_args, int p_argcount, bool p_show_error) Line 259 (d:\src\godot\4\core\message_queue.cpp:259)
godot.windows.tools.64.exe!MessageQueue::flush() Line 306 (d:\src\godot\4\core\message_queue.cpp:306)
godot.windows.tools.64.exe!SceneTree::iteration(float p_time) Line 415 (d:\src\godot\4\scene\main\scene_tree.cpp:415)
godot.windows.tools.64.exe!Main::iteration() Line 2375 (d:\src\godot\4\main\main.cpp:2375)
godot.windows.tools.64.exe!OS_Windows::run() Line 627 (d:\src\godot\4\platform\windows\os_windows.cpp:627)
godot.windows.tools.64.exe!widechar_main(int argc, wchar_t * * argv) Line 163 (d:\src\godot\4\platform\windows\godot_windows.cpp:163)
godot.windows.tools.64.exe!_main() Line 185 (d:\src\godot\4\platform\windows\godot_windows.cpp:185)
godot.windows.tools.64.exe!main(int argc, char * * argv) Line 199 (d:\src\godot\4\platform\windows\godot_windows.cpp:199)
godot.windows.tools.64.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow) Line 213 (d:\src\godot\4\platform\windows\godot_windows.cpp:213)
[Inline Frame] godot.windows.tools.64.exe!invoke_main() Line 102 (d:\agent\_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:102)
godot.windows.tools.64.exe!__scrt_common_main_seh() Line 288 (d:\agent\_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
kernel32.dll!00007ffb7cf77bd4() (Unknown Source:0)
ntdll.dll!00007ffb7d8cce51() (Unknown Source:0)

So I'm not sure if there's something wrong with #40647 or it may have just revealed some regression (need bisect?)

@ThakeeNathees @AberrantWolf for how long have you experienced this crash?

@AberrantWolf
Copy link
Contributor Author

for how long have you experienced this crash?

I've only been building from code for the last 3 days. Definitely from yesterday, though. Possibly not the day before, but I don't recall (and didn't edit much code that day).

@ThakeeNathees
Copy link
Contributor

for how long have you experienced this crash?

me too yesterday. must be caused by a very recent change.

@Xrayez
Copy link
Contributor

Xrayez commented Aug 20, 2020

Should be fixed by #41399. All those crashes are related to script resources being manually unreferenced in a thread, which explains intermittent crashes, so indeed #40647 is not a cause.

for how long have you experienced this crash?

me too yesterday. must be caused by a very recent change.

Yeah it is caused by #41359.

@akien-mga akien-mga added this to the 4.0 milestone Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants