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

cmd/compile: wasm: LinkError: "data segment does not fit in memory" #34395

Closed
Splizard opened this issue Sep 19, 2019 · 8 comments
Closed

cmd/compile: wasm: LinkError: "data segment does not fit in memory" #34395

Splizard opened this issue Sep 19, 2019 · 8 comments
Labels
arch-wasm WebAssembly issues FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@Splizard
Copy link

There is a regression from 1.12 to 1.13, a program that successfully compiles and runs on Firefox and Google Chrome in Go 1.12 will not run when compiled with Go 1.13

Firefox gives the error:

LinkError: "data segment does not fit in memory"

Google Chrome gives the error:

LinkError: WebAssembly.instantiate(): data segment is out of bounds

The project is quite large and the Web Assembly file is ~50mb when uncompressed.

I'm happy to provide further details on request, however, I don't have a trivial program that reproduces this.
I am using the appropriate wasm_exec files for both versions.

@agnivade
Copy link
Contributor

Thanks @Splizard. It will be very helpful to have further details for us to debug this further.

Since it is readily reproducible for you, may I also ask you to run a git bisect and check which commit introduced this regression. I understand this is a time taking request, but if we know which commit caused this, it may give us an idea as to what went wrong.

@agnivade agnivade added arch-wasm WebAssembly issues NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Sep 19, 2019
@agnivade agnivade added this to the Go1.14 milestone Sep 19, 2019
@agnivade agnivade changed the title wasm: LinkError: "data segment does not fit in memory" cmd/compile: wasm: LinkError: "data segment does not fit in memory" Sep 19, 2019
@agnivade
Copy link
Contributor

@neelance @cherrymui

@neelance
Copy link
Member

This is most likely due to 460f9c6. Could you please check if increasing the initialSize solves the issue?

@agnivade agnivade added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Sep 21, 2019
@janpfeifer
Copy link

Same problem here (main.wasm is 33Mb size), and my project won't run on go 1.13.

Is there a flag way to change initialSize, or does one has to recompile wasm ?

@agnivade
Copy link
Contributor

agnivade commented Oct 5, 2019

You have to recompile the Go distribution with the new initialSize.

@janpfeifer
Copy link

janpfeifer commented Oct 5, 2019

Thanks Agniva.

I tried recompiling setting it to 128Mb and it still failed. When I changed it to 1 GB it got back working.

Changing initialSize to 128Mb, cleaning and then recompiling my code worked :)

@agnivade agnivade removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Oct 5, 2019
@neelance
Copy link
Member

neelance commented Oct 5, 2019

Let's try to come up with a minimal example that triggers this bug. Maybe a large global array?

@gopherbot
Copy link

Change https://golang.org/cl/199358 mentions this issue: cmd/link: produce valid binaries with large data section on wasm

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly issues FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants