Logging error since 2790

Since we installed 2790, we get this error some times:

Build Log Writer 


An unexpected error occurred while logging the start of a build action execution: Exception: Exception 
Message: Failed to write using log writer of type 'Continua.Modules.Builds.Logging.TextLogWriterSession': Exception: IOException 
Message: The process cannot access the file 'C:\BuildServer\Ws\care4\4397\log.txt' because it is being used by another process. 
Stack Trace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath) 
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) 
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) 
at Continua.Modules.Builds.Logging.TextLogWriterSession.OpenWriter() 
at Continua.Modules.Builds.Logging.TextLogWriterSession.BeginExecution(LogAction action, Execution execution, Execution parentExecution) 
at Continua.Modules.Builds.Logging.CompositeLogWriterSession.ForEachLogWriter(Action`1 action) 


Stack Trace: at Continua.Modules.Builds.Logging.CompositeLogWriterSession.ForEachLogWriter(Action`1 action) 
at Continua.Modules.Builds.Logging.BuildLogWriter.OnExecutionBegin(LogAction action, Execution execution) 

Hi Christian,

I’ve uploaded a new build v1.0.0.2832 which fixes this issue

Now i’m getting this:

UnitTests

[code]System.IO.IOException: The process cannot access the file ‘C:\BuildServer\Ws\care4\4422\log.txt’ because it is being used by another process. at Continua.Modules.Builds.Logging.LogSessionManager.GetAvailableSession[T](String folder) at Continua.Modules.Builds.Logging.LogSessionManager.GetOpenSession[T](String folder) at Continua.Modules.Builds.UnitTests.UnitTestManager.RegisterUnitTests(Int32 buildId, Guid stageId, IList1 unitTests, IEnumerable1 metrics, Boolean updateMetrics)[/code]

This error occurs when the second MSTest action will write its results.

Hi Christian,

I've uploaded a new build v1.0.0.2840 which includes various updates to the log writer connection pool which now seems to erradicate this issue (at least for us...)

thanks in advance. your support is great and fast. this is the cause we still use your products even if they do not work sometimes (hell ya, its software produced by humans ;-)).

seems to work. statistics match results. no more event log entries. good work.

well, it works now, thats most important. but let me note, that as long as the second RegisterUnitTests did not work, the duration for the test stage was 3 minutes. now its 5 minutes (build state details) but when i open the log, only 3 minutes were understandable. maybe you can check improving this process.

our test count for our biggest MSTest action is 2400.

lalala … no worry, the build is successful and seems to be ok.

Build Log Writer An unexpected error occurred while logging the completion of a build action: 
Exception: Exception Message: Failed to write using log writer of type 'Continua.Modules.Builds.Logging.TextLogWriterSession': 
Exception: KeyNotFoundException 
Message: The given key was not present in the dictionary. Stack Trace: at 
Continua.Modules.Builds.Logging.TextLogWriterSession.EndAction(LogAction action) at 
Continua.Modules.Builds.Logging.CompositeLogWriterSession.ForEachLogWriter(Action `1 action) Stack Trace: at 
Continua.Modules.Builds.Logging.CompositeLogWriterSession.ForEachLogWriter(Action` 1 action) at 
Continua.Modules.Builds.Logging.BuildLogWriter.OnActionComplete(LogAction action)

Arrrgggghh! this one is proving difficult to sort out.

With regards to the timing, will look into it. I suspect we are hitting a database insert speed issue, or to be more correct, and nhibernate insert issue. Might be time to switch that part of the code to dapper (which we use on other parts).

One of our recent builds hang up again. I stopped it after one hour. But no additional log entries. Only that above.

Hi Christian

I have uploaded a build with a fix for the logging issue (which I hope is resolved once and for all!) and also a major performance boost for recording unit tests on the server. The performance issue  was due to a query being run for every test, when it could be replaced with a single query up front (finding shelving information). I also improved the data structures used between the agent and the server to remove duplicate information. 

http://downloads.finalbuilder.com/d...0.2849.exe

http://downloads.finalbuilder.com/d...0.2849.exe

http://downloads.finalbuilder.com/d...0.2849.exe

http://downloads.finalbuilder.com/d...0.2849.exe

Stupid forums keeps messing with my links! The top links are for x64, bottom two for x86

[code]Build Log Writer An unexpected error occurred while logging metric details: Exception: Exception Message: Failed to write using log writer of type 'Continua.Modules.Builds.Logging.SqlCeLogWriterSession': Exception: SqlCeException Message: There was an error parsing the query. [ Token line number = 1,Token line offset = 29,Token in error = 00 ] Stack Trace: at System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr) at System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan() at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options) at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery() at Continua.Modules.Builds.Logging.SqlCeLogWriterSession.AppendMetric(Stage stage, Metric metric) at Continua.Modules.Builds.Logging.CompositeLogWriterSession.ForEachLogWriter(Action1 action) Stack Trace: at Continua.Modules.Builds.Logging.CompositeLogWriterSession.ForEachLogWriter(Action1 action) at Continua.Modules.Builds.Logging.BuildLogWriter.OnMetric(Metric metric) This event has been reported 2 times.[/code]

The build itself is successful and the unit tests are now very fast (1 minute 40 seconds, thumbs up).

but the unit tests are not recorded correctly. only the results of the first of the two actions are recorded.

[code]UnitTests System.Exception: Failed to write using log writer of type 'Continua.Modules.Builds.Logging.SqlCeLogWriterSession': Exception: SqlCeException Message: There was an error parsing the query. [ Token line number = 1,Token line offset = 31,Token in error = 00 ] Stack Trace: at System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr) at System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan() at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options) at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery() at Continua.Modules.Builds.Logging.SqlCeLogWriterSession.AppendMetric(Stage stage, Metric metric) at Continua.Modules.Builds.Logging.CompositeLogWriterSession.ForEachLogWriter(Action1 action) at Continua.Modules.Builds.Logging.CompositeLogWriterSession.ForEachLogWriter(Action1 action) at Continua.Modules.Builds.UnitTests.UnitTestManager.RegisterUnitTests(Int32 buildId, Guid stageId, IList1 unitTests, IEnumerable1 metrics, Boolean updateMetrics) This event has been reported 3 times.[/code]

Hmm… do you have any shelved tests? I haven’t been able to reproduce the problem here so far… still looking into it.

Hi Chistian

I wasn't able to reproduce this here, but I refactored the area to improve error handling. At the very least it shouldn't crash the build, it will just log the error.

http://downloads.finalbuilder.com/d...0.2852.exe

http://downloads.finalbuilder.com/d...0.2852.exe

http://downloads.finalbuilder.com/d...0.2852.exe

http://downloads.finalbuilder.com/d...0.2852.exe


hm ok, for now, no event log entries occur, everything works and performance is good.

Hi Christian

Thanks for letting us know, and thanks for your patience. We’ll be rolling out an official update in a day or so.