Open Workbooks in multi-threading scenario fails from time to time

Hello,

We’ve encountered concurency issues when using Aspose.Cells in a multi-threading environment.

I’ve attached a console application testing “open workbook” operation in a multi-threading scenario: the application starts a number of threads (10) and on all threads at a given moment tries to open a workbook, a different file being used on each of the threads. The issues encountered is that from time to time on some of the threads the workbook could not be opened and crashes with various errors:

- System.ArgumentException: Item has already been added.
- System.IndexOutOfRangeException: Index was outside the bounds of the array.
- System.InvalidOperationException: Hashtable insert failed. Load factor too high. The most common cause is multiple threads writing to the Hashtable simultaneously.

, all of them around the same calls related to a Hashtable:

at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
at System.Collections.Hashtable.Add(Object key, Object value)

I’ve managed to reproduce the issue just by running the application a
couple of times, in the zip file I’ve added the “AsposeIssue.140314.log” log file with the errors encountered.

If needed, you can adjust the no. of threads by changing the MaxThreads int constant and recompile the application.

We are using Aspose.Cells version 7.7.2.0.

Any feedback will be highly appreaciated, as this has a high impact on our product which runs in a multi-threading environment…

Thank you,
Mihai Andrei
Sr Software Engineer
IBM Romania

Hi Mihai,

Thanks for your posting and using Aspose.Cells.

I have tried multiple times but no exception was generated after running your project. I am attaching the log file generated by your program for your reference. I tried with 20 and 30 threads but no exception occurred.

Could you please download and try the latest version: Aspose.Cells
for .NET v7.7.2.3
because we have recently fixed multithreading issue in this version? So your issue should be fixed in it.

Let us know if you still encounter this issue. We will look into it and help you asap.

Hello,

I’ve downloaded 7.7.2.3, recompiled and ran the application, it crashed from the first run, I’ve attached the log file produced.

As additional details, my environment is on 64-bit, 4 CPU cores .

Please investigate further, as per the attached log file the issue it’s still there.

Thank you,
Mihai Andrei

Hi Mihai,

Thanks for your posting and using Aspose.Cells.

I have run your program almost 40 times but it generate the exception only once and I could not make it repeat again. I tried it on 64-bit Windows 7 OS and Visual Studio 2013. I have therefore logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

Could you please also download and try the latest version: Aspose.Cells
for .NET v7.7.2.5
and provide us log at least with 10 iterations.

This issue has been logged as CELLSNET-42471.

Hello,

I’ve recompiled and ran the app with the latest 7.7.2.5. Note that I’ve ran it directly from the file system (bin\debug\AsposeIssue.exe), debugging it from Visual Studio may cause some differences in execution.

Attached is the produced log file, I’ve ran the application 15 times. I have to note that my dev machine is pretty under pressure as it has a lot of dev related applications running…

During these tests I’ve also noticed the Workbook open seems to hang from time to time, as the test app is aborting the thread after 30 seconds of execution. You can see in the logs entries like this one:
2014-03-18 10:43:59,957 [8] DEBUG - Thread abort called for thread dealing with file number: '5’

Thank you,
Mihai Andrei

Hi Mihai,

Thanks for your feedback and using Aspose.Cells.

We have observed your log and it shows lot of exceptions. However, when we run your program on our machine, the exceptions do not occur. I have run it numerous (40-50) times but it always ran successfully and did not generate any exception. I have attached it for your reference.

However, we have already logged this issue for investigation. So, we will analyze these exceptions and their causes and fix them. Once, we will have some news for you, we will update you asap.

Hello,

I understand it’s hard to reproduce, in my previous post I gave the details related to my environment where it reproduces on almost every run.

In your previous post you did say you’ve managed to reproduce it once, so I would say it’s clear it’s an issue within Aspose.

Other hints:
- if your environment is less powerful than mine (74-bit Windows 7, CPU Intel Core i7 Q720 60 GHz, Memory 8 GB), try to run it on a more powerful machine
- add some pressure on your machine, by running heavy CPU and Memory consumption applications, e.g. make a video conversion ?..

Can you please let us know the number for the investigation ticket you
are referring ?, we need to log it in our bug tracking system.

Thank you,
Mihai Andrei

Hi Mihai,

Thanks for your posting and using Aspose.Cells.

I had logged your recommendations to reproduce this issue in our database. It will be helpful in replicating this issue more frequently. Please spare us some time. Once, we will have further update for you, we will let you know asap.

The ticket id is CELLSNET-42471.

Hi,


Could you download and try our latest version/fix: Aspose.Cells for .NET 8.0.0.1

It should fix your issue.

Let us know your feedback.

Thank you.

Hello,

I’ve tested against Aspose.Cells version 8.0.1.0 by using the test console application. I didn’t encountered any more errors, after running the application ~30 times in similar conditions as the previous runs. It seems the issue have been fixed.

Thank you,
Mihai Andrei

Hi Mihai,

Thanks for your feedback and using Aspose.Cells.

We are glad to know that this issue is fixed with the latest version. Let us know if you encounter any other issue, we will be pleased to look into it and help you further.