-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System.AccessViolationException #39
Comments
Are you using the code single or multithreaded? |
No response ... closed |
I was using the code multithreaded, but all the objects that get the document stream and then use the FilterReader were created on the same thread. The only I spent the last day and a bit taking all the async code out and letting it run. No errors or issues so far. No idea what could have been making it thread unsafe. |
The code inside IFilterTextReader has parts that are not thread safe. Something I want to fix in the near feature. |
Looking at my logs from last night, I have found that there still seems to be some
I'm kind of just stabbing in the dark here. I've tried locking the stream and the reader and using |
Was there any solution to this? I am experiencing the same thing. Randomly happens. Seems most often with .doc. but a document working one time does not work Another. Run in a separate thread but syncronosly. |
This is my current solution until it gets fixed. Quite ugly and probably has ramifications that I haven't thought through well enough, but it seems to work for me. There are some parts that are probably not required, like the locks, but as they say, "If it ain't broke, don't fix it"
Since I never had one specific document that would fail constantly, the class above tries to retrieve the text 10 times on I use this class as follows: Hope this works alright for the time being. If you come up with a better solution, please let me know here. |
Hi, Thank you so much for sharing! My problem is that the errors takes down my whole application. |
Read about it here: https://docs.microsoft.com/en-us/dotnet/api/system.runtime.exceptionservices.handleprocesscorruptedstateexceptionsattribute?view=netframework-4.8
|
Thank you! I read in the mean time. I did not know about this, but it saves me a a lot of problems. Gold star and a big thank you! |
and... totally irrelevant, but hey, it is Corona times, a lot of things feels irrelevant. Love Australia. Like my second home from Sweden. Stay safe. |
@Sicos1977, has there been an update to fix this issue? |
I have no idea where to look for this so also no idea how to solve this. I need a good crash report to investigate this. |
I change the code a little bit, I added some code to free the pointer. So get the latest code from GitHub and see if this solves the problem. var valuePtr = IntPtr.Zero;
try
{
var valueResult = _filter.GetValue(ref valuePtr);
CheckResult(valueResult);
switch (valueResult)
{
case NativeMethods.IFilterReturnCode.FILTER_E_NO_MORE_VALUES:
case NativeMethods.IFilterReturnCode.FILTER_E_NO_VALUES:
_chunkValid = false;
break;
case NativeMethods.IFilterReturnCode.S_OK:
case NativeMethods.IFilterReturnCode.FILTER_S_LAST_VALUES:
var temp = GetPropertyNameAndValue(valuePtr);
if (!string.IsNullOrEmpty(temp))
{
textBuffer = temp.ToCharArray();
textLength = (uint) textBuffer.Length;
textRead = true;
}
_chunkValid = false;
break;
}
}
finally
{
if (valuePtr != IntPtr.Zero)
Marshal.Release(valuePtr);
} |
I just released IFilterTextReader 1.6.6 to nuget. |
Please let me know if this makes any differences |
I'll do some testing when I get a chance and get back to you. Thank you very much for the update . |
And? |
If you can produce a memory dump at the time of the crash I'd be happy to look into it. Windows has feature to generate the memory dumps on application crash, it can be enabled in registry. Additionally, we have analyzed 3 AV crashes from our customers in the last 2 days. Two of them have the same underlying cause (#41), the third one is different crash with the same Office filter that was reported to Microsoft (https://aka.ms/AA8lcfh). |
I have recently started using IFilterTextReader to extract the text from all files in a document management system. I have created a windows service to get each document's byte array through a web service and process it.
I'm having a problem where I get a
System.AccessViolationException
at random times and my Windows Service just terminates.I thought it was some of the documents at first, but the document that it broke on gets processed when I start the service back up again.
Here is the Stacktrace.
AccessViolationException.txt
Any idea what might be happening here?
The text was updated successfully, but these errors were encountered: