login about faq

Hello,

using the latest release and very always gets

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at ClsMailMan.DeleteBundle(ClsMailMan , ClsEmailBundle , ProgressEvent* )
at Chilkat.MailMan.DeleteBundle(EmailBundle bundle)

debug file:

DeleteBundle:
    DllDate: Mar  9 2015
    ChilkatVersion: 9.5.0.48
    UnlockPrefix: xxx
    Username: xxx
    Architecture: Little Endian; 64-bit
    Language: .NET 4.5 / x64
    VerboseLogging: 1
    PopCmdSent: DELE 382
    sendCommand: Elapsed time: 0 millisec
    PopCmdResp: +OK Deleted.
    getOneLineResponse: Elapsed time: 0 millisec
    message successfully marked for delete
    PopCmdSent: DELE 383
    sendCommand: Elapsed time: 0 millisec
    PopCmdResp: +OK Deleted.
    getOneLineResponse: Elapsed time: 0 millisec
    message successfully marked for delete
    PopCmdSent: DELE 384
    sendCommand: Elapsed time: 0 millisec
    PopCmdResp: +OK Deleted.
    getOneLineResponse: Elapsed time: 0 millisec
    message successfully marked for delete
    PopCmdSent: DELE 385
    sendCommand: Elapsed time: 0 millisec
    PopCmdResp: +OK Deleted.
    getOneLineResponse: Elapsed time: 0 millisec
    message successfully marked for delete

asked Apr 07 '15 at 06:20

ekapek's gravatar image

ekapek
26559

edited Apr 09 '15 at 13:46

chilkat's gravatar image

chilkat ♦♦
11.8k316358420


link

answered Apr 07 '15 at 09:16

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Already tested, unfortunatelly not

What is more the same exception is with HttpRequest.RemoveParam too

So far I was using ver 9.4.1.0 with success

After upgrading to newest release many problems with System.AccessViolationException

link

answered Apr 07 '15 at 09:21

ekapek's gravatar image

ekapek
26559

The problem with HttpRequest.RemoveParam should've been fixed with the build I just provided you. I suspect it's possible you're not actually using the new build I just provided. Please post the debug log file created via the DebugLogFilePath property (for the DeleteBundle crash).

link

answered Apr 07 '15 at 09:37

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

RemoveParam looks working good - thanks

Now I recive same error with GetEmail

Email email = bundle.GetEmail(j);

Unhandled Exception: System.AccessViolationException: Attempted to read or write
 protected memory. This is often an indication that other memory is corrupt.
   at ClsEmailBundle.GetEmail(ClsEmailBundle* , Int32 )
   at Chilkat.EmailBundle.GetEmail(Int32 index)
   at MyApp.EmailEngine3.<>c__DisplayClass12.<>c__DisplayClass1
7.<Start>b__9(Int32 j)
   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 executionCo
ntext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, C
ontextCallback 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()

I'm processing bundle (that contains 500 mails) with Parallel.For

