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

"-nan.0" saved to .tscn scene prevents scene from being opened again #32843

Closed
DragonAxe opened this issue Oct 15, 2019 · 4 comments
Closed

"-nan.0" saved to .tscn scene prevents scene from being opened again #32843

DragonAxe opened this issue Oct 15, 2019 · 4 comments

Comments

@DragonAxe
Copy link

Godot version:
v3.1.1.stable.official, downloaded from the Godot main page as Godot_v3.1.1-stable_x11.64.zip

OS/device including version:
OS: Arch Linux: 5.3.0-arch1-1-ARCH #1 SMP PREEMPT Mon Sep 16 03:29:01 UTC 2019 x86_64 GNU/Linux

GPU: VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 07)

Issue description:
The line angular_velocity = -nan.0 is added to the attributes of a ParticlesMaterial sub-resource in a .tscn scene which prevents the scene from being re-opened. Re-opening the scene will produce the following error in Godot's Output console:

 scene/resources/resource_format_text.cpp:524 - res://bug.tscn:31 - Parse Error: Can't load cached sub-resource: res://bug.tscn::3
 core/io/resource_loader.cpp:208 - Condition ' err != OK ' is true. returned: RES()
 Failed loading resource: res://bug.tscn
 editor/editor_data.cpp:564 - Index p_idx=1 out of size (edited_scene.size()=1)

The only way to fix this issue is to find and remove/replace -nan.0 from the .tscn file using an external text editor.

Steps to reproduce:

  • Open Godot.
  • Open the attached NaNbUg project.
  • Open bug.tscn.
  • Dismiss the load errors
  • Ctrl+S to save the scene without modifying anything.
  • Close the bug.tscn scene.
  • Try to re-open bug.tscn. (this will trigger the error above)

Minimal reproduction project:
NaNbUg.tar.gz

Other observations
In the process of simplifying my buggy project, I observed the following:

  • The actor.res file is important to the behavior of this bug. If it is not included in the bug.tscn scene, I don't experience my bug.
  • If I open actor.res, dismiss the load errors, then save it, then I don't experience my bug.
    There is a difference in size between the problem actor.res (1.3K bytes) and the re-saved version (636 bytes).
  • If I edit bug.tscn and remove lines 7 & 13 ([sub_resource type="PlaneMesh" id=2] and draw_pass_1 = SubResource( 2 )), Godot still adds angular_velocity = -nan.0 to bug.tscn, but it no longer fails to re-open. However, instead of the expected node tree being displayed in the scene graph panel, the scene graph of actor.res is displayed.
    What makes this strange is that the VariantReader class doesn't have code to handle -nan.0 that I could find.
    Also, if I save the scene again, bug.tscn gets overridden with the same node structure as actor.res which is similar to this bug: Godot saves scenes over others, producing data loss and stack overflows #10675

Note: -nan.0 is not added to the bug.tscn in the latest nightly build from Hugo version v3.2.alpha.calinou.1fed266bf. However, attempting to open bug.tscn with the -nan.0 line results in the following crash:

handle_crash: Program crashed with signal 11
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /usr/lib/libc.so.6(+0x3bfb0) [0x7f92a7930fb0] (??:0)
[2] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x17f47e2] (??:?)
[3] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x1ef5d0d] (??:?)
[4] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x1ef7d5a] (??:?)
[5] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0xf463f9] (??:?)
[6] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x105c623] (??:?)
[7] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x105c7e5] (??:?)
[8] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x4ac475] (??:0)
[9] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x2661b3f] (??:?)
[10] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x266f335] (??:?)
[11] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x2670100] (??:?)
[12] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x1a31b8f] (??:?)
[13] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x1067429] (??:?)
[14] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x2662ad1] (??:?)
[15] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x2660581] (??:?)
[16] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x184d9c9] (??:?)
[17] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x185ab70] (??:?)
[18] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x185dd47] (??:?)
[19] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x185dfb5] (??:?)
[20] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x6db509] (??:0)
[21] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x2661b3f] (??:?)
[22] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x2660521] (??:?)
[23] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x1830532] (??:?)
[24] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x1832352] (??:?)
[25] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x4397d0] (??:0)
[26] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x436b22] (??:0)
[27] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x42b9a0] (??:0)
[28] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x42cb80] (??:0)
[29] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x41b1b2] (??:0)
[30] /usr/lib/libc.so.6(__libc_start_main+0xf3) [0x7f92a791c153] (??:0)
[31] /tmp/.mount_godot-Q1Uofo/usr/bin/godot() [0x41dcaf] (??:0)
-- END OF BACKTRACE --
@Calinou
Copy link
Member

Calinou commented Oct 15, 2019

I can reproduce this on commit 1fed266 (and using 3.1.1 for the initial saving).

These are the contents of bug.tscn after following the steps described. Godot fails to open it, but it doesn't crash:

[gd_scene load_steps=4 format=2]

[ext_resource path="res://actor.res" type="PackedScene" id=1]

[sub_resource type="ParticlesMaterial" id=1]
angular_velocity = -nan.0

[sub_resource type="PlaneMesh" id=2]

[node name="Node" type="Node"]

[node name="Particles" type="Particles" parent="."]
process_material = SubResource( 1 )
draw_pass_1 = SubResource( 2 )

[node name="actor" parent="." instance=ExtResource( 1 )]

Message:

 scene/resources/resource_format_text.cpp:528 - res://bug.tscn:14 - Parse Error: Can't load cached sub-resource: res://bug.tscn::2

actor.res is still 1.3 KB in my local copy of the project.

@aaronfranke
Copy link
Member

Can someone please test if this bug exists in the current master or in the current 3.2 branch? This may have been fixed by #36042 which has been cherry-picked for 3.2.2.

@akien-mga
Copy link
Member

I can't reproduce any issue with the MRP (even in 3.2.1-stable), but I'm fairly confident this is the same issue as #35388, which was fixed.

@akien-mga akien-mga added this to the 4.0 milestone Apr 10, 2020
@DragonAxe
Copy link
Author

I haven't encountered my bug again, though I also don't use .res format files anymore in my workflow.
Thank you all for your amazing work on Godot!!

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

4 participants