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

Loading a scene using "ResourceLoader.load_threaded_request" using (subthread = true) causes cascade of "Invalid Task ID" errors #94018

Closed
cosmoddd opened this issue Jul 7, 2024 · 11 comments · Fixed by #94070

Comments

@cosmoddd
Copy link

cosmoddd commented Jul 7, 2024

Tested versions

  • Reproducible in the 4.3 beta2 build. Haven't tested earlier 4.3 builds. Not reproducible in 4.2 builds.

System information

Godot v4.3.beta2 - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2060 (NVIDIA; 32.0.15.5612) - Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz (12 Threads)

Issue description

When I use
ResourceLoader.load_threaded_request(level, "", true)
to load a level, it causes a cluster of the same error message:
wait_for_task_completion: Invalid Task ID
image
The more complex the load, the more these messages keep appearing.
This does not happen when I tweak the level loading code here:
ResourceLoader.load_threaded_request(level, "", false)
or here:
var loaded_scene = ResourceLoader.load(level)
This was not an issue in the latest 4.2 release.

Steps to reproduce

Import the project and open the "Base Level" scene.
Press F5 to start the game.
Notice the error outputs in the Debugger tab should all say:
wait_for_task_completion: Invalid Task ID

Minimal reproduction project (MRP)

The project can be downloaded here: https://drive.google.com/file/d/1EGhASSLeyHpbAaYk0Vv9C0yQLZhI2B8B/view?usp=sharing

It weights about 200 mb and is compatible with 4.3beta2

@cosmoddd cosmoddd changed the title Loading a scene using "ResourceLoader.load_threaded_get" causes many "Invalid Task ID" errors Loading a scene using "ResourceLoader.load_threaded_request using (subthread = true) causes cascade of "Invalid Task ID" errors Jul 7, 2024
@cosmoddd cosmoddd changed the title Loading a scene using "ResourceLoader.load_threaded_request using (subthread = true) causes cascade of "Invalid Task ID" errors Loading a scene using "ResourceLoader.load_threaded_request" using (subthread = true) causes cascade of "Invalid Task ID" errors Jul 7, 2024
@dalexeev dalexeev added this to the 4.3 milestone Jul 7, 2024
@dalexeev dalexeev moved this from Unassessed to Release Blocker in 4.x Release Blockers Jul 7, 2024
@dalexeev
Copy link
Member

dalexeev commented Jul 7, 2024

CC @RandomShaper

@akien-mga
Copy link
Member

Haven't tested the project here yet, but for the record @RandomShaper, I've seen the same errors in W4's project genesis.

@matheusmdx
Copy link
Contributor

Bisecting points to #93082 as the culprit:

image

@LunaticWyrm467
Copy link

Hey, I don't know if I should make a new issue, but I'm having a very similar issue to this one now that I upgraded to Godot v4.4 with the ResourceLoader.load_threaded_request() and ResourceLoader.load_threaded_get() functions (wasn't an issue in Godot v4.3).

This is the code in question that's raising the errors:

## Loads all of the rooms. Called to initiate the loading process in `_process()`.
func load_all() -> void:
	GlobalLoadingScreen.activate_scene()
	for unloaded_room: String in rooms:
		ResourceLoader.load_threaded_request(unloaded_room) # Commenting this stops the error cascade.
	queue = rooms.duplicate()

func _process(_delta: float) -> void:
	var finished: Array[String] = []
	for unloaded_room: String in queue:
		var progress: Array[float]                    = []
		var status:   ResourceLoader.ThreadLoadStatus = ResourceLoader.load_threaded_get_status(unloaded_room, progress)
		
		if status == ResourceLoader.ThreadLoadStatus.THREAD_LOAD_LOADED:
			finished.push_front(unloaded_room)
			
			var room: Node = ResourceLoader.load_threaded_get(unloaded_room).instantiate()  # Line 83 as reported by the error. Commenting this stops that specific error.
			if room is Room:
				var player_origin: bool = contains_players_origin and room.room_ID == players_origin_ID
				if player_origin:
					room.player_origin = true
					room_focused       = players_origin_ID
				
				add_child(room)
				
				rooms_loaded[room.room_ID] = room
				if not player_origin:
					room.global_position.x = -DIST_UNFOCUSED_ROOM
					room.visible           = false
	
	for finished_room: String in finished:
		queue.erase(finished_room)
		if queue.is_empty():
			GlobalLoadingScreen.exit_load()

Here are the errors in question:
Image

I should mention that aside from being somewhat annoying there are no bugs or glitches with the loaded-in scene in-game.

@matheusmdx
Copy link
Contributor

@LunaticWyrm467 Please open a new issue with a MRP so we can properly check the problem to find a solution.

@AdriaandeJongh
Copy link
Contributor

I'm also seeing this issue reopened after updating my project from 4.3 to 4.4.

@jeremeyzela
Copy link

jeremeyzela commented Mar 5, 2025

Same issue here after upgrading to 4.4. After some experimentation I noticed that if I set the use_sub_threads parameter to true, the error goes away.

@LunaticWyrm467
Copy link

I am currently working on an MRP.
However, @matheusmdx I have a question. Since this appears to be the same issue as before - even with the use_sub_threads being the culprit, shouldn't this specific issue report get reopened instead of making a new one?

@matheusmdx
Copy link
Contributor

@LunaticWyrm467 No because look the OP, problem was before the 4.3 stable and the fix was done before 4.3 stable launch (as yourself pointed in your commentary that works in 4.3 stable) so the cause is another thing that needs to be investigated. That should be reopened only if the fix failed in 4.3 stable.

@AdriaandeJongh
Copy link
Contributor

can confirm that setting using subthreads while loading makes this issue disappear!

@LunaticWyrm467
Copy link

Created a new issue here: #103648

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Release Blocker
Development

Successfully merging a pull request may close this issue.

8 participants