Commit 2bacbf4
committed
HBASE-30355 setupMiniKdc port-conflict retry never triggers because Kerby throws KrbException, not BindException
The retry-on-port-conflict block in setupMiniKdc only catches
java.net.BindException, but the Kerby-backed MiniKdc wraps the bind failure in
a KrbException with no BindException in its cause chain - the conflict is only
visible via the "Address already in use" message. The retry was therefore dead
code and the first port collision failed the test.
Recognise the bind conflict regardless of wrapper type: catch Exception, and
before retrying, test a predicate that walks the whole cause chain and matches
the "Address already in use" message; rethrow anything else so a genuine KDC
misconfig is not masked. We avoid catch (BindException | KrbException) because
the message (not the type) is the discriminator and to avoid importing kerby
types here (see HBASE-29117).
Applied to both TestLogLevel.setupMiniKdc (hbase-http) and
HBaseTestingUtil.setupMiniKdc (hbase-server).
Tests:
- testKdcBindConflictSurfacesAsKrbException: deterministic reproduction
occupying the KDC port on TCP+UDP; asserts the failure is a KrbException the
predicate recognises.
- testIsBindExceptionRecognizesKerbyWrappedBindFailure: unit test for the
predicate (wrapped BindException, message-only, and negative case).1 parent c5bd5c5 commit 2bacbf4
2 files changed
Lines changed: 109 additions & 4 deletions
File tree
- hbase-http/src/test/java/org/apache/hadoop/hbase/http/log
- hbase-server/src/test/java/org/apache/hadoop/hbase
Lines changed: 82 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
| |||
57 | 61 | | |
58 | 62 | | |
59 | 63 | | |
| 64 | + | |
60 | 65 | | |
61 | 66 | | |
62 | 67 | | |
| |||
153 | 158 | | |
154 | 159 | | |
155 | 160 | | |
156 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
157 | 168 | | |
158 | 169 | | |
159 | 170 | | |
160 | 171 | | |
161 | 172 | | |
162 | 173 | | |
163 | | - | |
| 174 | + | |
| 175 | + | |
164 | 176 | | |
165 | 177 | | |
166 | 178 | | |
167 | 179 | | |
168 | 180 | | |
169 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
170 | 250 | | |
171 | 251 | | |
172 | 252 | | |
| |||
Lines changed: 27 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3731 | 3731 | | |
3732 | 3732 | | |
3733 | 3733 | | |
3734 | | - | |
| 3734 | + | |
| 3735 | + | |
| 3736 | + | |
| 3737 | + | |
| 3738 | + | |
| 3739 | + | |
| 3740 | + | |
3735 | 3741 | | |
3736 | 3742 | | |
3737 | 3743 | | |
3738 | 3744 | | |
3739 | 3745 | | |
3740 | 3746 | | |
3741 | | - | |
| 3747 | + | |
| 3748 | + | |
3742 | 3749 | | |
3743 | 3750 | | |
3744 | 3751 | | |
3745 | 3752 | | |
3746 | 3753 | | |
3747 | 3754 | | |
3748 | 3755 | | |
| 3756 | + | |
| 3757 | + | |
| 3758 | + | |
| 3759 | + | |
| 3760 | + | |
| 3761 | + | |
| 3762 | + | |
| 3763 | + | |
| 3764 | + | |
| 3765 | + | |
| 3766 | + | |
| 3767 | + | |
| 3768 | + | |
| 3769 | + | |
| 3770 | + | |
| 3771 | + | |
| 3772 | + | |
| 3773 | + | |
3749 | 3774 | | |
3750 | 3775 | | |
3751 | 3776 | | |
| |||
0 commit comments