【发布时间】:2018-10-19 11:22:24
【问题描述】:
我正在使用 Java API 和 TFS SDK 从 TFS 服务器查询变更集信息。最近我发现有太多(> 800)个连接从 TFS 服务器打开(闲置)到 TFS 数据库。我没有直接与 TFS 服务器数据库交互,但我使用 TFS SDK API 连接到 TFS 服务器。
这可能是 TFS SDK 的连接精简问题吗?我正在使用 VersionControlClient 和 WorkItemClient,并且在完成 API 调用后我将关闭所有这些连接。
我在这里缺少什么?为什么从 TFS Server 到 TFS Server 数据库(SQL Server 数据库)的连接太多?我需要关闭 TFS SDK API 中的其他连接吗?
【问题讨论】:
-
你是如何检查连接的?
-
我使用这个查询来获取到 SQL Server 的所有连接。 SELECT DB_NAME(dbid) as DBName, COUNT(dbid) as NumberOfConnections, loginame as LoginName, hostname, hostprocess FROM sys.sysprocesses with (nolock) WHERE dbid > 0 GROUP BY dbid, loginame, hostname, hostprocess;
-
除此之外,我从 TFS SDK 使用的这些 API:Changeset[] changesets = vcc .queryHistory(serverPath, LatestVersionSpec.INSTANCE, 0, RecursionType.FULL, null, new DateVersionSpec(startDate), new DateVersionSpec(endDate), Integer.MAX_VALUE, true, true, true, false);
-
vcc.queryBranchObjects(ItemIdentifier, RecursionType.FULL); IdentityManagementService.readIdentity(IdentitySearchFactor.ACCOUNT_NAME, userName, MembershipQuery.DIRECT,ReadIdentityOptions.NONE); vcc.getChangesForChangeset(changesetId, true, Integer.MAX_VALUE, null, null, true);
-
有我正在使用的API。不确定,是否其中任何一个会导致连接泄漏。