Erro ao anexar arquivo a um work item no TFS

fevereiro 7, 2011

Sintoma: Ao anexar um arquivo a um WorkItem no servidor team foudation utilizando o Visual Studio nos deparamos a seguinte mensagem de erro ao Salvar o Anexo:

TF237082: The Attachment could not be uploaded. Verify that you have a network connection and that Team Foundation Server is avaible. If the problem persists, provide the following information to the server administrator.
The Server returned the following message: The remote server returned an error: (500) Internal Server Error.

Ao Anexar arquivos ao Work Item utilizando o Tem WebAccess recebemos a mensagem a seguir:

“Attachment upload failed. Check that you have a network connection and that the Team Foudation Server is availble. If the problem persists, contact your Team Foudation Server Administrator.”

Ao checar os eventos ocorridos no servidor TFS nos deparamos com o seguinte evento de erro no momento em que tentamos anexar o arquivo no work item:

O Seguinte log de evento ocorre no meu servidor tfs imediatamente apos o erro gerado no portal ou no Visual Studio:
Event Type: Error
Event Source: TFS WorkItem Tracking
Event Category: None
Event ID: 3000
Date:  12/8/2010
Time:  4:32:57 PM
User:  N/A
Computer: %SERVERNAME%
Description:
TF53010: The following error has occurred in a Team Foundation component or extension:
Date (UTC): 12/8/2010 6:32:57 PM
Machine: %SERVERNAME%
Application Domain: /LM/W3SVC/322882837/Root/WorkItemTracking-3-129362259372029125
Assembly: Microsoft.TeamFoundation.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727
Process Details:
  Process Name: w3wp
  Process Id: 6100
  Thread Id: 4312
  Account name: %Domain\User%

Detailed Message: TF51334: An unknown Web service error occurred: A severe error occurred on the current command.  The results, if any, should be discarded.. Check the Event Log for more information.
Web Request Details
    Url: http://teamserver.dominio.local:8080/WorkItemTracking/v1.0/AttachFileHandler.ashx [method: POST]
    User Agent: Team Foundation 9.0.21022.8, (WebAccess 9.0.3000)
    Headers: Content-Length=15280&Content-Type=multipart%2fform-data%3b+boundary%3d————————–8cd650cc10fa8fe&Accept-Language=pt-BR&Expect=100-continue&Host=teamserver.perlink.net%3a8080&User-Agent=Team+Foundation+9.0.21022.8%2c+(WebAccess+9.0.3000)&X-TFS-Version=1.0.0.0&X-TFS-Session=a1f46f21-1b5a-4b1a-8b82-b85cd4137581
    Path: /WorkItemTracking/v1.0/AttachFileHandler.ashx
    Local Request: False
    Host Address: %IP Client%
    User: %domain\user% [authentication type: NTLM]

Exception Message: TF51334: An unknown Web service error occurred: A severe error occurred on the current command.  The results, if any, should be discarded.. Check the Event Log for more information. (type ConfigurationException)

Exception Stack Trace:

Inner Exception Details:

Exception Message: A severe error occurred on the current command.  The results, if any, should be discarded. (type SqlExistingConnectionForciblyClosedException)

Exception Stack Trace:    at Microsoft.TeamFoundation.WorkItemTracking.Server.SqlAccess.HandleDalError(Exception e)
   at Microsoft.TeamFoundation.WorkItemTracking.Server.SqlAccess.ExecuteBatchPayloadImpl(IRequestContext context, String sqlBatch, List`1 parameterList, Boolean& errorOnBulkUpdate, String connectionString)
   at Microsoft.TeamFoundation.WorkItemTracking.Server.SqlAccess.ExecuteBatchPayload(IRequestContext context, String sqlBatch, List`1 parameterList, Boolean& errorOnBulkUpdate)
   at Microsoft.TeamFoundation.WorkItemTracking.Server.AdoDbBase.ExecuteBatchQuery(IRequestContext context, String sqlBatch, List`1 parameterList)
   at Microsoft.TeamFoundation.WorkItemTracking.Server.SqlBatchBuilder.ExecuteBatchInternal(IRequestContext context, Boolean passInConnectionInfo, String server, String database)
   at Microsoft.TeamFoundation.WorkItemTracking.Server.SqlBatchBuilder.ExecuteBatch()
   at Microsoft.TeamFoundation.WorkItemTracking.Server.DataAccessLayerImpl.AddFileAttachment(String attachmentServerName, String attachmentDatabaseName, String clientUserName, Stream fileInput, String fileGuid, String projectUri)
   at Microsoft.TeamFoundation.WorkItemTracking.Server.AttachmentUploadHandler.ProcessRequest(HttpContext context)

Inner Exception Details:

Exception Message: A severe error occurred on the current command.  The results, if any, should be discarded. (type SqlException)
SQL Exception Class: 11
SQL Exception Number: 0
SQL Exception Procedure:
SQL Exception Line Number: 0
SQL Exception Server: %SQL SERVER%
SQL Exception State: 0
SQL Error(s):

Exception Data Dictionary:
HelpLink.ProdName = Microsoft SQL Server
HelpLink.ProdVer = 10.00.1600
HelpLink.EvtSrc = MSSQLServer
HelpLink.EvtID = 0
HelpLink.BaseHelpUrl = http://go.microsoft.com/fwlink
HelpLink.LinkId = 20476
Exception Stack Trace:    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader()
   at Microsoft.TeamFoundation.WorkItemTracking.Server.SqlAccess.ExecuteReaderWithRetry(SqlCommand sqlCommand, SqlConnection sqlConnection, SqlDataReader& dataReader)
   at Microsoft.TeamFoundation.WorkItemTracking.Server.SqlAccess.ExecuteBatchPayloadImpl(IRequestContext context, String sqlBatch, List`1 parameterList, Boolean& errorOnBulkUpdate, String connectionString)

Solução: Depois de uma longa jornada cheguamos a conclusão de que existia uma tabela corrompida no database TfsWorkItemTrackingAttachments.

Essa tabela traz todos os anexos do portal TFS e por algum motivo corrompeu… para solucionar esse problema basta recorrer ao bom e velho bkp que não impactará nos outros dados do nosso portal e já que não conseguiamos anexar documentos fazia algum tempo, um restore não trouxe nenhuma perda para nossos projetos (o maximo que se perde aí sao os anexos que foram incluidos nos workitens caso o bkp seja de dias anteriores ao dia do problema ocorrido.

Recomendo que seja feito os seguinte passsos:
1 – Backup do banco TfsWorkItemTrackingAttachments
2 – Detach no banco TfsWorkItemTrackingAttachments
3 – Rename nos arquivos mdf e ldf para TfsWorkItemTrackingAttachments.mdf.old e TfsWorkItemTrackingAttachments_1.ldf.old
4 – Restore do banco com o Backup do ultimo dia em que foi utilizada a função de anexo em um work Item pelo Visual Studio ou pelo Team System WebAccess

Anúncios

Deixe um comentário

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair /  Alterar )

Foto do Google

Você está comentando utilizando sua conta Google. Sair /  Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair /  Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair /  Alterar )

Conectando a %s

%d blogueiros gostam disto: