OverflowException: Arithmetic operation resulted in an overflow

Hello,

Unfortunately, we experienced an exception when one of our customers dealt with many (and maybe larger) files that they wanted to add to the index.

We got the exception via this event:

pIndex.Events.ErrorOccurred += OnFileAddingErrorOccurred

It was probably triggered during this call, but maybe also during the Optimize() call…

pIndex.Add(...)

The exception:

System.OverflowException: Arithmetic operation resulted in an overflow.\r\n   at \u0008\u0017\u0003.\u0003(Int32 \u0002)\r\n   at \u0008\u0017\u0003.\u0002(String \u0002, Int32 \u0003)\r\n   at \u0002\u001A\u000F.\u0002()\r\n   at \u000F\u0017\u0010.\u0002(\u0002\u0010\u000F \u0002, \u0008\u0010\u000F \u0003)\r\n   at \u0006\u0017\u000F.\u0002\u0016\u000F\u0016\u0005\u0003()\r\n   at \u000F\u0017\u0010.\u0002(\u0003\u0005\u0005 \u0002, \u0003\u000F\u0005 \u0003, \u000F\u0018\u0010 \u0005, \u000E\u0003\u0017 \u0008)\r\n   at \u0003\u001A\u000F.\u0002(Boolean \u0002, Int32 \u0003, \u0003\u0005\u0005 \u0005, \u0003\u000F\u0005 \u0008, \u000F\u0018\u0010 \u0006, OperationType \u000E)

(once again with unescaped charaters):

System.OverflowException: Arithmetic operation resulted in an overflow.
   at .(Int32 )
   at .(String , Int32 )
   at .()
   at .( ,  )
   at .()
   at .( ,  ,  ,  )
   at .(Boolean , Int32 ,  ,  ,  , OperationType )

Some time after that exception, we also got this exception from the same error event. I highly assume that they are related (e.g. one causes the other):

System.ObjectDisposedException: Cannot access a closed file.\r\n   at \u0003\u0005\u0010.\u0002\u0005\u0010\u0016\u0005\u0002(Byte[] \u0002, Int32 \u0003, Int32 \u0005)\r\n   at \u0006\u0018\u000F.\u0002()\r\n   at \u0006\u0018\u000F.\u0005()\r\n   at \u0003\u0016\u000F.\u0002(String \u0002, String \u0003)\r\n   at \u0003\u0016\u000F.\u0002(\u0002\u0005\u0005 \u0002)\r\n   at \u0006\u0017\u000F.\u0002(Document \u0002, IFieldExtractor \u0003, String \u0005, IWordSplitter \u0008)\r\n   at \u0006\u0017\u000F.\u0002(Document \u0002)\r\n   at \u0006\u0017\u000F.\u0002()

(once again with unescaped characters):

System.ObjectDisposedException: Cannot access a closed file.
   at .(Byte[] , Int32 , Int32 )
   at .()
   at .()
   at .(String , String )
   at .( )
   at .(Document , IFieldExtractor , String , IWordSplitter )
   at .(Document )
   at .()

Unfortunately, we don’t know how to reproduce this. Maybe, with large files or many files… We hope that you are able to track the problematic location via the call stack we provided.


I know, I just reported multiple exceptions, but this one is currently the most critical for us…

@jamsharp
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SEARCHNET-3516

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hello, any updates here?

Do you know what causes this?

@jamsharp

This ticket is still under investigation. We’ll notify you as soon as we’ve any update.

Hello,

I think, we all do generally benefit from getting behavior like this one fixed in GroupDocs.Search. But we are wondering: If we bought the paid support, what would be your estimation, how quickly this bug could be fixed and which level of support would we need?

Best regards
jamsharp

@jamsharp

This issue is still under investigation. As a temporary solution, try adding the following code immediately after creating the index instance.

Index index = new Index(indexFolder, settings, true);
int[] range = Enumerable.Range(0x3300, 0x33FF)
    .Concat(Enumerable.Range(0xFE30, 0xFE4F))
    .Concat(Enumerable.Range(0xF900, 0xFAFF))
    .Concat(Enumerable.Range(0x2F800, 0x2FA1F))
    .Concat(Enumerable.Range(0x2E80, 0x2EFF))
    .Concat(Enumerable.Range(0x31C0, 0x31EF))
    .Concat(Enumerable.Range(0x3000, 0x303F))
    .Concat(Enumerable.Range(0x4E00, 0x9FFF))
    .Concat(Enumerable.Range(0x3400, 0x4DBF))
    .Concat(Enumerable.Range(0x20000, 0x2A6DF))
    .Concat(Enumerable.Range(0x2A700, 0x2B73F))
    .Concat(Enumerable.Range(0x2B740, 0x2B81F))
    .Concat(Enumerable.Range(0x2B820, 0x2CEAF))
    .Concat(Enumerable.Range(0x2CEB0, 0x2EBEF))
    .Concat(Enumerable.Range(0x30000, 0x3134F))
    .Concat(Enumerable.Range(0x31350, 0x323AF))
    .ToArray();
index.Dictionaries.Alphabet.SetRange(range, CharacterType.Separator);

You will get priority support and the issue will be escalated to priority. Please learn more about our paid support.

@jamsharp

As this issue is under investigation, we need some more information:

  • API version
  • Target platform (e.g. .NET 8, .NET 4)
  • Number of documents in the index

As far as I know, it was version 25.2.

Target platform: .Net 9

I cannot recall the exact number of documents in the index, sorry. Either, there were 1k to 50k or there were few, because the exception prevented them getting added to the index.

1 Like

@jamsharp

Thanks for the details. We’ll notify you in case of any update.