[TC9] Problem while loading patch data stream

After upgradding from TC8 to TC9 our aws-cloud-buildagents does not work anymore.
They can connect to the server but when running a build the following error is logged.

Updating sources: server side checkout
[08:51:12]Will repeat attempt when server will be available, number of attempts left: 2
[08:51:22]Updating sources: server side checkout
[08:51:22]Will repeat attempt when server will be available, number of attempts left: 1
[08:51:32]Updating sources: server side checkout

[08:51:32]Problem while loading patch data stream: Failed to obtain stream from server. Server status: 401 (Unauthorized)


On the agent the error is:


Failed to execute build stage: UpdateSourcesFromS
erver. Problem while loading patch data stream
jetbrains.buildServer.agent.impl.buildStages.BuildStageExecutionException: Problem while loading patch data stream
        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:78)
        at jetbrains.buildServer.agent.impl.buildStages.StagesExecutor.doStages(StagesExecutor.java:37)
        at jetbrains.buildServer.agent.impl.buildStages.BuildStagesExecutor.doStages(BuildStagesExecutor.java:24)
        at jetbrains.buildServer.agent.impl.BuildRunActionImpl.doStages(BuildRunActionImpl.java:70)
        at jetbrains.buildServer.agent.impl.BuildRunActionImpl.runBuild(BuildRunActionImpl.java:50)
        at jetbrains.buildServer.agent.impl.BuildAgentImpl.doActualBuild(BuildAgentImpl.java:266)
        at jetbrains.buildServer.agent.impl.BuildAgentImpl.access$100(BuildAgentImpl.java:51)
        at jetbrains.buildServer.agent.impl.BuildAgentImpl$1.run(BuildAgentImpl.java:231)
        at java.lang.Thread.run(Thread.java:745)
Caused by: jetbrains.buildServer.RunBuildException: Problem while loading patch data stream
        at jetbrains.buildServer.agent.impl.buildStages.startStages.RecoverableStageFailure.onLastAttempt(Recoverable
StageFailure.java:36)
        at jetbrains.buildServer.agent.impl.patch.PatchDownloaderImpl$3.onLastAttempt(PatchDownloaderImpl.java:158)
        at jetbrains.buildServer.agent.impl.buildStages.startStages.RecoverableBuildStage.doLastAttempt(RecoverableBu
ildStage.java:114)
        at jetbrains.buildServer.agent.impl.buildStages.startStages.RecoverableBuildStage.doBuildStage(RecoverableBui
ldStage.java:70)
        at jetbrains.buildServer.agent.impl.buildStages.BuildStagesExecutor$1.callStage(BuildStagesExecutor.java:31)
        ... 10 more
Caused by: jetbrains.buildServer.agent.impl.patch.PatchDownloaderImpl$3: Problem while loading patch data stream
        at jetbrains.buildServer.agent.impl.patch.PatchDownloaderImpl.downloadPatch(PatchDownloaderImpl.java:153)
        at jetbrains.buildServer.agent.impl.patch.PatchDownloaderImpl.copyPatchAndCheck(PatchDownloaderImpl.java:59)
        at jetbrains.buildServer.agent.impl.patch.UpdateSourcesPatcherBase.copyPatchToTempFile(UpdateSourcesPatcherBa
se.java:71)
        at jetbrains.buildServer.agent.impl.patch.UpdateSourcesFromServer.updateSources(UpdateSourcesFromServer.java:
60)
        at jetbrains.buildServer.agent.impl.patch.UpdateSourcesBuildStageBase.doSourceUpdate(UpdateSourcesBuildStageB
ase.java:91)
        at jetbrains.buildServer.agent.impl.patch.UpdateSourcesBuildStageBase.doRecoverableStage(UpdateSourcesBuildSt
ageBase.java:59)
        at jetbrains.buildServer.agent.impl.buildStages.startStages.RecoverableBuildStage.doLastAttempt(RecoverableBuildStage.java:112)
        ... 12 more
Caused by: java.io.IOException: Failed to obtain stream from server. Server status: 401 (Unauthorized)
        at jetbrains.buildServer.http.ServerStreamProvider.getStream(ServerStreamProvider.java:114)
        at jetbrains.buildServer.agent.impl.patch.PatchStreamProviderImpl.getServerStream(PatchStreamProviderImpl.java:63)
        at jetbrains.buildServer.agent.impl.patch.PatchStreamProviderImpl.getPatchesStream(PatchStreamProviderImpl.java:37)
        at jetbrains.buildServer.agent.impl.patch.PatchDownloaderImpl.downloadPatch(PatchDownloaderImpl.java:144)
        ... 18 more



What extra connection for patching is used which can result in a 401 error?

Regards
6 comments
Comment actions Permalink

When using client-side checkout the build works, but in the end the artificat upload fails.

Failed to publish artifacts: Authentication required To login manually go to "/login.html" page

Seems to be an auth issue between agent and server.

The nginxs- server-logs:

TeamCityBuildId=34659 [09/Jan/2015:09:52:31 +0000] "POST /httpAuth/artefactUpload.html HTTP/1.1" 401 77 "-" "Jakarta Commons-HttpClient/3.1"

What special config is needed for an agent to POST to /httpAuth/artefactUpload.htm ?

0
Comment actions Permalink

Also the patch data-stream error is a agent to server request with http 401 status code.

TeamCityBuildId=34660 [09/Jan/2015:10:07:56 +0000] "POST /httpAuth/createPatch.html?buildId=34660&fullCheckoutReason=ROOT_DIRECTORY_IS_EMPTY HTTP/1.1" 401 77 "-" "Jakarta Commons-HttpClient/3.1"

0
Comment actions Permalink

Removing the websocket config from nginx solved the problem.

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
0
Comment actions Permalink

Thanks so much! I was seeing the exact same issue after upgrading to TC9.0 and this helped me solve it as well.

0
Comment actions Permalink

Hi,

Could you please provide full nginx config that caused this issue?

0

Please sign in to leave a comment.