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

ZIPPacker.open() causes index out of bounds error in Web after updating from Emscripten 3.1.18 to 3.1.39 #85564

Closed
OverloadedOrama opened this issue Nov 30, 2023 · 6 comments · Fixed by #86036

Comments

@OverloadedOrama
Copy link
Contributor

OverloadedOrama commented Nov 30, 2023

Godot version

4.2.stable

System information

openSUSE Tumbleweed 20231122 - X11 - GLES3 (Compatibility) - NVIDIA GeForce GTX 1060 6GB (nvidia) - AMD Ryzen 5 1600 Six-Core Processor (12 Threads)

Browsers tested: Mozilla Firefox 119.0.1 and Chromium 119.0.6045.159

Issue description

Using ZIPPacker.open() crashes in the Web version in Godot 4.2, giving an "index out of bounds" error. This did not happen in Godot 4.1.2. ZIPReader seems to be working correctly. I have only tested Mozilla Firefox 119.0.1 and Chromium 119.0.6045.159 on openSUSE Tumbleweed.

EDIT: The issue seems to have been introduced in Godot 4.2-beta3. In beta 2 this does not happen.

Firefox:
image

Chromium:
image

Errors keep appearing in the console as long as the tab is open.

Steps to reproduce

Create an empty project, add a node and attach this script to it:

extends Node


func _ready() -> void:
	var zip_packer := ZIPPacker.new()
	var err := zip_packer.open("user://test.zip")
	print(err)
	zip_packer.close()

And run it on the Web version. It should crash.

Minimal reproduction project

ZIPPackerWeb.zip

@OverloadedOrama
Copy link
Contributor Author

After testing, I have confirmed that this regression is introduced in Godot 4.2-beta3. In beta 2 the issue does not occur.

@akien-mga
Copy link
Member

Interesting, I don't see any likely culprit in the change log: https://godotengine.github.io/godot-interactive-changelog/#4.2-beta3

But beta 3 is when I updated the toolchains as per https://godotengine.org/article/dev-snapshot-godot-4-2-beta-3/, so we went from Emscripten 3.1.18 to 3.1.39.

So it seems something changed in Emscripten that broke Godot again.

@akien-mga akien-mga changed the title [4.2] ZIPPacker.open() causes index out of bounds error in Web ZIPPacker.open() causes index out of bounds error in Web after updating from Emscripten 3.1.18 to 3.1.39 Nov 30, 2023
@OverloadedOrama
Copy link
Contributor Author

If Emscripten is to blame, then perhaps downgrading it to 3.1.18 might be a good idea for Godot 4.2.1. I just finished a jam game, and some hours before the deadline, I noticed crashes on the Web export on a certain level. I opened the browser console and the messages were the exact same as the ZIPPacker issue (the game doesn't use ZIPPacker). I reverted the game back to Godot 4.1 and it run perfectly.

Unfortunately I'm not sure I can provide an MRP for this. but I could try if it's required. If the Emscripten version changes for Godot 4.2.1, I can try again to see if I can reproduce the issue.

@adamscott
Copy link
Member

adamscott commented Dec 11, 2023

We found the culprit. Emscripten updated their default values for -sSTACK_SIZE and -sDEFAULT_PTHREAD_STACK_SIZE. Reverting back to the original default (#86036) values fixes your issue.

@akien-mga
Copy link
Member

Indeed, for the record, the change happened in Emscripten 3.1.27.
3.1.26 works fine, if someone needs it to build a custom 4.2-stable (but #86306 should be in 4.2.1-stable).

@OverloadedOrama
Copy link
Contributor Author

Thank you so much!

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