Parallel.For(0, bundle.MessageCount,
                            new ParallelOptions {CancellationToken = CTS.Token, MaxDegreeOfParallelism = 50}, j =>
                            {
                                CTS.Token.ThrowIfCancellationRequested();

                                Email email = bundle.GetEmail(j);

That exception is random - for testing I'm processing one account many times

Full log from pop3 session is here: https://www.dropbox.com/s/2hgp7unho0d104s/mail.txt?dl=0

link

answered Apr 09 '15 at 03:44

ekapek's gravatar image

ekapek
26559

edited Apr 09 '15 at 08:12

Thanks! This is much better information. I will work on a fix today..

link

answered Apr 09 '15 at 08:04

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

link

answered Apr 09 '15 at 13:48

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Hi, so far no problem with mails, but:

Unhandled Exception: System.AccessViolationException: Attempted to read or write
 protected memory. This is often an indication that other memory is corrupt.
   at ClsHttp.SynchronousRequest(ClsHttp* , XString* , Int32 , Boolean , ClsHttp
Request* , ProgressEvent* )
   at Chilkat.Http.SynchronousRequest(String domain, Int32 port, Boolean ssl, Ht
tpRequest req)
   at MyApp.Submitter.FastEngine.Submit2(String url)
   at CallSite.Target(Closure , CallSite , CodeContext , Object )
   at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site
, T0 arg0, T1 arg1)
   at Microsoft.Scripting.Interpreter.DynamicInstruction`3.Run(InterpretedFrame
frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 a
rg1)
   at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
   at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
   at simpleseobox.Submitter.EngineRunner.<>c__DisplayClass1f.<>c__DisplayClass3
5.<Run>b__1b(String line, ParallelLoopState loopState, Int64 idx)
   at System.Threading.Tasks.Parallel.<>c__DisplayClass32`2.<PartitionerForEachW
orker>b__30()
   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 executionCo
ntext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, C
ontextCallback 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()

Is there chance to solve AccessViolationException issues with this exception in newest version? Or I need to back to 9.4.1

link

answered Apr 13 '15 at 03:54

ekapek's gravatar image

ekapek
26559

Thanks. I would need to see the exact snippet of code that reproduces the problem. It's important to know, for example, if the object is being called in a multi-threaded (parallel) environment. Is the same instance of the Http object called in each thread, or a separate instance? Etc. There's likely an important piece of information I need that isn't being furnished by the stack trace alone.

link

answered Apr 13 '15 at 08:32

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Http object isn't shared - there are always new object created per thread

public bool Submit2(string url)
{
     if (url != null && Uri.IsWellFormedUriString(url, UriKind.Absolute))
        {
            _uri = new Uri(url);
            _req.Path = _uri.PathAndQuery;
        }
        else
        {
            _uri = _formUri;
        }

        _response = _http.SynchronousRequest(_uri.Host, _uri.Port, _uri.Scheme == Uri.UriSchemeHttps, _req);

and:

    private readonly Http _http = new Http();
    private HttpRequest _req = new HttpRequest();
    private HttpResponse _response;

    public FastEngine()
    {
        bool success = _http.UnlockComponent("");
        if (success != true)
        {
            MessageBox.Show("HTTP Unlock Error");
        }

        _userAgent = ConfigStorage.Instance.GetUserAgent();
        _http.SetRequestHeader("User-Agent", _userAgent);
        _http.CookieDir = "memory";
        _http.SaveCookies = true;
        int readTimeout = Convert.ToInt32(Settings.Default.readTimeout);
        _maxContentLength = Convert.ToInt32(Settings.Default.maxContentLength)*1000;
        _http.ConnectTimeout = Convert.ToInt32(Settings.Default.connectTimeout);
        _validContentTypes = Settings.Default.validContentType.Split('\n');
        _http.ReadTimeout = readTimeout;

        _http.HeartbeatMs = readTimeout*1000/2;
        _http.OnAbortCheck += (sender, args) =>
        {
            if (_abort)
            {
                args.Abort = true;
                _abort = false;
            }
        };

and:

Parallel.ForEach(lines, ConfigStorage.Instance.EngineParallelOptions,
                                    (line, loopState, idx) =>
                                    {
                                        try
                                        {
                                            ConfigStorage.Instance.EngineParallelOptions.CancellationToken
                                                .ThrowIfCancellationRequested();

                                            using (var engine = new FastEngine
                                            {
                                                //here code for filling HttpRequest in engine
                                                engine.Submit2(line);
                                            })
link

answered Apr 13 '15 at 08:47

ekapek's gravatar image

ekapek
26559

edited Apr 13 '15 at 08:47

link

answered Apr 13 '15 at 15:07

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

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

Tags:

×184

Asked: Apr 07 '15 at 06:20

Seen: 1,146 times

Last updated: Apr 13 '15 at 15:07

powered by OSQA