From 2fb8b360e3eb2252ea9c2e3f984f1ddd0130fc90 Mon Sep 17 00:00:00 2001 From: Duarte Meneses Date: Wed, 26 May 2021 16:12:07 -0500 Subject: [PATCH] SONAR-14870 DNS cache never expires causing PR decoration to fail --- .../src/main/java/org/sonar/process/SecurityManagement.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/sonar-process/src/main/java/org/sonar/process/SecurityManagement.java b/server/sonar-process/src/main/java/org/sonar/process/SecurityManagement.java index 7a2d32f4fc5..6c7c72f5bfe 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/SecurityManagement.java +++ b/server/sonar-process/src/main/java/org/sonar/process/SecurityManagement.java @@ -25,6 +25,7 @@ import java.security.PermissionCollection; import java.security.Permissions; import java.security.Policy; import java.security.ProtectionDomain; +import java.security.Security; import java.security.SecurityPermission; import java.util.Arrays; import java.util.HashSet; @@ -39,6 +40,8 @@ public class SecurityManagement { SecurityManager sm = new SecurityManager(); Policy.setPolicy(new CustomPolicy()); System.setSecurityManager(sm); + // SONAR-14870 By default, with a security manager installed, the DNS cache never times out. See InetAddressCachePolicy. + Security.setProperty("networkaddress.cache.ttl", "30"); } static class CustomPolicy extends Policy { -- 2.39.5