Repository navigation
Commit 1f141da
committed
fix(worker): terminate() reaches a worker still inside its entry script
The worker's isolate was published to its wrapper only after the startup
function returned, i.e. after the entry script had finished evaluating, so
Terminate() found nothing to interrupt for a worker still in its entry: a
synchronous loop there ran forever, and a parked top-level await ended
only when the loader's settle deadline expired. Node and the web both
interrupt the running entry.
The isolate is now published right after the worker runtime is
initialized, before the entry runs, and the startup function honors a
terminate() that landed earlier by checking the flag before any app code.
A termination that lands inside the entry unwinds RunModule, which no
longer rethrows or reports on a terminating isolate, and the thread goes
straight to its existing teardown path. The module runner and the
exception constructor name a caught termination for what it is instead of
formatting the TryCatch, and the settle pump checks for one after its loop
too, so a termination is never reported as a timeout or as an entry
rejection.
Also documents the real resourceLimits and ios.priority Worker options in
docs/worker-threads.md, whose node:worker_threads table claimed the runtime
imposed no limits.
Suite 1735/0, also under AddressSanitizer.
Fixes #4451 parent 1c1ce8d commit 1f141da
10 files changed
Lines changed: 328 additions & 74 deletions
File tree
- NativeScript/runtime
- TestRunner/app/tests
- workerTerminate
- docs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
550 | 550 | | |
551 | 551 | | |
552 | 552 | | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
553 | 556 | | |
554 | | - | |
| 557 | + | |
555 | 558 | | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
556 | 565 | | |
557 | | - | |
558 | | - | |
| 566 | + | |
559 | 567 | | |
560 | 568 | | |
561 | 569 | | |
| |||
599 | 607 | | |
600 | 608 | | |
601 | 609 | | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | 610 | | |
608 | 611 | | |
609 | 612 | | |
| |||
622 | 625 | | |
623 | 626 | | |
624 | 627 | | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
625 | 631 | | |
626 | 632 | | |
627 | 633 | | |
| |||
650 | 656 | | |
651 | 657 | | |
652 | 658 | | |
653 | | - | |
654 | | - | |
655 | | - | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
656 | 666 | | |
657 | 667 | | |
658 | 668 | | |
| |||
682 | 692 | | |
683 | 693 | | |
684 | 694 | | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | | - | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
689 | 700 | | |
690 | 701 | | |
691 | 702 | | |
| |||
707 | 718 | | |
708 | 719 | | |
709 | 720 | | |
710 | | - | |
| 721 | + | |
711 | 722 | | |
712 | 723 | | |
713 | 724 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
296 | 301 | | |
297 | 302 | | |
298 | 303 | | |
| |||
882 | 887 | | |
883 | 888 | | |
884 | 889 | | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
885 | 894 | | |
886 | 895 | | |
887 | 896 | | |
| |||
1277 | 1286 | | |
1278 | 1287 | | |
1279 | 1288 | | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
1280 | 1296 | | |
1281 | 1297 | | |
1282 | 1298 | | |
| |||
1364 | 1380 | | |
1365 | 1381 | | |
1366 | 1382 | | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
1367 | 1410 | | |
1368 | 1411 | | |
1369 | 1412 | | |
1370 | 1413 | | |
1371 | | - | |
1372 | | - | |
1373 | | - | |
1374 | | - | |
1375 | | - | |
1376 | | - | |
1377 | | - | |
1378 | | - | |
1379 | | - | |
1380 | | - | |
1381 | | - | |
1382 | | - | |
1383 | | - | |
1384 | | - | |
1385 | | - | |
1386 | | - | |
1387 | | - | |
1388 | | - | |
1389 | | - | |
1390 | | - | |
1391 | | - | |
1392 | | - | |
| 1414 | + | |
1393 | 1415 | | |
1394 | 1416 | | |
1395 | 1417 | | |
| |||
1411 | 1433 | | |
1412 | 1434 | | |
1413 | 1435 | | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
1414 | 1441 | | |
1415 | 1442 | | |
1416 | 1443 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
88 | 97 | | |
89 | 98 | | |
90 | 99 | | |
| |||
333 | 342 | | |
334 | 343 | | |
335 | 344 | | |
336 | | - | |
| 345 | + | |
337 | 346 | | |
338 | 347 | | |
339 | 348 | | |
| |||
765 | 774 | | |
766 | 775 | | |
767 | 776 | | |
768 | | - | |
| 777 | + | |
769 | 778 | | |
770 | 779 | | |
771 | 780 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
436 | | - | |
| 436 | + | |
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
| |||
477 | 477 | | |
478 | 478 | | |
479 | 479 | | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
480 | 488 | | |
481 | 489 | | |
482 | 490 | | |
| |||
491 | 499 | | |
492 | 500 | | |
493 | 501 | | |
494 | | - | |
| 502 | + | |
495 | 503 | | |
496 | 504 | | |
497 | 505 | | |
| |||
500 | 508 | | |
501 | 509 | | |
502 | 510 | | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
507 | 519 | | |
508 | 520 | | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
513 | 527 | | |
514 | 528 | | |
515 | 529 | | |
| |||
590 | 604 | | |
591 | 605 | | |
592 | 606 | | |
593 | | - | |
594 | | - | |
595 | 607 | | |
596 | 608 | | |
597 | 609 | | |
| |||
0 commit comments