workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

🐛 BUG: Received structured exception #0xc0000005: access violation;

Open asasinmode opened this issue 1 year ago • 3 comments

Which Cloudflare product(s) does this pertain to?

Miniflare

What version(s) of the tool(s) are you using?

3.20240620.0 [Miniflare]

What version of Node are you using?

22.3.0

What operating system and version are you using?

Windows 11 10.0.22631

Describe the Bug

Observed behavior

Starting dev server errors with (full logs attached with some additional console logs)

 ERROR  *** Received structured exception #0xc0000005: access violation; stack: 7ffe71872f57 7ff7834b643b 7ff7834b6503 7ff7834a588c 7ff7834a5837 7ff782ce9c1e 7ff782ce9f2f 7ff781bd1ad6 7ff781bd18ba 7ff782e6b6ef 7ff782e728a6 7ff782e6bc0c 7ff782e728a6 7ff782e6957c 7ff781bc1551 7ff7845a0f7f 7ffeb2a3257c 7ffeb3a4af27

 ERROR  Failed to initialize wrangler bindings proxy The Workers runtime failed to start. There is likely additional logging output above.

Then nothing else happens, http://localhost:3000 shows nuxt login page and I stop the process

Expected behavior

No error

Steps to reproduce

  1. Initialize a Nuxt Hub project with pnpx nuxthub init tmp
  2. Go the the created project cd tmp
  3. Start the dev server pnpm dev

This is my first encounter with cloudflare ecosystem and it's through the Nuxt Hub project. Sorry but I don't know how to use cloudflare tools outside of it.

The wrangler.toml is generated inside .data/hub/wrangler.toml

[[r2_buckets]]
binding = "BLOB"
bucket_name = "default"

[[kv_namespaces]]
binding = "KV"
id = "kv_default"

[[d1_databases]]
binding = "DB"
database_name = "default"
database_id = "default"

I don't know of any worker code.

I'm guessing it's not reproducible to be honest. Initially I created a Nuxt Hub project in the same way and was working on it with no issues, everything worked fine. At some point in development however I was running into errors and while trying to resolve them I wanted to clean start my project and deleted various directories like .nuxt, .data and I think inside of a project there was a .wrangler directory that seemed to have one or 2 empty subdirectories. Additionally I deleted local pnpm store and I think anything related I could find in %localappdata% and %tmp% to clear cache in case that was causing the errors I was experiencing (nothing cloudflare related, just some type errors in packages). It fixed the errors I was experiencing but I think from then on running pnpm dev showed that error and now it happens in all fresh Nuxt Hub projects.

I'd appreciate guidance on how to deal with it. Tried my best to add logs to find out what's going on, here are the changes I made to node_modules\.pnpm\[email protected]\node_modules\miniflare\dist\src\index.js. Don't know how to access source files, hope they context is enough to identify them. In the logs you can see console.log("ch2", maybeSocketPorts); is never reached

// #assembleAndUpdateConfig method
    const loopbackAddress = `${maybeGetLocallyAccessibleHost(configuredHost) ?? getURLSafeHost(configuredHost)}:${loopbackPort}`;
    const runtimeOpts = {
      signal: this.#disposeController.signal,
      entryAddress,
      loopbackAddress,
      requiredSockets,
      inspectorAddress,
      verbose: this.#sharedOpts.core.verbose,
      handleRuntimeStdio: this.#sharedOpts.core.handleRuntimeStdio
    };
    console.log("ch0 running #runtime.updateConfig");  // HERE
    const maybeSocketPorts = await this.#runtime.updateConfig(
      configBuffer,
      runtimeOpts
    );
    console.log("ch1", maybeSocketPorts, { aborted: this.#disposeController.signal.aborted, isVoid0: maybeSocketPorts === void 0 });  // HERE
    if (this.#disposeController.signal.aborted)
      return;
    if (maybeSocketPorts === void 0) {
      throw new MiniflareCoreError(
        "ERR_RUNTIME_FAILURE",
        "The Workers runtime failed to start. There is likely additional logging output above."
      );
    }
    console.log("ch2", maybeSocketPorts);  // HERE, doesn't run
    this.#socketPorts = maybeSocketPorts;

// waitForPorts function
  try {
    console.log('waitForPorts try', lines);  // HERE
    for await (const line of lines) {
      console.log('waitForPorts trying', line);  // HERE, doesn't run
      const message = ControlMessageSchema.safeParse(JSON.parse(line));

// updateConfig method
    runtimeProcess.stdin.write(configBuffer);
    runtimeProcess.stdin.end();
    await (0, import_events2.once)(runtimeProcess.stdin, "finish");
    console.log('updateConfig return');  // HERE
    return waitForPorts(controlPipe, options);

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

> nuxthub-starter@ dev D:\Projects\tmp
> nuxt dev

Nuxt 3.12.2 with Nitro 2.9.7                                                                                                                        12:19:43
                                                                                                                                                    12:19:43
  ➜ Local:    http://localhost:3000/
  ➜ Network:  use --host to expose

ℹ Using local storage from .data/hub                                                                                                      nuxt:hub 12:19:45
  ➜ DevTools: press Shift + Alt + D in the browser (v1.3.7)                                                                                         12:19:45

ℹ Running with compatibility version 4                                                                                                             12:19:45
ℹ Vite client warmed up in 971ms                                                                                                                   12:19:47
ℹ Vite server warmed up in 1081ms                                                                                                                  12:19:47
✔ Nuxt Nitro server built in 828 ms                                                                                                          nitro 12:19:48
ch0 running #runtime.updateConfig
updateConfig return
waitForPorts try Interface {
  isCompletionEnabled: true,
  escapeCodeTimeout: 500,
  tabSize: 8,
  _events:
   [Object: null prototype] {
     close:
      { [Function: bound onceWrapper] listener: [Function: onSelfCloseWithoutTerminal] } },
  _eventsCount: 1,
  _maxListeners: undefined,
  line: '',
  output: undefined,
  input:
   <ref *1> Socket {
     connecting: false,
     _hadError: false,
     _parent: null,
     _host: null,
     _closeAfterHandlingError: false,
     _events:
      { close: [Function (anonymous)],
        error: [Function: onerror],
        prefinish: undefined,
        finish: undefined,
        drain: undefined,
        data: [Function: ondata],
        end: [Array],
        readable: undefined },
     _readableState:
      ReadableState {
        highWaterMark: 16384,
        buffer: [],
        bufferIndex: 0,
        length: 0,
        pipes: [],
        awaitDrainWriters: null,
        [Symbol(kState)]: 194062596 },
     _writableState:
      WritableState {
        highWaterMark: 16384,
        length: 0,
        corked: 0,
        onwrite: [Function: bound onwrite],
        writelen: 0,
        bufferedIndex: 0,
        pendingcb: 0,
        [Symbol(kState)]: 17564420,
        [Symbol(kBufferedValue)]: null },
     allowHalfOpen: false,
     _maxListeners: undefined,
     _eventsCount: 4,
     _sockname: null,
     _pendingData: null,
     _pendingEncoding: '',
     server: null,
     _server: null,
     [Symbol(async_id_symbol)]: 644,
     [Symbol(kHandle)]:
      Pipe {
        reading: true,
        [Symbol(kResourceStore)]: undefined,
        [Symbol(owner_symbol)]: [Circular *1] },
     [Symbol(lastWriteQueueSize)]: 0,
     [Symbol(timeout)]: null,
     [Symbol(kBuffer)]: null,
     [Symbol(kBufferCb)]: null,
     [Symbol(kBufferGen)]: null,
     [Symbol(shapeMode)]: true,
     [Symbol(kCapture)]: false,
     [Symbol(kSetNoDelay)]: false,
     [Symbol(kSetKeepAlive)]: false,
     [Symbol(kSetKeepAliveInitialDelay)]: 0,
     [Symbol(kBytesRead)]: 0,
     [Symbol(kBytesWritten)]: 0 },
  history: [],
  historySize: 30,
  removeHistoryDuplicates: false,
  crlfDelay: 100,
  completer: undefined,
  terminal: false,
  [Symbol(_sawReturnAt)]: 0,
  [Symbol(_sawKeyPress)]: false,
  [Symbol(_previousKey)]: null,
  [Symbol(shapeMode)]: false,
  [Symbol(kCapture)]: false,
  [Symbol(kSubstringSearch)]: null,
  [Symbol(_undoStack)]: [],
  [Symbol(_redoStack)]: [],
  [Symbol(_killRing)]: [],
  [Symbol(_killRingCursor)]: 0,
  [Symbol(_prompt)]: '> ',
  [Symbol(line object stream)]: undefined,
  [Symbol(_decoder)]:
   StringDecoder { encoding: 'utf8', [Symbol(kNativeDecoder)]: <Buffer 00 00 00 00 00 00 01> } }

 ERROR  *** Received structured exception #0xc0000005: access violation; stack: 7ffe71872f57 7ff7834b643b 7ff7834b6503 7ff7834a588c 7ff7834a5837 7ff782ce9c1e 7ff782ce9f2f 7ff781bd1ad6 7ff781bd18ba 7ff782e6b6ef 7ff782e728a6 7ff782e6bc0c 7ff782e728a6 7ff782e6957c 7ff781bc1551 7ff7845a0f7f 7ffeb2a3257c 7ffeb3a4af27

ch1 undefined { aborted: false, isVoid0: true }

 ERROR  Failed to initialize wrangler bindings proxy The Workers runtime failed to start. There is likely additional logging output above.

  at Miniflare2.#assembleAndUpdateConfig (node_modules\.pnpm\[email protected]\node_modules\miniflare\src\index.ts:1352:8)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at Mutex.runWith (node_modules\.pnpm\[email protected]\node_modules\miniflare\src\workers\shared\sync.ts:66:45)
  at Miniflare2.#waitForReady (node_modules\.pnpm\[email protected]\node_modules\miniflare\src\index.ts:1443:3)
  at Miniflare2._getProxyClient (node_modules\.pnpm\[email protected]\node_modules\miniflare\src\index.ts:1638:4)
  at Miniflare2.getBindings (node_modules\.pnpm\[email protected]\node_modules\miniflare\src\index.ts:1666:22)
  at getPlatformProxy (node_modules\.pnpm\[email protected]_@[email protected]\node_modules\wrangler\src\api\integrations\platform\index.ts:117:24)
  at _getPlatformProxy (node_modules\.pnpm\[email protected]\node_modules\nitro-cloudflare-dev\dist\runtime\plugin.dev.mjs:41:17)
  at <anonymous> (node_modules\.pnpm\@[email protected][email protected][email protected][email protected][email protected]_@[email protected][email protected]_\node_modules\@nuxthub\core\dist\runtime\ready.dev.js:4:3)

asasinmode avatar Jun 29 '24 10:06 asasinmode