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

Windows release export crashes on scene change #75422

Closed
lorenzo-arena opened this issue Mar 28, 2023 · 20 comments
Closed

Windows release export crashes on scene change #75422

lorenzo-arena opened this issue Mar 28, 2023 · 20 comments

Comments

@lorenzo-arena
Copy link

Godot version

4.0.1.stable

System information

Windows 11, Ryzen 3700U Vega 10 iGPU

Issue description

I'm having a lot a problems with the release export of my game on Windows. Running the game from the editor or exporting it as debug doesn't present the issue.

One of the problems seems to be already tracked #70910, but after removing some of the objects in a GridContainer I'm still getting crashes (not always) on scene change. I've enabled file logs and only sometime I get the following lines reported in the log; other times no error is reported.

USER ERROR: Condition "!canvas_item" is true.
   at: canvas_item_clear (servers/rendering/renderer_canvas_cull.cpp:1642)

I've not tried to reproduce the issue in a minimal project but I can try if it's necessary.

Steps to reproduce

  • create various scenes with many UI elements and containers
  • do a release export of the game (for Windows, not sure if the same happens on Linux)
  • run the game and switch between such scenes
  • randomly, but typically after 4-6 scene changes the game crashes

Minimal reproduction project

N/A

@lorenzo-arena
Copy link
Author

For clarity, here's the full log of the export run with --verbose:

Godot Engine v4.0.1.stable.mono.official.cacf49999 - https://godotengine.org
TextServer: Added interface "Dummy"
TextServer: Added interface "ICU / HarfBuzz / Graphite (Built-in)"
Text-to-Speech: SAPI initialized.
Vulkan devices:
  #0: AMD AMD Radeon(TM) Vega 10 Graphics - Supported, Integrated
Vulkan API 1.2.196 - Forward+ - Using Vulkan Device #0: AMD - AMD Radeon(TM) Vega 10 Graphics
Optional extension VK_KHR_fragment_shading_rate not found
Optional extension VK_KHR_incremental_present not found
Optional extension VK_GOOGLE_display_timing not found
- Vulkan Variable Rate Shading not supported
- Vulkan multiview supported:
  max view count: 6
  max instances: 4294967295
- Vulkan subgroup:
  size: 64
  stages: STAGE_VERTEX, STAGE_TESSELLATION_CONTROL, STAGE_TESSELLATION_EVALUATION, STAGE_GEOMETRY, STAGE_FRAGMENT, STAGE
  supported ops: FEATURE_BASIC, FEATURE_VOTE, FEATURE_ARITHMETIC, FEATURE_BALLOT, FEATURE_SHUFFLE, FEATURE_SHUFFLE_RELAD
  quad operations in all stages
Using "winink" pen tablet driver...
Creating VMA small objects pool for memory type index 0
Shader 'CanvasSdfShaderRD' SHA256: 4b1062c468aa27d747c07bbba316c72b295dda03f86814a58fa9b3d44a901417
Shader 'SkeletonShaderRD' SHA256: 991765204622414f90767f256fbf33d79d2f7a1373eddfc6cba1c18c277a8bd6
Shader 'ParticlesShaderRD' SHA256: 6a0b3c8d0fa92b395ed38d276933219b9fb451729d7dba75af2f499672a8bbad
Shader 'ParticlesCopyShaderRD' SHA256: b17358aa9d8d54b9938303feaffd21535f34186eeb5d99360afcccd9f14e4bf9
Shader 'CanvasShaderRD' SHA256: 0461a8fd3a27eb21de4909e7080631facbe3eac44bf727c08f6198f87b21d605
Shader 'CanvasOcclusionShaderRD' SHA256: f6a526c4d372f31a96fce24696c8723186f0c78ee582056a5c9bf5068e1328a4
Shader 'ClusterRenderShaderRD' SHA256: d8cb0da7c72322cb0a0dd2f5c25295243c64669288360b412e48bc38a409c004
Shader 'ClusterStoreShaderRD' SHA256: 2b00b6bea0b0f479d326585596a8c9f74675f6ef025cbcbd6b541d4840c873a0
Shader 'ClusterDebugShaderRD' SHA256: 5b2faa44af170cb22ae1129a609e6dfb33c9a703a08358f1a8d98703728ba614
Shader 'SceneForwardClusteredShaderRD' SHA256: f4d13909d8e7907a71dcf39d2d5ed679884a26424264669e02597748bf5c118b
Shader 'ResolveShaderRD' SHA256: c39bbc516a625f1e8a0e9429f2f30a6b5479dc693ee392d7f2c559dfef727b1e
Shader 'TaaResolveShaderRD' SHA256: 2b0d1b95b5c485dead113fda5006f41cd75b3c61a335913b09fd76c7fd8ca0fe
Shader 'SsEffectsDownsampleShaderRD' SHA256: d939fb1d284c284abae666419786a9e5bbd622e464c1c82ce4d84a67ffed7901
Shader 'SsilShaderRD' SHA256: a3cfc0c588742302badeefb4b8a87d7444b6a70c1ea8556d1038f7639e5b3946
Shader 'SsilImportanceMapShaderRD' SHA256: d5d1b8b208a25ddc78f6bd9e47b3bafcb1a1546c9d1a0c8ea2f7d4835d993899
Shader 'SsilBlurShaderRD' SHA256: 648384816fc82e903b18722bd72d266d5f5c17b26afda5e59ad105aee39cd28b
Shader 'SsilInterleaveShaderRD' SHA256: 7587b55966e887ce20ed6462daeda3a4344b71807fc7abd1dcbd0b5125b3e5b4
Shader 'SsaoShaderRD' SHA256: 650927a35a79e8ed180796b97e5b00e650c9921da1250cb2baf00af69d4fe573
Shader 'SsaoImportanceMapShaderRD' SHA256: b4cedbc78e0ae57d574f5cdd0a7b06be2d55a3d7f61a84a08695d2f29ad4bbee
Shader 'SsaoBlurShaderRD' SHA256: 690c79b7c6efd9377bbcfc24f8dfb2962ffa33b51f2c43698efd88805edd6429
Shader 'SsaoInterleaveShaderRD' SHA256: b1a688a24b5716e604fa58cf2c9f898c991246e4c24cdb9ad5714d7fa33dfcc1
Shader 'ScreenSpaceReflectionScaleShaderRD' SHA256: e4154122165ca5aee97bccd4af66e5d9454de96fe91b24d1139909fb8415e2ba
Shader 'ScreenSpaceReflectionShaderRD' SHA256: 4aff8312ac94d520e501a3b3cb42570a39631340df2241e6b6d9d3d9c3d460de
Shader 'ScreenSpaceReflectionFilterShaderRD' SHA256: e95242f73dab802b2f7960ae02e6bef72799971e370a88d2211ab4094825adcd
Shader 'SubsurfaceScatteringShaderRD' SHA256: 658c2c54ecdbf823d87b79e0258645fd8065aa5d11da54aa1433136d54c752c7
Shader 'SkyShaderRD' SHA256: e963cf0443cf1add2b8fc33d15c24514f1db6dc1418f0508f41c927b3ea9ab86
Shader 'VoxelGiShaderRD' SHA256: fa4ae2df5821510760bec73742f4fafedfac6040de7c1d02c93566d6f57a3910
Shader 'VoxelGiDebugShaderRD' SHA256: fda3094357334539f00110205fdef738124f7a01acbfb1ca97db442d46dae3d2
Shader 'SdfgiPreprocessShaderRD' SHA256: a034aea206c742f42932d57cb00db128bf88c937cb8c5392345d52d99b7b5ec2
Shader 'SdfgiDirectLightShaderRD' SHA256: f98e1f3913d81068826238b829593f8cf46249537038a089152c391d8d9970fc
Shader 'SdfgiIntegrateShaderRD' SHA256: 9684077f48da9aad708aa0c15af70289fa437b6f298aef9855b3ceac22d01b20
Shader 'GiShaderRD' SHA256: abf05367254cc25962ac66ba933eb99e63d91dcaae59765a211c5ba0be8b5089
Shader 'SdfgiDebugShaderRD' SHA256: dddfbecefb1552ebe6084d8ab884757e009172aad8efc2d98e24d5c1b2681081
Shader 'SdfgiDebugProbesShaderRD' SHA256: d09f0735dd96c0893ed6bac622ec3546c6595b3de07952d70c9d87c3e8a32dc0
Shader 'VolumetricFogShaderRD' SHA256: 18e3dcdc828b59c5f0f84b8aa25bfc8a95752a4ae0cef7339bcd66fb9068f44a
Shader 'VolumetricFogProcessShaderRD' SHA256: d829d2e13f5068a0fbfb775fe33884190e9db7de55e39926630a97e6d822a6a0
Shader 'BokehDofShaderRD' SHA256: d10c80602cb02768fd04a6036b9e908aca73a9b1cedf325905ea28921d8b4a8d
Shader 'CopyShaderRD' SHA256: 1a49dddbd90fa946fd06f8ee1c4eb92fea7e285354fd47fab0da9af7557e8681
Shader 'CopyToFbShaderRD' SHA256: c01702a05ff4be3d44e6bb30ceb5d8483d696d28f8470a4ca4176c2ef59cd6ae
Shader 'CubeToDpShaderRD' SHA256: ae860b6604e52dfdd5700a6fe314244ea151c9e5a0ccd03d233955b55fe1f0b1
Shader 'CubemapDownsamplerShaderRD' SHA256: 94fec8ede4e3af403887eae0effae4903f1153bcf0d462093b5d0ae8d7854f12
Shader 'CubemapFilterShaderRD' SHA256: c99936ee89a4c27690126937cfd7b1a5633e3fcd969c15aed906c44bd2655fad
Shader 'CubemapRoughnessShaderRD' SHA256: 2194d815fe6a3733e4856b70bd4eeba7f891aaf704e6994cfdb7d319d04b1604
Shader 'SpecularMergeShaderRD' SHA256: 8d678b036dc386ed8dd97e3bcec14a8d6633da9b02c71b8cdbb56c0e13dc47b3
Shader 'LuminanceReduceShaderRD' SHA256: c33e3288ac8756fa528e40fd546a472df128b23d853bf7f15848a8e5592049f7
Shader 'TonemapShaderRD' SHA256: dbd973596a70e5a6d3f61cc445dc684671d6dc5bb9132b3e077d3bbfb61d38fd
Shader 'FsrUpscaleShaderRD' SHA256: dd405f3e530004c072d64f9270c676c646d90648b293ad56442fa8356d90fccf
Shader 'RoughnessLimiterShaderRD' SHA256: 96a342cddaf371ab4dc6389eebfc3a8a86002191d6f9a6d3e1cc19ad9fbada8b
Shader 'SortShaderRD' SHA256: 613e0a40c3a3efcbdd1ac72d3d4912d05cd56ff626ec2ee414851b8adaee90f0
Shader 'BlitShaderRD' SHA256: 4aa4b246c96a8a4f946d37f6bd189e3dc298e93e463f667ffc633a2e6b733bb4
WASAPI: Activated output_device using IAudioClient3 interface
WASAPI: wFormatTag = 65534
WASAPI: nChannels = 2
WASAPI: nSamplesPerSec = 48000
WASAPI: nAvgBytesPerSec = 384000
WASAPI: nBlockAlign = 8
WASAPI: wBitsPerSample = 32
WASAPI: cbSize = 22
WASAPI: mix_rate = 48000
WASAPI: fundamental_period_frames = 512
WASAPI: min_period_frames = 512
WASAPI: max_period_frames = 512
WASAPI: selected a period frame size of 512
WASAPI: detected 2 channels
WASAPI: audio buffer frames: 512 calculated latency: 10ms

TextServer: Primary interface set to: "ICU / HarfBuzz / Graphite (Built-in)".
.NET: Initializing module...
Found hostfxr: C:/Users/arena/Desktop/The Arena/Windows/data_2DSurvivorCourse_x86_64/hostfxr.dll
.NET: hostfxr initialized
.NET: GodotPlugins initialized
CORE API HASH: 0
EDITOR API HASH: 0
Loading resource: res://.godot/exported/133200997/export-5c65d9bf5a19b5a37a34ccde81cf844a-game_events.scn
Loading resource: res://.godot/exported/133200997/export-b4bf91531511b08b58f5067803df3860-music_player.scn
Loading resource: res://.godot/exported/133200997/export-40ec397d4a2e7b96152938afb95fb7fe-screen_transition.scn
Loading resource: res://.godot/exported/133200997/export-2a53f3ec6582c5c8787876c95d8262ad-meta_progression.scn
ERROR: Condition "!canvas_item" is true.
   at: canvas_item_clear (servers/rendering/renderer_canvas_cull.cpp:1642)

Also note that the ERROR log doesn't always get printed, sometimes the last lines are the Loading resource ones (but the crash always happen at scene change).

@saipheblue
Copy link

saipheblue commented Jun 28, 2023

So glad I found this topic was going mental because the game crashed sometimes on scene change and I had no idea why. Can confirm this is happening only during windows export without debug. With debug it all works. And only with scenes with many nodes in my small project with just scene change button it works flawlessly.
v4.0.stable.official [92bee43] and v4.0.3.stable.official [5222a99]

@gmjosack
Copy link

gmjosack commented Jul 8, 2023

I've also run into this. Only solution I've found is to not use the change scene methods and instead have a master node just manage child node changes. I've also seen this pop up semi often for people in various game dev discord help channels.

@Calinou
Copy link
Member

Calinou commented Jul 9, 2023

@lorenzo-arena @saipheblue @gmjosack Please upload a minimal reproduction project to make this easier to troubleshoot.

@gmjosack
Copy link

gmjosack commented Jul 9, 2023

Spent a while trying to pull things out of a project where I've experienced this but as I remove more functionality it stops crashing and haven't been able to find a decent minimal reproduction. Will continue to attempt to find something.

@gmjosack
Copy link

gmjosack commented Jul 9, 2023

I've managed to get something the crashes fairly regularly but not super consistently.

This project is setup with a player that can move with arrows and a keybind of r to restart the scene. When restarting the scene sometimes the game will crash. My best success at reproducing is to hold a direction with the arrows and tap r to restart and it will occasionally crash. hooking up xdb64 it seems to crash in something related to creating a thread? The crashes were more frequent in my actual game projects and they're intermittent so it seems like some kind of race condition possibly.

Note: I only see crashes in non-debug builds on Windows. Running the project in the editor and Debug builds on windows never crash.

minimal-crash-repro.zip

@Calinou
Copy link
Member

Calinou commented Jul 11, 2023

Some additional context if you're looking into fixing this bug: #79318 (comment)

@gmjosack
Copy link

I continue to see reports about this in the Godot help channels so adding a quick workaround here so people can see it when linked this issue:

Having a node that manages scenes for you instead of using the change scene functions seems to be an effective workaround.

Add a signal you can access from anywhere. If you don't already have an autoload you can add a new script such as events.gd with the following:

extends Node

signal change_scene(path_to_scene)

and add is as an autoload called Events.

Make a new scene with a Node as a base called SceneManager.
Add your existing Main Scene as a child of the SceneManagerand make SceneManager your new Main Scene.
Add a script the the SceneManager with the following:

extends Node

func _ready():
	Events.change_scene.connect(_change_scene)


func _change_scene(path_to_scene):
	for child in get_children():
		remove_child(child) # Crashes without explicitly removing from the scene.
		child.queue_free()

	var new_scene = load(path_to_scene).instantiate()
	add_child(new_scene)

Then whenever you need to change scenes you can just use the following code:

Events.change_scene.emit("res://path/to/new/scene.tscn")

@YuriSizov
Copy link
Contributor

This is likely fixed by #78988. The fix will be available for public testing in dev2, or you can compile the current master branch and test that. Let me know if the issue is still relevant after the fix and we can reopen it.

@YuriSizov YuriSizov added this to the 4.2 milestone Jul 26, 2023
@Fizzzo42
Copy link

@gmjosack 's workaround worked. Still a problem with 4.1.1

@greenya
Copy link

greenya commented Oct 6, 2023

This is still a problem in 4.1.2 for Windows Desktop Release build.

@Calinou
Copy link
Member

Calinou commented Oct 6, 2023

As mentioned in the above comment, the fix is only in 4.2.dev currently. It hasn't been cherry-picked to 4.1.x yet, but this is planned as per the cherrypick:4.1 label on #78988.

@YuriSizov
Copy link
Contributor

Note that the label doesn't mean it's planned. It's only considered, but since this is a core change, it may be better to leave it be and suggest you update to 4.2 instead.

@greenya
Copy link

greenya commented Oct 7, 2023

Note that the label doesn't mean it's planned. It's only considered, but since this is a core change, it may be better to leave it be and suggest you update to 4.2 instead.

Thank you for response.

I actually have tried 4.2.dev6 version yesterday i have even bigger issues with it. It doesn't crash on scene changes but it has some issues with animation (in my simple game character has couple of run animation frames, in 4.2.dev6 they are just 1 frame, some character seems like slide without animation), also input keys (they sometimes stuck in pressed state). So i guess i will use 4.1.2 for now and Debug build for Windows platform.

trevyn added a commit to trevyn/godottest that referenced this issue Oct 16, 2023
@KccbzZ
Copy link

KccbzZ commented Oct 24, 2023

Omg this is so exciting. @gmjosack 's workaround seems to have saved my first big project that I worked on for ages. I have never really exported any of my projects so far, so now that I ran into this issue, I felt hopeless about it for the past week or so.

I'm super grateful that you posted this workaround here! I'm very shaky about actually believing my eyes that there's no errors in my release build and that it ACTUALLY doesn't crash haha!

Thank you so much for posting this, super grateful for you!! :D

@Benardus
Copy link

I have the same problem in 4.1.2 for Windows Desktop Release build. Do I understand correctly that this is solved in Godot version 4.2?

@YuriSizov
Copy link
Contributor

@Benardus Yes, that is correct.

@Lippanon
Copy link

v4.2.rc.custom_build [80de898]
I'm crashing on release only, Windows 64bit. When opening through cmd there is no error or anything, it just crashes. Can this be reopened? Or #79318? I don't see any errors in debug and verbose doesn't help either so I'm not sure what to do.

@YuriSizov
Copy link
Contributor

@Lippanon Please open a new report with as much information as you can provide. A crash can happen for any number of reason, and from your description there is no link to either issue at this time.

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