FileNotFoundException in GroupDocs. File.Move call fails sometimes

Hello,

We run into a bug in GroupDocs when creating an index.

Our code is once again very simple:

var index = new GroupDocs.Search.Index(indexDirectory, new IndexSettings { }, overwriteIfExists: false);

index.Add(scanTarget, new IndexingOptions { });

This is the exception, which comes from GroupDocs (maybe a concurrency problem?). We made sure to not create/update the index from multiple threads at the same time…

System.IO.FileNotFoundException: Could not find file 'C:\ProgramData\Test\Indices\T_26\1.temp'. 
File name: 'C:\ProgramData\Test\Indices\T_26\1.temp'
   at System.IO.File.Move(String sourceFileName, String destFileName, Boolean overwrite)
   at .(String )
   at .()
   at .()"

The problem occurs only sometimes. We have no clear repro so far. If we get one, we will post it here.

1 Like

@jamsharp

Using the provided code, we were unable to reproduce this issue on our end.

Please share any additional details you can, such as a screencast or video of the issue, to help us better understand and investigate the problem.

At the moment, we speculate that it is caused by this:

We have this long running operation (let’s just assume, it takes 1 hour)

var index = new Index(index42Directory, indexSettings, false);
index.Add(...)

and we think, that during this, one more index instance was created on a different thread for the same directory:

var index = new Index(index42Directory);

If it was caused by this, it would be a mistake from our side, right?

1 Like

@jamsharp

Yes, it seems that the issue is indeed caused by trying to access the same directory while it is being used by another thread.

Ok. You can close this ticket here.
This was an issue on our side!