1. Readify
  2. Neo4jClient

Issues

Issue #70 on hold

TaskCancelledException

Martynas Kazlauskas
created an issue

I am making a pretty long query and getting an exception which occurs pretty randomly.

System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.

--- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Neo4jClient.GraphClient.<>c__DisplayClass3.<SendHttpRequestAsync>b__2(Task`1 requestTask) in c:\TeamCity\buildAgent\work\f1c4cf3efbf1b05e\Neo4jClient\GraphClient.cs:line 149
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Neo4jClient.GraphClient.<>c__DisplayClass1b`1.<Neo4jClient.IRawGraphClient.ExecuteGetCypherResultsAsync>b__1a(Task`1 responseTask) in c:\TeamCity\buildAgent\work\f1c4cf3efbf1b05e\Neo4jClient\GraphClient.cs:line 745
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Neo4jClient.GraphClient.<>c__DisplayClass3.<SendHttpRequestAsync>b__2(Task`1 requestTask) in c:\TeamCity\buildAgent\work\f1c4cf3efbf1b05e\Neo4jClient\GraphClient.cs:line 149
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
---> (Inner Exception #0) System.Threading.Tasks.TaskCanceledException: A task was canceled.<---
<---

Comments (12)

  1. Martynas Kazlauskas reporter

    It's not a nice consistent number. It takes from about 30 seconds to 2 minutes to get the error. I am running Neo4j in a virtual machine and connect to it via bridged connection through local network. I wonder if that could cause anything bad.

  2. Brandon Berry

    I was getting this same thing seemingly "randomly" as well. I'm still trying to nail down some kind of pattern as to what may be going on in my case. I, too, am in a VM but I don't get the impression that's a contributor, my suspicion is something timeout related or potentially a multi-threading issue. Let me know if you find any kind of pattern and I'll do the same.

  3. Dinçer Karaduman

    hi Tatham we are facing this issue now.

    I have tried to investigate this and found this always happens after 100000ms. my stop watch says if a query takes more than 100000ms (100005 ~100150) this exception thrown.

    Waiting for your answer. Thanks.

  4. Tatham Oddie

    Hi @Caraxe, sorry for not replying to this issue, but it just hasn't been on the priority list for me to try and investigate. If you've found the root cause, can you share the solution here?

  5. Dinçer Karaduman

    Sure I can.

    Root cause is default timeout value of System.Net.Http.HttpClient. it is defined as: private static readonly TimeSpan defaultTimeout = TimeSpan.FromSeconds(100.0);

    in Neo4jClient(HttpClientWrapper) HttpClient initiated as: public HttpClientWrapper() : this(new HttpClient()) {}

        public HttpClientWrapper(HttpClient client)
        {
            this.client = client;
        }
    

    for me I set the timeout in constructor. That fixed my case. Maybe a consructor parameter can be used to set timeout period of client.

    This is all. If you need any help just ask.

  6. Log in to comment