title: Stream read error
body: <p>I'm getting this error message under heavy load. Here is code abstract and message from my error log.
  I tried everything I could think of. Any suggestion would be greatly appreciated.</p>
  
  <pre><code>Procedure tCacheInMemory.StreamValue(Name: String; IgnoreCase: Boolean; Var Stream:     TStringStream);
  Var
    i: Integer;
  Begin
    i := 0;
    Try
      If Not active Then
        exit;
      arrayLock.BeginRead;
      Try
        i := Search(Name);
        If i &gt; -1 Then Begin
          If fItems[i].value = Nil Then
            exit;
          fItems[i].value.Position := 0;
          Stream.Position := 0;
          Stream.CopyFrom(fItems[i].value, fItems[i].value.Size);
        End;
      Finally
        arrayLock.EndRead;
      End;
    Except { ...execution jumps to here }
      On E: Exception Do Begin
        x.xLogError('LogErrorCacheInMemory.txt', 'StreamValue:' + E.Message + ' ItemsCount:' + IntToStr( High(fItems)) + 'Memory:' + IntToStr(x.GetMemoryInfoMemory) + endLn + 'StreamSize : ' + IntToStr(fItems[i].value.Size) + ' i=' + IntToStr(i) + 'Name: ' + Name);
        Clear;
      End
    End;
  End;
  </code></pre>
  
  <p>Log Entries:</p>
  
  <pre><code> 3/10/2011 10:52:59 AM: StreamValue:Stream read error ItemsCount:7562 Memory:240816
     StreamSize : 43 i=7506 Name: \\xxxxxxxx\WebRoot\\images\1x1.gif
  3/10/2011 12:39:14 PM: StreamValue:Stream read error ItemsCount:10172 Memory:345808
     StreamSize : 849 i=10108 Name: \\xxxxxxxx\WebRoot\\css\screen.add.css
  3/10/2011 3:45:29 PM: StreamValue:Stream read error ItemsCount:11200 Memory:425464
     StreamSize : 3743 i=11198 Name: \\xxxxxxxx\WebRoot\\JS\ArtWeb.js
  </code></pre>
  
  <p>P.S. </p>
  
  <pre><code>arrayLock: TMultiReadExclusiveWriteSynchronizer;
   fItems: Array Of rCache;
  Type
    rCache = Record
      Name: String;
      value: TStringStream;
      expired: TDateTime;
    End;
  </code></pre>
  
  <p>And calling function:</p>
  
  <pre><code>Function tCacheInMemory.CacheCheck(cName: String; Out BlobStream: TStringStream):   Boolean;
  Begin
  Result := False;
     If Not IfUseCache Then
        exit;
      BlobStream.SetSize(0);
      BlobStream.Size := 0;
      StreamValue(trim(cName), True, BlobStream);
      If BlobStream.Size &gt; 0 Then
      Result := True;
  End;
  </code></pre>
  
  <p>`</p>