VCS problem: Unknown host - but only for a short time
Hi,
we are currently running teamcity in docker container. However since June the VCS problem started to occur. When you enter teamcity website every build has an “VCS Problem: Repository_Name” error message is
Failed for the root '"Repository_Name" {instance id=94, parent internal id=7, parent id=Repository_Name, description: "ssh://URL/Repository_Name#refs/heads/master"}: org.eclipse.jgit.errors.TransportException: ssh://URL/Repository_Name: unknown host
It takes about 20 seconds and the problem disappear. Its very annoying but the real problem is with scheduled jobs. Also it is very strange that the problem is only temporary.
Please sign in to leave a comment.
In order to narrow down the issue, could you please help to check the following items?
1. Have there been any recent updates to Docker, the TeamCity Docker image, or any network-related settings?
2. Does the issue occur with all VCS roots or only specific ones?
3. Could you provide logs from the TeamCity server and Docker container around the time the issue occurs?
Any screenshots of the issue would be very helpful. Files can be uploaded via https://uploads.jetbrains.com/. Please let us know the exact id after the upload.
Hi,
thank you for your answer.
1) We have updated Teamcity Docker image in June if I remember correctly and since then its problematic. Regarding updates of Docker or network-related settings I dont know about anything (I am almost sure there has been no updates regarding these two thing). There was even new update of teamcity docker image that we installed and still same error occurs. We have teamcity version: “TeamCity Professional 2024.07.1 (build 160635)”
2) The issue occur with all VCS roots that has Fetch URL pointed to our TFS server: ssh://tfs.url:port/tfs/TFS2008%20Collection/project/_git/Repo
3) In Teamcity server - In teamcity-vcs.log and teamcity-server.log I found similar error code:
[2024-08-14 22:24:45,649] WARN [l executor 1237] - jetbrains.buildServer.VCS - Failed to run operation within 1 attempt: org.eclipse.jgit.errors.TransportException: ssh://tfs.URL:PORT/tfs/TFS2008%20Collection/PROJECT/_git/REPO: unknown host (enable debug to see stacktrace)
[2024-08-14 22:24:45,649] INFO [l executor 1237] - jetbrains.buildServer.VCS - Cannot load current state for VCS root "BUILDPLAN" {instance id=120, parent internal id=12, parent id=BUILDPLAN, description: "ssh://tfs.URL:PORT/tfs/TFS2008%20Collection/PROJECT/_git/REPO#refs/heads/master"}: org.eclipse.jgit.errors.TransportException: ssh://tfs.URL:PORT/tfs/TFS2008%20Collection/PROJECT/_git/REPO: unknown host
In docker log I found same error code as in teamcity-server.log:
[2024-08-26 17:30:02,167] WARN [n@17a27d18'; Normal executor 1] - jetbrains.buildServer.SERVER - Error while starting build {id=8589}: jetbrains.buildServer.serverSide.impl.BuildChangesCollectException: Failed to collect changes, error: org.eclipse.jgit.errors.TransportException: ssh://tfs.URL:PORT/tfs/TFS2008%20Collection/PROJECT/_git/REPO: unknown host, VCS root: "BUILDPLAN" {instance id=120, parent internal id=12, parent id=BUILDPLAN, description: "ssh://tfs.URL:PORT/tfs/TFS2008%20Collection/PROJECT/_git/REPOSITORY#refs/heads/master"} (enable debug to see stacktrace)
Upload id: 2024_08_28_pRsa2dqsJYmew422EAb8tT (file: image.png)
Thanks for your sharing.
Based on the "unknown host" error, if your TFS server is an on-premises local server rather than an external one, the DNS issue might be due to the Docker container’s difficulty in resolving or accessing local network resources in a timely manner.
Have you tried directly adding an entry for your TFS server to the TeamCity container’s /etc/hosts file to resolve the TFS sever hostname?
Best Regards,
Tom
Thanks for the tip.
I found the extra_hosts possibility in docker compose. So I put our docker-compose.yml file like
services:
teamcity-server:
# container_name: teamcity-server
image: jetbrains/teamcity-server:latest
extra_hosts:
- "tfs.url=tfs.ip_adress"
Is that valid solution?
Hi,
Yes, using the extra_hosts option in your Docker Compose file is a valid solution.
extra_hosts
adds hostname mappings to the container network interface configuration (`/etc/hosts` for Linux).The separator `=` is preferred (https://github.com/docker/compose/releases/v2.24.1) but
:
can also be used. For example:extra_hosts:
- "somehost:tfs.ip_adress"
This option allows you to add custom entries to the /etc/hosts file inside the container, which will directly map the hostname to the specified IP address.
Please do not hesitate to reach out to me if you have any further inquiries regarding this matter.