login about faq

Hi Chilkat, irregular crashes pop-up in constructor of Email class in v9.4.1 SP1 (ChilkatDotNet45.dll). It seems to be related to multithreaded usage.

Here is the exception message & stacktrace:

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

   at ClsEmail.createNewCls()
   at Chilkat.Email..ctor()
   at ChilkatCrashTest.Crasher.Crash() in c:\Source\My\ChilkatCrasher\ChilkatCrashTest\Crasher.cs:line 13
   at ChilkatCrashTest.Program.<Main>b__0(Crasher lCrasher) in c:\Source\My\ChilkatCrasher\ChilkatCrashTest\Program.cs:line 25
   at System.Threading.Tasks.Parallel.<>c__DisplayClassf`1.<ForWorker>b__c()
   at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   at System.Threading.Tasks.Task.<>c__DisplayClass11.<ExecuteSelfReplicating>b__10(Object param0)
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

The problem can be reproduced (appears NOT always, but with little patience [5-10 runs]) with following "brute-force" code:

class Program
    static void Main(string[] args)
        List<Crasher> lList = new List<Crasher>();
        for (int i = 0; i < 10; i++)
            lList.Add(new Crasher());

        ParallelOptions lOptions = new ParallelOptions();
        lOptions.MaxDegreeOfParallelism = System.Environment.ProcessorCount;
        Parallel.ForEach<Crasher>(lList, lOptions, lCrasher =>
            for (int i = 0; i < 100000; i++)

public class Crasher
    public void Crash()
        Chilkat.Email lEmail = new Chilkat.Email();

In reality it appears one time a month and crashes whole service process. :-(

Any idea?

asked Feb 01 '14 at 17:23

ondrej's gravatar image


Be the first one to answer this question!
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: Feb 01 '14 at 17:23

Seen: 950 times

Last updated: Feb 01 '14 at 17:23

powered by OSQA