JetBrains / teamcity-hashicorp-vault-plugin

TeamCity plugin to support HashiCorp Vault
Apache License 2.0
28 stars 18 forks source link

Increasing connect timeout #63

Open oschwald opened 1 year ago

oschwald commented 1 year ago

We are seeing sporadic failures with this plugin of the form:

[HashiCorp Vault] Failed to unwrap HashiCorp Vault token: Cannot login using org.springframework.web.client.ResourceAccessException: I/O error on POST request for "[https://example.com:443/v1/sys/wrapping/unwrap](https://example.com/v1/sys/wrapping/unwrap)": Connect to example.com:443 [example.com/10.0.3.2] failed: connect timed out; nested exception is org.apache.http.conn.ConnectTimeoutException: Connect to example.com:443 [example.com/10.0.3.2] failed: connect timed out
org.springframework.vault.authentication.VaultLoginException: Cannot login using org.springframework.web.client.ResourceAccessException: I/O error on POST request for "[https://example.com:443/v1/sys/wrapping/unwrap](https://example.com/v1/sys/wrapping/unwrap)": Connect to example.com:443 [example.com/10.0.3.2] failed: connect timed out; nested exception is org.apache.http.conn.ConnectTimeoutException: Connect to example.com:443 [example.com/10.0.3.2] failed: connect timed out
    at org.springframework.vault.authentication.VaultLoginException.create(VaultLoginException.java:64)
    at org.springframework.vault.authentication.CubbyholeAuthentication.lookupToken(CubbyholeAuthentication.java:218)
    at org.springframework.vault.authentication.CubbyholeAuthentication.login(CubbyholeAuthentication.java:185)
    at org.jetbrains.teamcity.vault.support.LifecycleAwareSessionManager.login(LifecycleAwareSessionManager.java:187)
    at org.jetbrains.teamcity.vault.support.LifecycleAwareSessionManager.getSessionToken(LifecycleAwareSessionManager.java:173)
    at org.jetbrains.teamcity.vault.agent.VaultBuildFeature$buildStarted$$inlined$forEach$lambda$1.invoke(VaultBuildFeature.kt:112)
    at org.jetbrains.teamcity.vault.agent.VaultBuildFeature$buildStarted$$inlined$forEach$lambda$1.invoke(VaultBuildFeature.kt:37)
    at org.jetbrains.teamcity.vault.UtilKt.activity(util.kt:171)
    at org.jetbrains.teamcity.vault.agent.VaultBuildFeature.buildStarted(VaultBuildFeature.kt:81)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at jetbrains.buildServer.util.EventDispatcher.invokeListeners(EventDispatcher.java:157)
    at jetbrains.buildServer.util.EventDispatcher.lambda$dispatch$0(EventDispatcher.java:134)
    at jetbrains.buildServer.util.NamedThreadFactory.executeWithNewThreadName(NamedThreadFactory.java:76)
    at jetbrains.buildServer.util.EventDispatcher.dispatch(EventDispatcher.java:134)
    at jetbrains.buildServer.util.EventDispatcher$2.invoke(EventDispatcher.java:82)
    at com.sun.proxy.$Proxy24.buildStarted(Unknown Source)
    at jetbrains.buildServer.agent.impl.buildStages.startStages.FireBuildStartedStage.doBuildState(FireBuildStartedStage.java:25)
    at jetbrains.buildServer.agent.impl.buildStages.startStages.FireEventStageBase.doBuildStage(FireEventStageBase.java:28)
    at jetbrains.buildServer.agent.impl.buildStages.BuildStagesExecutor$1.callStage(BuildStagesExecutor.java:33)
    at jetbrains.buildServer.agent.impl.buildStages.BuildStagesExecutor$1.callStage(BuildStagesExecutor.java:24)
    at jetbrains.buildServer.agent.impl.buildStages.StagesExecutor.callRunStage(StagesExecutor.java:76)
    at jetbrains.buildServer.agent.impl.buildStages.StagesExecutor.doStages(StagesExecutor.java:35)
    at jetbrains.buildServer.agent.impl.buildStages.BuildStagesExecutor.doStages(BuildStagesExecutor.java:24)
    at jetbrains.buildServer.agent.impl.BuildRunActionImpl.doStages(BuildRunActionImpl.java:93)
    at jetbrains.buildServer.agent.impl.BuildRunActionImpl.runBuild(BuildRunActionImpl.java:65)
    at jetbrains.buildServer.agent.impl.BuildAgentImpl.doActualBuild(BuildAgentImpl.java:345)
    at jetbrains.buildServer.agent.impl.BuildAgentImpl.access$100(BuildAgentImpl.java:63)
    at jetbrains.buildServer.agent.impl.BuildAgentImpl$1.run(BuildAgentImpl.java:294)
    at java.base/java.lang.Thread.run(Thread.java:829)

Is it possible to increase the connect timeout? I thought setting teamcity.agentServer.connectionTimeout in internal.properties might do it, but that doesn't seem to work. I suspect I need to change something on the agent side rather than the server side from looking at the code.