[ https://issues.apache.org/jira/browse/IBATISNET-252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12554898 ]
Gilles Bayon commented on IBATISNET-252: ---------------------------------------- Already fix in IBATISNET-248 if I remenber > DefaultPreparedCommand.ApplyParameterMap logging errors when multiple threads > call same statement at same time. > --------------------------------------------------------------------------------------------------------------- > > Key: IBATISNET-252 > URL: https://issues.apache.org/jira/browse/IBATISNET-252 > Project: iBatis for .NET > Issue Type: Bug > Components: DataMapper > Affects Versions: DataMapper 1.6.1 > Environment: Tested and confirmed on Windows 2000 and XP with .Net 2.0 > Reporter: Michael Schall > Priority: Blocker > Attachments: MultiThreadedLoggingFailure.patch > > > If multiple threads call the same procedure at the same instance with debug > logging turned on, the logging at the end of ApplyParameterMap will fail. > The StringBuilders for the logging are shared across threads and is failing > when calling ToString. > I suggest making the StringBuilders local to the function as nothing else is > using them anyway. I will include a test patch to make it fail an a patch to > fix the issue. For the test to fail, you have to make sure logging is turned > on! > Thanks > Mike > Failing lines: > _logger.Debug("Statement Id: [" + statement.Id + "] > Parameters: [" + _paramLogList.ToString(0, _paramLogList.Length - 2) + "]"); > _logger.Debug("Statement Id: [" + statement.Id + "] Types: [" > + _typeLogList.ToString(0, _typeLogList.Length - 2) + "]"); > One failing stack trace: > System.ArgumentOutOfRangeException: Length cannot be less than zero. > Parameter name: length > at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 > length, Boolean fAlwaysCopy) > at System.Text.StringBuilder.ToString(Int32 startIndex, Int32 length) > at > IBatisNet.DataMapper.Commands.DefaultPreparedCommand.ApplyParameterMap(ISqlMapSession > session, IDbCommand command, RequestScope request, IStatement statement, > Object parameterObject) in > C:\Projects\Framework\src\IBatisNet.DataMapper\Commands\DefaultPreparedCommand.cs:line > 242 > at > IBatisNet.DataMapper.Commands.DefaultPreparedCommand.Create(RequestScope > request, ISqlMapSession session, IStatement statement, Object > parameterObject) in > C:\Projects\Framework\src\IBatisNet.DataMapper\Commands\DefaultPreparedCommand.cs:line > 84 > at > IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForObject[T](ISqlMapSession > session, Object parameterObject, T resultObject) in > C:\Projects\Framework\src\IBatisNet.DataMapper\MappedStatements\MappedStatement.cs:line > 302 > at > IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForObject[T](ISqlMapSession > session, Object parameterObject) in > C:\Projects\Framework\src\IBatisNet.DataMapper\MappedStatements\MappedStatement.cs:line > 285 > at IBatisNet.DataMapper.SqlMapper.QueryForObject[T](String statementName, > Object parameterObject) in > C:\Projects\Framework\src\IBatisNet.DataMapper\SqlMapper.cs:line 610 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.