BenjaminPRoss commented on a change in pull request #6879:
URL: https://github.com/apache/geode/pull/6879#discussion_r711380710
##########
File path:
geode-apis-compatible-with-redis/src/acceptanceTest/java/org/apache/geode/redis/internal/executor/pubsub/PubSubNativeRedisAcceptanceTest.java
##########
@@ -31,52 +25,20 @@
public class PubSubNativeRedisAcceptanceTest extends
AbstractPubSubIntegrationTest {
private static final Logger logger = LogService.getLogger();
- private static long socketTimeWaitMsec = 240000;
@ClassRule
public static NativeRedisTestRule redis = new NativeRedisTestRule();
- @BeforeClass
- public static void runOnce() throws IOException {
- if (SystemUtils.IS_OS_LINUX) {
- try {
- String line = getCommandOutput("cat",
"/proc/sys/net/ipv4/tcp_fin_timeout");
- socketTimeWaitMsec = Long.parseLong(line.trim());
- } catch (NumberFormatException | IOException ignored) {
- }
- } else if (SystemUtils.IS_OS_MAC) {
- try {
- String line = getCommandOutput("sysctl", "net.inet.tcp.msl");
- String[] parts = line.split(":");
- if (parts.length == 2) {
- socketTimeWaitMsec = 2 * Long.parseLong(parts[1].trim());
- }
- } catch (NumberFormatException | IOException ignored) {
- }
- }
- // Just leave timeout at the default if it's some other OS or there's a
problem getting OS value
- }
-
- private static String getCommandOutput(String... commandStringElements)
throws IOException {
- Process process = new ProcessBuilder(commandStringElements).start();
- try (BufferedReader reader = new BufferedReader(
- new InputStreamReader(process.getInputStream()))) {
- return reader.readLine();
- } finally {
- // Probably overkill but ensures test leaves no orphaned processes
- process.destroy();
- }
- }
-
@AfterClass
public static void cleanup() throws InterruptedException {
// This test consumes a lot of sockets and any subsequent tests may fail
because of spurious
// bind exceptions. Even though sockets are closed, they will remain in
TIME_WAIT state so we
// need to wait for that to clear up. It shouldn't take more than a minute
or so.
- // For now a thread sleep is the simplest way to wait for the sockets to
be out of the TIME_WAIT
- // state. The default timeout of 240 sec was chosen because that is the
default duration for
- // TIME_WAIT on Windows. The timeouts for both mac and linux are
significantly shorter.
- Thread.sleep(socketTimeWaitMsec);
+ // There will be a better solution for this from GEODE-9495, but for now a
thread sleep is the
+ // simplest way to wait for the sockets to be out of the TIME_WAIT state.
The timeout of 240 sec
+ // was chosen because that is the default duration for TIME_WAIT on
Windows. The timeouts for
+ // both mac and linux are significantly shorter.
+ Thread.sleep(240000);
Review comment:
I think the plan is to reintroduce the changes being reverted in this PR
shortly, this commit has broken our acceptance tests so we're just removing it
from develop to unblock the pipeline.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]