Commit ec7b33e
authored
[Turbopack] fix require.resolve self hanging (#69793)
### What?
evaluation require.resolve tries to resolve and process a module during
module analytics. Since analytics is part of processing a module this
can create a call cycle when `require.resolve("./self")` is used. This
happens in some npm packages and caused Turbopack to hange.
This PR fixes that problem by only resolving the module and not
processing it when using `require.resolve`.
In addition to that it adds a panic when a call cycle occurs. The next
time we mess it up and create a call cycle this will crash Turbopack
instead of hanging, which makes it much easier to find the problem.
fixes PACK-32271 parent a9bfc64 commit ec7b33e
File tree
6 files changed
+156
-24
lines changed- turbopack/crates
- turbo-tasks-memory/src/aggregation
- turbopack-core/src/resolve
- turbopack-ecmascript/src/references
- turbopack-resolve/src
- turbopack-tests/tests/execution/turbopack/resolving/require-resolve
- input
6 files changed
+156
-24
lines changedLines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
192 | 199 | | |
193 | 200 | | |
194 | 201 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2752 | 2752 | | |
2753 | 2753 | | |
2754 | 2754 | | |
2755 | | - | |
2756 | | - | |
2757 | | - | |
2758 | | - | |
2759 | 2755 | | |
2760 | 2756 | | |
2761 | 2757 | | |
| |||
2765 | 2761 | | |
2766 | 2762 | | |
2767 | 2763 | | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
2768 | 2767 | | |
2769 | 2768 | | |
2770 | 2769 | | |
2771 | | - | |
| 2770 | + | |
2772 | 2771 | | |
2773 | | - | |
2774 | | - | |
| 2772 | + | |
| 2773 | + | |
2775 | 2774 | | |
2776 | 2775 | | |
2777 | | - | |
2778 | 2776 | | |
2779 | | - | |
2780 | | - | |
2781 | | - | |
| 2777 | + | |
2782 | 2778 | | |
2783 | 2779 | | |
2784 | 2780 | | |
2785 | 2781 | | |
2786 | 2782 | | |
2787 | | - | |
| 2783 | + | |
2788 | 2784 | | |
2789 | | - | |
2790 | | - | |
| 2785 | + | |
| 2786 | + | |
2791 | 2787 | | |
2792 | 2788 | | |
2793 | | - | |
| 2789 | + | |
2794 | 2790 | | |
2795 | | - | |
2796 | | - | |
2797 | | - | |
| 2791 | + | |
2798 | 2792 | | |
2799 | 2793 | | |
2800 | 2794 | | |
2801 | 2795 | | |
2802 | 2796 | | |
| 2797 | + | |
| 2798 | + | |
| 2799 | + | |
| 2800 | + | |
| 2801 | + | |
| 2802 | + | |
| 2803 | + | |
| 2804 | + | |
| 2805 | + | |
| 2806 | + | |
| 2807 | + | |
| 2808 | + | |
| 2809 | + | |
| 2810 | + | |
| 2811 | + | |
| 2812 | + | |
| 2813 | + | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
| 2834 | + | |
| 2835 | + | |
| 2836 | + | |
| 2837 | + | |
| 2838 | + | |
| 2839 | + | |
| 2840 | + | |
| 2841 | + | |
| 2842 | + | |
| 2843 | + | |
| 2844 | + | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
| 2851 | + | |
| 2852 | + | |
| 2853 | + | |
| 2854 | + | |
| 2855 | + | |
| 2856 | + | |
| 2857 | + | |
| 2858 | + | |
| 2859 | + | |
| 2860 | + | |
| 2861 | + | |
| 2862 | + | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
| 2870 | + | |
| 2871 | + | |
| 2872 | + | |
| 2873 | + | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
2803 | 2882 | | |
2804 | 2883 | | |
2805 | 2884 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
2383 | 2383 | | |
2384 | 2384 | | |
2385 | 2385 | | |
2386 | | - | |
| 2386 | + | |
2387 | 2387 | | |
2388 | 2388 | | |
2389 | 2389 | | |
2390 | | - | |
| 2390 | + | |
2391 | 2391 | | |
2392 | 2392 | | |
2393 | | - | |
| 2393 | + | |
2394 | 2394 | | |
2395 | 2395 | | |
2396 | 2396 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
106 | 137 | | |
107 | 138 | | |
108 | 139 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
0 commit comments