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

Add file system WASI call stubs to support wider Wasm binaries #199

Closed
mathetake opened this issue Nov 15, 2021 · 3 comments · Fixed by #201
Closed

Add file system WASI call stubs to support wider Wasm binaries #199

mathetake opened this issue Nov 15, 2021 · 3 comments · Fixed by #201

Comments

@mathetake
Copy link
Contributor

mathetake commented Nov 15, 2021

Some of TinyGo app have started emitting binaries with file system related WASI system calls:

envoy_1  | [2021-11-15 08:13:45.970][1][error][wasm] [source/extensions/common/wasm/wasm_vm.cc:38] Failed to load Wasm module due to a missing import: wasi_snapshot_preview1.path_open
envoy_1  | [2021-11-15 08:13:45.970][1][error][wasm] [source/extensions/common/wasm/wasm_vm.cc:38] Failed to load Wasm module due to a missing import: wasi_snapshot_preview1.fd_prestat_get
envoy_1  | [2021-11-15 08:13:45.970][1][error][wasm] [source/extensions/common/wasm/wasm_vm.cc:38] Failed to load Wasm module due to a missing import: wasi_snapshot_preview1.fd_prestat_dir_name

So it would be helpful if we could add stubs for it even though we cannot actually support them. Relevant to #127

@mathetake mathetake changed the title Add file system WASI call stabs to support wider Wasm binaries Add file system WASI call stubs to support wider Wasm binaries Nov 15, 2021
@PiotrSikora
Copy link
Member

Do you have an example for when those imports are generated? I've built all examples from Proxy-Wasm Go SDK using TinyGo v0.20.0 and the development version, but none of them try to list preopened files.

We need to add those functions for #127, so stubs are fine in the meantime, but I'm wondering if there is a bug in TinyGo that results in unnecessary imports.

@mathetake
Copy link
Contributor Author

mathetake commented Nov 16, 2021

@PiotrSikora yeah here's the example:

package main

import "time"

func main() {
	println(time.Now().Second())
}

This would expects these exports in the hosts. I think this stems from the usage of local time zone info (which in tern uses sync package) on time.Time type in the time package. I verified #201 allows apps to use time.Now().Second() or similar in extensions (with UTC timezone).

@mathetake
Copy link
Contributor Author

sorry so maybe the description was wrong -- this issue has existed in the first place and users haven't been able to (heavily used) time.Time struct.

PiotrSikora pushed a commit that referenced this issue Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants