Issue #70 on hold

TaskCancelledException

Martynas Kazlauskas avatarMartynas 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 (11)

  1. Martynas Kazlauskas

    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. 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.

  5. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.