Skip to content

Access Violation #28773

Closed
Closed
@jdmota

Description

@jdmota
  • Version: v12.6.0
  • Platform: Windows 64-bit
  • Subsystem:

It is possible that I'm doing something wrong, but I believe the program should not crash.

By running the following code, the program crashes (most of the time) with C0000005.ACCESS_VIOLATION.

const { Worker } = require( "worker_threads" );

const workerCode = `
const v8 = require( "v8" );
const { parentPort } = require( "worker_threads" );

function share( contents ) {
  const shared = new SharedArrayBuffer( contents.length );
  const buffer = Buffer.from( shared );
  contents.copy( buffer );
  return shared;
}

function serialize( value ) {
  return share( v8.serialize( value ) );
}

parentPort.on( "message", () => {
  parentPort.postMessage( serialize( {} ) );
} );
`;

function createWorker( id ) {
  const child = new Worker( workerCode, {
    eval: true
  } );
  child.postMessage( {} );
  child.on( "message", () => {
    child.terminate();
  } );
  child.on( "error", err => console.error( "error", id, err ) );
  child.once( "exit", () => {
    console.log( "exit", id );
  } );
}

console.log( "5 secs..." );

setTimeout( () => {
  for ( let i = 0; i < 10; i++ ) {
    createWorker( i );
  }
}, 5000 );

I've used procdump64 -e node to produce a dump file (available in the following zip file).
node.exe_190719_222025.zip

Opening the dump file in Visual Studio, shows me this:

image

Metadata

Metadata

Assignees

Labels

confirmed-bugIssues with confirmed bugs.workerIssues and PRs related to Worker support.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions