LearnNewsExamplesServices
Frontmatter
id8055
titleEnable silent VNode creation to avoid Worker Manager deadlocks
stateClosed
labels
enhancementairefactoring
assigneestobiu
createdAtDec 8, 2025, 6:54 AM
updatedAtDec 8, 2025, 6:55 AM
githubUrlhttps://github.com/neomjs/neo/issues/8055
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtDec 8, 2025, 6:55 AM

Enable silent VNode creation to avoid Worker Manager deadlocks

Closed v11.17.0 enhancementairefactoring
tobiu
tobiu commented on Dec 8, 2025, 6:54 AM

Objective

Enable a "silent" VNode creation mode where the VDOM worker can create VNodes without calculating deltas or triggering autoMount/updateVdom events.

Problem

In the current Neo.worker.Manager implementation, onWorkerMessage unconditionally calls promiseForwardMessage if data.data exists. This pauses execution until resolveDomOperationPromise is called. However, resolveDomOperationPromise is typically triggered by automount or updateVdom event listeners. If neither autoMount nor updateVdom is true (as in the manual/silent VNode creation case), no event is fired, the promise is never resolved, and the message forwarding hangs indefinitely (deadlock).

Solution

Modify src/worker/Manager.mjs inside onWorkerMessage to conditionally use promiseForwardMessage. It should only be used if autoMount or updateVdom is true, indicating a DOM operation that needs to be waited on. Otherwise, the message should be forwarded immediately.

Implementation Details

if (!promise) {
    if (data.data) {
        if (data.data.autoMount || data.data.updateVdom) {
            data.data.autoMount  && me.fire('automount',  data);
            data.data.updateVdom && me.fire('updateVdom', data);

            // We want to delay the message until the rendering queue has processed it
            // See: https://github.com/neomjs/neo/issues/2864
            me.promiseForwardMessage(data).then(msgData => {
                me.sendMessage(msgData.destination, msgData)
            })
        } else {
            me.sendMessage(dest, data)
        }
    }
}

This logic has already been verified in src/worker/Manager.mjs. This ticket tracks the formal acceptance and documentation of this capability.

tobiu added the enhancement label on Dec 8, 2025, 6:54 AM
tobiu added the ai label on Dec 8, 2025, 6:54 AM
tobiu added the refactoring label on Dec 8, 2025, 6:54 AM
tobiu assigned to @tobiu on Dec 8, 2025, 6:54 AM
tobiu referenced in commit 28c859d - "Enable silent VNode creation to avoid Worker Manager deadlocks #8055" on Dec 8, 2025, 6:54 AM
tobiu closed this issue on Dec 8, 2025, 6:55 AM