Commit a57712f
IDEA-352355 Asynchronous stack traces for flows in the IDEA debugger
Patched during cherry-pick to 1.10.1. File with conflicts: BufferedChannel.kt
Squashed commits as of version 1.8.0-intellij-11
Don't make unnecessary NULL unboxings
(cherry picked from commit 0267812)
Don't wrap suspend function
(cherry picked from commit 8684cad)
Get rid of changes in the public API -- bring back CoroutineChannel support
(cherry picked from commit 9836a6b)
Get rid of changes in the public API
(cherry picked from commit f852554)
Support SelectImplementation
This brings support for select-based flow operators, such as `timeout`.
(cherry picked from commit db906d8)
Support BufferedChannel
Before, `buffer` operations and such were only supported partially, and in some cases async stack traces were working only in 50% collects. For example, when several flows are merged with `flattenMerge` and emit values simultaneously.
This change seems large, changing a lot of lines in BufferedChannel.kt, but most of them are effectively refactoring (propagation of a wrapped value).
(cherry picked from commit 8be4def)
Discard strict double-wrapping check
We decided not to go with it, as it may dump a lot of error messages to a clueless user's console.
(cherry picked from commit 0efa558)
Enhance support for async stack traces in flows
* simplify instrumentation by making a single insertion point source instead of having one in every class
* handle a double-wrapping case which leads to errors; allow agent to choose how to handle it
* support more commonly used operators (such as `scan`, `buffer`, `debounce` with dynamic timeout)
Unfortunately, this change doesn't cover all possible scenarios of using flows, as many of them interoperate with `Channel`s, and it should be addressed separately.
(cherry picked from commit 00cb4e5)
Prepare shared flows for the debugger agent to support async stack traces
The agent needs three entities to establish a proper asynchronous stack traces connection:
- a capture point -- method that indicates the stack trace that precedes the current stack trace;
- an insertion point -- method within the current stack trace;
- a key -- an object that is present in both points and is unique enough to bridge two points properly.
This change tweaks the code a bit to introduce the three entities in MutableSharedFlow and MutableStateFlow.
The key for MutableSharedFlow is the element itself. For MutableSharedFlow, the element is wrapped into a unique object to prevent bridging mistakes when two equal elements are emitted from different places.
(cherry picked from commit 75107bc)
# Conflicts:
# kotlinx-coroutines-core/common/src/channels/BufferedChannel.kt
# Conflicts:
# IntelliJ-patches.md
(cherry picked from commit ebfcd9b)1 parent fc24ed2 commit a57712f
File tree
10 files changed
+194
-52
lines changed- kotlinx-coroutines-core/common/src
- channels
- flow
- internal
- operators
- selects
10 files changed
+194
-52
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
Lines changed: 38 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
684 | 686 | | |
685 | 687 | | |
686 | 688 | | |
687 | | - | |
| 689 | + | |
688 | 690 | | |
689 | 691 | | |
690 | 692 | | |
| |||
693 | 695 | | |
694 | 696 | | |
695 | 697 | | |
696 | | - | |
| 698 | + | |
697 | 699 | | |
698 | 700 | | |
699 | 701 | | |
| |||
726 | 728 | | |
727 | 729 | | |
728 | 730 | | |
729 | | - | |
| 731 | + | |
730 | 732 | | |
731 | 733 | | |
732 | 734 | | |
| |||
752 | 754 | | |
753 | 755 | | |
754 | 756 | | |
755 | | - | |
| 757 | + | |
756 | 758 | | |
757 | 759 | | |
758 | 760 | | |
| |||
769 | 771 | | |
770 | 772 | | |
771 | 773 | | |
772 | | - | |
| 774 | + | |
| 775 | + | |
773 | 776 | | |
774 | 777 | | |
775 | 778 | | |
| |||
802 | 805 | | |
803 | 806 | | |
804 | 807 | | |
805 | | - | |
| 808 | + | |
806 | 809 | | |
807 | 810 | | |
808 | 811 | | |
| |||
866 | 869 | | |
867 | 870 | | |
868 | 871 | | |
869 | | - | |
| 872 | + | |
870 | 873 | | |
871 | 874 | | |
872 | 875 | | |
| |||
884 | 887 | | |
885 | 888 | | |
886 | 889 | | |
887 | | - | |
| 890 | + | |
888 | 891 | | |
889 | 892 | | |
890 | 893 | | |
| |||
954 | 957 | | |
955 | 958 | | |
956 | 959 | | |
957 | | - | |
| 960 | + | |
958 | 961 | | |
959 | 962 | | |
960 | 963 | | |
| |||
972 | 975 | | |
973 | 976 | | |
974 | 977 | | |
975 | | - | |
| 978 | + | |
976 | 979 | | |
977 | 980 | | |
978 | 981 | | |
| |||
1561 | 1564 | | |
1562 | 1565 | | |
1563 | 1566 | | |
1564 | | - | |
| 1567 | + | |
1565 | 1568 | | |
1566 | 1569 | | |
1567 | 1570 | | |
| |||
1572 | 1575 | | |
1573 | 1576 | | |
1574 | 1577 | | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
1575 | 1585 | | |
1576 | 1586 | | |
1577 | 1587 | | |
| |||
1666 | 1676 | | |
1667 | 1677 | | |
1668 | 1678 | | |
1669 | | - | |
| 1679 | + | |
1670 | 1680 | | |
1671 | 1681 | | |
1672 | 1682 | | |
| |||
1694 | 1704 | | |
1695 | 1705 | | |
1696 | 1706 | | |
1697 | | - | |
1698 | 1707 | | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
1699 | 1718 | | |
1700 | 1719 | | |
1701 | 1720 | | |
| |||
1712 | 1731 | | |
1713 | 1732 | | |
1714 | 1733 | | |
1715 | | - | |
| 1734 | + | |
1716 | 1735 | | |
1717 | 1736 | | |
1718 | 1737 | | |
| |||
2815 | 2834 | | |
2816 | 2835 | | |
2817 | 2836 | | |
2818 | | - | |
| 2837 | + | |
2819 | 2838 | | |
2820 | | - | |
| 2839 | + | |
| 2840 | + | |
2821 | 2841 | | |
2822 | 2842 | | |
2823 | | - | |
| 2843 | + | |
2824 | 2844 | | |
2825 | 2845 | | |
2826 | 2846 | | |
2827 | | - | |
| 2847 | + | |
2828 | 2848 | | |
2829 | 2849 | | |
2830 | 2850 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
38 | 44 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | | - | |
| 32 | + | |
35 | 33 | | |
36 | 34 | | |
37 | 35 | | |
| |||
40 | 38 | | |
41 | 39 | | |
42 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
43 | 57 | | |
44 | 58 | | |
45 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
372 | | - | |
| 372 | + | |
373 | 373 | | |
374 | 374 | | |
375 | 375 | | |
| |||
378 | 378 | | |
379 | 379 | | |
380 | 380 | | |
381 | | - | |
| 381 | + | |
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
| |||
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
397 | | - | |
| 397 | + | |
398 | 398 | | |
399 | 399 | | |
400 | 400 | | |
| |||
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
477 | | - | |
478 | 477 | | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
479 | 487 | | |
480 | 488 | | |
481 | 489 | | |
| |||
505 | 513 | | |
506 | 514 | | |
507 | 515 | | |
508 | | - | |
509 | | - | |
| 516 | + | |
| 517 | + | |
510 | 518 | | |
511 | 519 | | |
512 | 520 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
333 | | - | |
| 333 | + | |
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
369 | 374 | | |
370 | 375 | | |
371 | 376 | | |
| |||
398 | 403 | | |
399 | 404 | | |
400 | 405 | | |
401 | | - | |
| 406 | + | |
402 | 407 | | |
403 | 408 | | |
404 | 409 | | |
| |||
0 commit comments