Commit 87b2cd8
Ben Hillis
Fix port relay IOCP: inherit exit event handle, fix pipe leak, harden AcceptThread
- Add InheritHandle() for m_vmTerminatingEvent so the relay child process
receives a valid exit event handle via PROC_THREAD_ATTRIBUTE_HANDLE_LIST.
- Close parent pipe handles with .reset() instead of .release() so ReadFile
in MapRelayPort detects relay process death via pipe EOF.
- Move AcceptThread I/O drain into wil::scope_exit so pending accepts are
always cancelled even if ScheduleAccept throws during initialization.
- Wrap initial ScheduleAccept loop in try/catch to prevent a single port
failure from killing the entire accept thread.
- Track accept thread liveness with std::atomic<bool> to avoid posting
stale IOCP exit signals when the thread has already exited.
- Make PortRelay destructor cancel pending I/O instead of __fastfail.
- Add <atomic> to precomp.h.1 parent 6d69708 commit 87b2cd8
File tree
3 files changed
+64
-33
lines changed- src/windows
- common
- wslcsession
- wslrelay
3 files changed
+64
-33
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
838 | 838 | | |
839 | 839 | | |
840 | 840 | | |
| 841 | + | |
841 | 842 | | |
842 | 843 | | |
843 | | - | |
844 | | - | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
845 | 848 | | |
846 | 849 | | |
847 | 850 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
350 | | - | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
351 | 355 | | |
352 | 356 | | |
353 | 357 | | |
| |||
406 | 410 | | |
407 | 411 | | |
408 | 412 | | |
409 | | - | |
| 413 | + | |
410 | 414 | | |
411 | 415 | | |
412 | 416 | | |
| |||
460 | 464 | | |
461 | 465 | | |
462 | 466 | | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
463 | 493 | | |
464 | 494 | | |
465 | 495 | | |
466 | 496 | | |
467 | 497 | | |
468 | | - | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
469 | 503 | | |
470 | 504 | | |
471 | 505 | | |
| |||
512 | 546 | | |
513 | 547 | | |
514 | 548 | | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | 549 | | |
539 | 550 | | |
540 | 551 | | |
541 | 552 | | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
546 | 558 | | |
547 | 559 | | |
548 | 560 | | |
| |||
614 | 626 | | |
615 | 627 | | |
616 | 628 | | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
617 | 634 | | |
618 | 635 | | |
619 | 636 | | |
| |||
624 | 641 | | |
625 | 642 | | |
626 | 643 | | |
| 644 | + | |
627 | 645 | | |
628 | 646 | | |
629 | 647 | | |
630 | 648 | | |
631 | | - | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
632 | 657 | | |
633 | 658 | | |
634 | 659 | | |
| |||
720 | 745 | | |
721 | 746 | | |
722 | 747 | | |
| 748 | + | |
723 | 749 | | |
| 750 | + | |
724 | 751 | | |
725 | 752 | | |
726 | 753 | | |
| |||
0 commit comments