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

πŸ› Bug Report β€” V8 fatal error when debugging #3248

Open
brettwillis opened this issue Dec 16, 2024 · 2 comments
Open

πŸ› Bug Report β€” V8 fatal error when debugging #3248

brettwillis opened this issue Dec 16, 2024 · 2 comments

Comments

@brettwillis
Copy link

brettwillis commented Dec 16, 2024

When developing a worker locally, I've started encountering fatal errors that happen only when a debugger is attached. There are certain points in the JS code where the debugger cannot step over without triggering the fatal error. When the debugger is not attached, execution proceeds fine.

Wrangler version 3.95.0

The worker responds with:

503
Your worker restarted mid-request. Please try sending the request again. Only GET or HEAD requests are retried automatically.

And the following in the logs (no stack trace):

✘ [ERROR] workerd/jsg/setup.c++:38: fatal: V8 fatal error; location = :0; message = Check failed: needs_context && current_scope_ == closure_scope_ && current_scope_->is_function_scope() && !function_.is_null() implies function_->context() != *context_.

  *** Received signal #6: Abort trap: 6
  stack:



Can you tell me what other information you need?

@ayoubqrt
Copy link

ayoubqrt commented Jan 22, 2025

I have the same problem with wrangler 3.102.0, I think it's a regression I didn't had such a problem with wrangler 3.65.1

To give more context, I'm on MacOS 15.2 and if I understand good, the problem seems to appear when there is a breakpoint in a for of loop (for const var in var2)

@anywhichway
Copy link

anywhichway commented Feb 7, 2025

Dito, Windows11, wrangler 3.107.3

I was trying to iterate over an empty array, this fixed the problem initially:

if(entries.length>0) {
            for (const [partnerId, partner] of entries) { ... }
}

However, as soon as the array has a length the error reappears even for

if(entries.length>0) {
            for (const [partnerId, partner] of entries) { true; }
}

I also tried using a key iterator approach rather than producting an entries array. Same issue. There seems to be something wrong with nested obects create with JSON.parse.

Worse, the error is completely silent when not debugging, i.e. I just get empty object back becuase the worker crashes without completely shutting down..

Finally I even tried this directly

for(const key in {}) { ... }

It crashes!

tried rolling back to 3.94.0 .. same issue

I suppose the good news is, I was able to debig my code without the debugger, so at least my app works.

Below is the error:

workerd/jsg/setup.c++:38: fatal: V8 fatal error; location = :0; message = Check failed: needs_context && current_scope_ == closure_scope_ && current_scope_->is_function_scope() && !function_.is_null() implies function_->context() != *context_.

In case it is on any assistaance this is the JSON object retrieved by the first fetch:

{
    "id": "1s4z50r25n1b",
    "username": null,
    "primaryEmail": "[email protected]",
    "primaryPhone": null,
    "name": "[email protected]",
    "avatar": null,
    "customData": {
        "ui": {
            "mesh": {
                "selected": {
                    "1s4z50r25n1b": true
                }
            }
        },
        "peering": {
            "id": "7dd94251-a4b9-4e7e-8a83-fcd56bbbd199"
        },
        "partners": {},
        "dimensions": {
            "Connected": {
                "history": [],
                "tracking": true,
                "shareWith": {
                    "9w18f0mdnj2p": false
                }
            },
            "Happiness": {
                "history": [],
                "tracking": true,
                "shareWith": {
                    "9w18f0mdnj2p": true
                }
            }
        },
        "preferredAI": "Emy"
    },
    "identities": {},
    "lastSignInAt": 1738887115593,
    "createdAt": 1738887115668,
    "updatedAt": 1738895929447,
    "profile": {},
    "applicationId": "aldy8egk5tx057egl3x8f",
    "isSuspended": false,
    "hasPassword": true
}

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

No branches or pull requests

3 participants