login about faq

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


asked Aug 26 '16 at 06:54

maichi's gravatar image


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?


answered Aug 26 '16 at 07:37

TracyP's gravatar image


Hi. I just use lock object for some variable, but I don't think it related. In each thread, I create a new Chilkat.SshTunnel, Chilkat.Http , and Chilkat.HttpRequest. They are not concern to other threads. Moreover, when I run it in a stronger computer(8GB Ram, core i7), this bug not occur.

(Aug 26 '16 at 11:33) maichi

The slower the machine, the more running in the background (i.e. on demand backup software, anti-virus suites, malware protections, etc...), the higher the chance to get an error with threading. Just about any software that has regular I/O with the drive will do.

What are you doing with the information each thread acquires? Does it write to a file, or memory?

(Aug 26 '16 at 12:16) TracyP

I just put result to a listbox (with a lock object ).

(Aug 26 '16 at 14:46) maichi

The listbox is on the UI thread, so you are applying the change at the completion of a background worker? or still in the thread?

(Aug 26 '16 at 15:25) TracyP

Still in thread. I use Invoker to put it to listbox

(Aug 27 '16 at 00:58) maichi

Threads are tricky. Even with the explanation of how to use Invoker found here: http://thebrainyprofessionals.com/2013/03/30/usage-of-methodinvoker-in-c/ It is still possible that the UI object you are attempting to invoke on is not currently available to the thread. It should always be available to the UI thread. The backgroundworker in C# may be a better solution. http://www.dotnetperls.com/backgroundworker

(Aug 29 '16 at 10:30) TracyP
showing 5 of 6 show all

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.


answered Sep 01 '16 at 11:07

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Aug 26 '16 at 06:54

Seen: 1,893 times

Last updated: Sep 01 '16 at 11:07

powered by OSQA