Archived Forum Post

Index of archived forum posts

Question:

Access violation in dotNet lib

Sep 01 '16 at 11:07

Hi I create a program that run multiple thread (40 thread for 40 port forward, from 1801->1840) I follow this example to run each thread. https://www.example-code.com/csharp/sshTunnel_dpf.aspca

I make it for a crawler. When a page finish, close the tunnel and open other tunnel to crawl other page. It work fine for a time. But after that, the below exception thrown. I cannot handle it with AccessViolationException in c#. Exception thrown at 0x5C71A372 (ChilkatDotNet45.dll) in ChilkatAuto.exe: 0xC0000005: Access violation reading location 0x00000778. I had try with other version (x86, x64, dotNet4.0, dotNet4.5, dotNet4.6) but no luck Please fix it or let me know how to hanlde it My machine: Windows server 2012 R2 64bit Xenon X5650 Ram 2GB

Thanks


Answer

There is not enough information to say this is caused by the control. In my experience, when a C0000005 error occurs it causes the stack to be less than reliable.

Since your running multiple threads, if each thread is accessing a single object to record it's findings it may be here that the problem exists. Are you using some type of locking?


Answer

Hi! First make sure you're using the latest version of Chilkat.

Assuming that is the case, does the crash happen when the program is exiting? If so, then create an instance of the Chilkat.Global object and call Global.FinalizeThreadPool just before exiting. (See https://www.chilkatsoft.com/refdoc/csGlobalRef.html )

Another thing you can do is to set the DebugLogFilePath property for a Chilkat object. If using multiple threads, make sure each thread has it's own DebugLogFilePath log file. After the crash, examine the debug log files. A crash within a Chilkat method call would result in an incompleted LastErrorText in the debug log file. (You can set the VerboseLogging property = true to get more details within the debug log file, and thus pinpoint the location of the crash better.)

Assuming this is not helpful, I would need a simple example to reproduce the problem. It's difficult to find/fix the cause of a crash without reproducing the problem.