Skip to content

Commit 644b744

Browse files
committed
fix: reduce _waitForActiveHandles poll from 10ms to 100ms, add extensive IPC tracing. PI loads but main() stuck.
1 parent b8a7c29 commit 644b744

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

native/v8-runtime/src/host_call.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ impl BridgeCallContext {
204204
/// blocks on read() for the BridgeResponse, and returns the result.
205205
/// Error responses from the host are returned as Err.
206206
pub fn sync_call(&self, method: &str, args: Vec<u8>) -> Result<Option<Vec<u8>>, String> {
207+
eprintln!("[v8-ipc] sync_call: {} session={}", method, self.session_id);
207208
let call_id = self.next_call_id.fetch_add(1, Ordering::Relaxed);
208209

209210
// Register call_id in pending set (reject duplicates)

packages/nodejs/src/bridge-handlers.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3281,8 +3281,13 @@ export function buildModuleLoadingBridgeHandlers(
32813281
// The V8 runtime binary only registers a fixed set of bridge globals.
32823282
// Newer handlers (crypto, net sockets, etc.) are dispatched through
32833283
// _loadPolyfill with a "__bd:" prefix.
3284+
let _loadPolyfillCount = 0;
32843285
handlers[K.loadPolyfill] = async (moduleName: unknown): Promise<string | null> => {
32853286
const nameStr = String(moduleName);
3287+
_loadPolyfillCount++;
3288+
if (_loadPolyfillCount <= 20 || _loadPolyfillCount % 500 === 0) {
3289+
console.error(`[loadPolyfill] #${_loadPolyfillCount}: ${nameStr.slice(0, 80)}`);
3290+
}
32863291

32873292
// Bridge dispatch: "__bd:methodName:base64args"
32883293
if (nameStr.startsWith("__bd:") && dispatchHandlers) {

packages/nodejs/src/bridge/active-handles.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ export function _waitForActiveHandles(): Promise<void> {
118118
complete();
119119
return;
120120
}
121-
setTimeout(poll, 10);
121+
setTimeout(poll, 100);
122122
};
123-
setTimeout(poll, 10);
123+
setTimeout(poll, 100);
124124
}),
125125
);
126126
}

0 commit comments

Comments
 (0)