Skip to content

Commit cdb293b

Browse files
Allowlist known blocking methods from BlockHound (#2897)
* Allow-list known blocking methods from BlockHound There are two known occurrences where the SDK may currently block from within a Netty EventLoop: 1. #2145 2. #2360 Allowing BlockHound to forbid these operations may fail existing integration and stability tests. While we have outstanding issues to fix these items, until they are resolved, we need to allow our existing integration tests to continue to pass. We should explicitly allow-list these methods so that they do not interfere with existing tests and so that we maintain visibility on future regression detection.
1 parent d3cc7b8 commit cdb293b

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
package software.amazon.awssdk.testutils.service;
17+
18+
import reactor.blockhound.BlockHound;
19+
import reactor.blockhound.integration.BlockHoundIntegration;
20+
21+
/**
22+
* Implements {@link BlockHoundIntegration} to explicitly allow SDK calls that are known to be blocking. Some calls (with an
23+
* associated tracking issue) may wrongly block, but we allow-list them so that existing integration tests will continue to pass
24+
* and so that we preserve visibility on future regression detection.
25+
* <p>
26+
* https://github.com/reactor/BlockHound/blob/master/docs/custom_integrations.md
27+
*/
28+
public class BlockHoundAllowlist implements BlockHoundIntegration {
29+
@Override
30+
public void applyTo(BlockHound.Builder builder) {
31+
// https://github.com/aws/aws-sdk-java-v2/issues/2145
32+
builder.allowBlockingCallsInside(
33+
"software.amazon.awssdk.http.nio.netty.internal.BetterSimpleChannelPool",
34+
"close"
35+
);
36+
37+
// https://github.com/aws/aws-sdk-java-v2/issues/2360
38+
builder.allowBlockingCallsInside(
39+
"software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider",
40+
"getToken"
41+
);
42+
}
43+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#
2+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License").
5+
# You may not use this file except in compliance with the License.
6+
# A copy of the License is located at
7+
#
8+
# http://aws.amazon.com/apache2.0
9+
#
10+
# or in the "license" file accompanying this file. This file is distributed
11+
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
# express or implied. See the License for the specific language governing
13+
# permissions and limitations under the License.
14+
#
15+
16+
software.amazon.awssdk.testutils.service.BlockHoundAllowlist

0 commit comments

Comments
 (0)