Skip to content

src: add consistency check to node_platform.cc

We use the Isolate* pointer as the sole identifier for a V8 Isolate. In some environments (e.g. multi-threaded), Isolates may be destroyed and new ones created; then, it may happen that the memory that was previously used for one Isolate can be re-used for another Isolate after the first one has been disposed of.

This check is a little guard against accidentally re-using the same per-Isolate platform data structure in such cases, i.e. making sure (to the degree to which that is possible) that the old Isolate* has been properly unregistered before one at the same memory address is added.

(It’s not 100 % foolproof because the uv_loop_t* pointer value could theoretically be the same as well.)

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

(Also, in case you were wondering, this is inspired by a 3-day debugging adventure for #20876. 😶 )

Merge request reports

Loading