-
Notifications
You must be signed in to change notification settings - Fork 18
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
Investigate fd-lock
failure for spidermonkey-wasm
#36
Comments
Giving the logs a quick look, I see this:
Does the unsupported backend even compile? Also, looks like they are getting errors since they are compiling for wasi, which to my knowledge doesn't have advisory locks? Also, the unsupported backend seems to assume that it's on a unix platform and uses Additionally, that crate did not even have I think the only problem with |
I wrote a possible fix for this issue, but I had a hard time rationalizing the panic-based solution instead of a compile-time error. Basically, locking can be applied to any type that can provide a file handle. However, on platforms that are unsupported, we cannot know what is means to provide a file handle, yet the file type still exists. As a result, platforms that cannot do locking still provide a file type, yet the Two possible solutions to this that I can see would be to remove the It seems impossible to ensure that we can always compile on unsupported platforms so long as locking is based on the If making a best-effort to compile is preferred, would it be fine to convert the panics to errors in the unsupported backend? That seems to be what the standard library does for |
Yeah, I'm inclined to say we should follow the lead of the stdlib - even if it's not ideal. Ideally file locking would be exposed by WASI itself, but I suspect that may not happen anytime soon as there are other more important primitives missing still. I'm not really sure tbh; do you have a preference? |
I would prefer returning an error instead of panicking if following the stdlib closely is a necessity. If it is not, I would prefer to get a compile error since in a lot of cases, there isn't a graceful way to handle an absence of locks. I was planning on introducing another PR to add this as a feature, like described in #18. I'm currently trying to approach this by treating unsupported platforms as a form of black box; while wasi file locks are not implemented currently (and they could get implemented in the future), some platforms will likely never get file locks like However, I think the main issue here is that it is impossible to mimic std in this case. Ideally, we would define our own I think for the current major version, compiling on an unsupported platform should be a compile error so that users can at least get a nice message that they are compiling on an unsupported platform. This is non-breaking as this crate will not compile on unsupported platforms currently. In the next major version, if compiling on unsupported platforms is necessary, a crate-defined Basically, I was wondering if it would be fine to convert this crate to emit user-friendly compile errors on unsupported platforms until the next breaking version, where the API could be updated so that it is possible to always compile on unsupported platforms? Or if getting at least locks for the |
@sunfishcode pinged me yesterday, and told me it's likely WASI will soon have support for file locking APIs. It will likely be implemented using the
In general I'm also in favor of generating a compile-time error. The only reason not to would have been specifically for WASM, where std compiles but returns a run-time error. Given we should be able to address that now through the WASI file locking interface, I think for the remainder of platforms we should just continue to return compile errors? If you know of a better way to create errors for those platforms, def go for it! |
bytecodealliance/spidermonkey-wasm-rs#40 (comment) reported a failure of the
fd-lock
crate, requiring a dependency to be pinned to an earlier version.Quote:
The text was updated successfully, but these errors were encountered: