Skip to content

OPFS breaks with -pthread -sPROXY_TO_PTHREAD -sJSPI #27620

Description

@paradust7

Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 6.0.8 (aeb6792)
clang version 24.0.0git (https:/github.com/llvm/llvm-project 4bfd08c2d769736841ae4f5705d76fa6daa39027)
Target: wasm32-unknown-emscripten
Thread model: posix

Minimal reproducer

#include <emscripten/wasmfs.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

int main(void) {
  printf("creating OPFS backend\n");
  backend_t opfs = wasmfs_create_opfs_backend();
  if (!opfs) {
    printf("FAIL: no OPFS backend\n");
    return 1;
  }
  printf("mounting /opfs ...\n");
  if (wasmfs_create_directory("/opfs", 0777, opfs) != 0) {
    printf("FAIL: could not mount /opfs\n");
    return 1;
  }
  printf("PASS\n");
  return 0;
}

Build with
emcc minimal.c -o minimal.html -sWASMFS -pthread -sPROXY_TO_PTHREAD -sJSPI

Run with
emrun --browser chrome minimal.html

Expected
It should print PASS.

What actually happens
Javascript error in the console:

Uncaught (in promise) SuspendError: trying to suspend without WebAssembly.promising

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions