Commit 36ee79e
authored
fix(amazonq): fix connection manager deadlock when q ListAvailableProfiles is long (#5547)
`CodeWhispererStatusBarWidget` attempts to query active connections, but lock is being held while trying to list profiles
```
"AWT-EventQueue-0" prio=0 tid=0x0 nid=0x0 blocked
java.lang.Thread.State: BLOCKED
on software.aws.toolkits.jetbrains.core.credentials.DefaultToolkitConnectionManager@37995400 owned by "ApplicationImpl pooled thread 5 @coroutine#17104" Id=128
at software.aws.toolkits.jetbrains.core.credentials.DefaultToolkitConnectionManager.activeConnectionForFeature(DefaultToolkitConnectionManager.kt)
at software.aws.toolkits.jetbrains.services.amazonq.QUtilsKt.calculateIfIamIdentityCenterConnection(QUtils.kt:18)
at software.aws.toolkits.jetbrains.services.codewhisperer.customization.DefaultCodeWhispererModelConfigurator.activeCustomization(CodeWhispererModelConfigurator.kt:171)
at software.aws.toolkits.jetbrains.services.codewhisperer.status.CodeWhispererStatusBarWidget.getSelectedValue(CodeWhispererStatusBarWidget.kt:114)
at com.intellij.openapi.wm.impl.status.MultipleTextValues.beforeUpdate(IdeStatusBarImpl.kt:983)
```
```
- "coroutine#17104":BlockingCoroutine{Active}@7dced952, state: RUNNING [CoroutineId(17104), BlockingEventLoop@2da7461c]
at java.base/jdk.internal.misc.Unsafe.park(Native Method)
at java.base/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:269)
at java.base/java.util.concurrent.CompletableFuture$Signaller.block(CompletableFuture.java:1866)
at java.base/java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:4013)
at java.base/java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3961)
at java.base/java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1939)
at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2095)
at migration.software.aws.toolkits.jetbrains.core.AwsResourceCache$Companion.wait(AwsResourceCache.kt:150)
at migration.software.aws.toolkits.jetbrains.core.AwsResourceCache$Companion.access$wait(AwsResourceCache.kt:145)
at migration.software.aws.toolkits.jetbrains.core.AwsResourceCache.getResourceNow(AwsResourceCache.kt:92)
at migration.software.aws.toolkits.jetbrains.core.AwsResourceCache.getResourceNow(AwsResourceCache.kt:105)
at software.aws.toolkits.jetbrains.services.amazonq.profile.QRegionProfileManager.listRegionProfiles(QRegionProfileManager.kt:70)
at software.aws.toolkits.jetbrains.services.amazonq.profile.QRegionProfileManager.validateProfile$lambda$0(QRegionProfileManager.kt:50)
at software.aws.toolkits.core.utils.ExceptionUtils.tryOrNull(ExceptionUtils.kt:11)
at software.aws.toolkits.jetbrains.services.amazonq.profile.QRegionProfileManager.validateProfile(QRegionProfileManager.kt:49)
at software.aws.toolkits.jetbrains.services.amazonq.toolwindow.AmazonQToolWindowFactory$createToolWindowContent$2.activeConnectionChanged(AmazonQToolWindowFactory.kt:68)
[...]
at software.aws.toolkits.jetbrains.core.credentials.DefaultToolkitConnectionManager.switchConnection(DefaultToolkitConnectionManager.kt:159)
```1 parent 289a722 commit 36ee79e
File tree
4 files changed
+47
-9
lines changed- .changes/next-release
- plugins/amazonq
- chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow
- codewhisperer/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codewhisperer
4 files changed
+47
-9
lines changedLines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | 68 | | |
70 | 69 | | |
71 | 70 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
108 | 126 | | |
109 | 127 | | |
110 | 128 | | |
| |||
Lines changed: 25 additions & 8 deletions
| 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 | | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| 30 | + | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| |||
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
43 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
44 | 60 | | |
45 | 61 | | |
| 62 | + | |
46 | 63 | | |
47 | 64 | | |
48 | 65 | | |
| |||
78 | 95 | | |
79 | 96 | | |
80 | 97 | | |
81 | | - | |
| 98 | + | |
82 | 99 | | |
83 | 100 | | |
84 | 101 | | |
| |||
110 | 127 | | |
111 | 128 | | |
112 | 129 | | |
113 | | - | |
| 130 | + | |
114 | 131 | | |
115 | 132 | | |
116 | 133 | | |
| |||
139 | 156 | | |
140 | 157 | | |
141 | 158 | | |
142 | | - | |
| 159 | + | |
143 | 160 | | |
144 | 161 | | |
145 | 162 | | |
146 | 163 | | |
147 | 164 | | |
148 | | - | |
| 165 | + | |
149 | 166 | | |
150 | 167 | | |
151 | 168 | | |
| |||
191 | 208 | | |
192 | 209 | | |
193 | 210 | | |
194 | | - | |
| 211 | + | |
195 | 212 | | |
196 | 213 | | |
197 | 214 | | |
198 | 215 | | |
199 | 216 | | |
200 | 217 | | |
201 | 218 | | |
202 | | - | |
203 | | - | |
| 219 | + | |
| 220 | + | |
204 | 221 | | |
205 | 222 | | |
206 | 223 | | |
| |||
0 commit comments