Commit 9b88343
committed
fix(plugin): fire the end hook on every exit
The invocation wrapper fired on_invocation_end on the success path and on
except Exception, so an exit by BaseException skipped it. A handler that
surfaces an asyncio.CancelledError -- user code awaiting a cancelled task
-- leaves that way, and so does a KeyboardInterrupt or SystemExit. The
invocation then ended without the one hook a plugin has to finish on:
Insight never drained, so the records it held for that execution were
dropped, and OTel never ended the spans it had opened. Teardown still ran,
so nothing failed visibly.
Every exit now fires the hook and re-raises the exception unchanged.
Plugin-code containment widens with it. The factory and hook boundaries
caught Exception, so a factory or hook raising CancelledError failed an
execution it was only observing and stopped the remaining plugins from
running. Both now contain every BaseException except KeyboardInterrupt,
SystemExit and GeneratorExit, which are instructions to the calling thread
rather than reports of a plugin defect. CancelledError is not among them:
nothing cancels the invocation thread or the single-worker plugin pool, so
one arriving from plugin code came from the plugin's own asyncio use.
ErrorObject.from_exception is annotated BaseException, which is what its
own helper already accepted.1 parent 5d874f1 commit 9b88343
3 files changed
Lines changed: 179 additions & 5 deletions
File tree
- packages/aws-durable-execution-sdk-python
- src/aws_durable_execution_sdk_python
- tests
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
| 238 | + | |
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
| |||
Lines changed: 55 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
530 | 530 | | |
531 | 531 | | |
532 | 532 | | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
533 | 548 | | |
534 | 549 | | |
535 | 550 | | |
| |||
611 | 626 | | |
612 | 627 | | |
613 | 628 | | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
614 | 636 | | |
615 | 637 | | |
616 | 638 | | |
617 | 639 | | |
618 | 640 | | |
619 | | - | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
620 | 644 | | |
621 | 645 | | |
622 | 646 | | |
| |||
647 | 671 | | |
648 | 672 | | |
649 | 673 | | |
650 | | - | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
651 | 682 | | |
652 | 683 | | |
653 | 684 | | |
| |||
666 | 697 | | |
667 | 698 | | |
668 | 699 | | |
669 | | - | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
670 | 703 | | |
671 | 704 | | |
672 | 705 | | |
| |||
1068 | 1101 | | |
1069 | 1102 | | |
1070 | 1103 | | |
1071 | | - | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
1072 | 1123 | | |
1073 | 1124 | | |
1074 | 1125 | | |
| |||
Lines changed: 123 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
646 | 647 | | |
647 | 648 | | |
648 | 649 | | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
649 | 685 | | |
650 | 686 | | |
651 | 687 | | |
| |||
891 | 927 | | |
892 | 928 | | |
893 | 929 | | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
894 | 993 | | |
895 | 994 | | |
896 | 995 | | |
| |||
2171 | 2270 | | |
2172 | 2271 | | |
2173 | 2272 | | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
2174 | 2297 | | |
2175 | 2298 | | |
2176 | 2299 | | |
| |||
0 commit comments