Posted on 20/04/2021 05:48:30
Hi Dmitrij,
Interesting. That sounds like some progress on tracking it down. I didn't fully understand a couple of your tests. Let me explain what I see on my end, and what I understand from your testing, and you can let me know what I'm missing.
First, the various timeouts that I'm aware of:
- Scheduled task - the one that we're using is set to timeout at 6 minutes. If I reduce the timeout on the scheduled task so that it's the first to timeout, the error message is: "Log: Timeout error communicating with server. System.TimeoutException: …The request channel timed out while waiting for a reply after 00:00:05.9979925. "
- ScriptTimeout setting. By default, the scheduled task runner itself has a 30 minute timeout. I have a customized build that lets me extend it, and it's set to 60 minutes right now. Here's the branch which I'm waiting for approval and I'll create a pull request for it. Here's the link to it. If this timeout is reached first, the error message is: "Unknown error communicating with server. System.Threading.ThreadAbortException: Thread was being aborted."
- The Mocking endpoint. It's currently set with a timeout of 5 minutes (300000 milliseconds).
- Web.config's executionTimeout. Currently it's set to 5 minutes (300 seconds), but I haven't found that this impacts my testing.
- I'm not using NAV, but I'm using a custom connector that we call MockingConnector. The endpoint is set to 5 minutes, and I'm not aware of a timeout setting on the connector itself. You mentioned changing the timeout in the NAV settings, but I don't believe that it would come into play since it's our custom mocking connector with a 5 minute timeout.
When testing, here's what I find:
- When visiting https://qa2-drteeth.mydwsite1.com/Admin/Public/TaskExecute.aspx from Chrome, Firefox, or Edge, this will complete in 5 minutes, which is the time it takes to run the long running task. It will show a message that it has completed, and how long it took.
- If you visit the same link in Internet Explorer, it doesn't time out at all. It seems to run forever.
- If you visit the same link from PowerShell, it also doesn't complete in the 5 or 6 minutes. I believe that it will wait for the 3 days in the scheduled task's settings.
- In the case of Internet Explorer or PowerShell, the log for the scheduled task shows that it completed at 5 minutes, even though IE and PowerShell appear to never end.
If the Mocking endpoint is set to 4.5 minutes, then, even in Internet Explorer or the PowerShell Invoke-WebRequest, it will complete at 4.5 minutes. So, my conclusion is that both Internet Explorer and Invoke-WebRequest have a 5 minute timeout somewhere such that if the 5 minutes are reached, it essentially hangs, and never completes.
I just created a new mocking endpoint for you to set for 4.5 minutes: <GetEcomData Qty="10" ><tables><Products45 type="all" /></tables></GetEcomData>. You can use that to see how it does end at 4.5 minutes correctly when using that endpoint.
What you mentioned above is very interesting. You mentioned the 30 minute timeout. That sounds like the 30 minutes within the scheduled task runner. I've extended mine to 60 minutes, but if you are testing on your own site, then it would be 30 minutes.
So, my question is what you did to achieve the 30 minute timeout. Is that on your own site with your own scheduled task? I would have expected that to complete at the 5 minute mark, unless that scheduld task has a similar result as Internet Explorer or PowerShell. How can I reproduce the 30 minute timeout?
> You said: I've got it reproduced using your service, but it looks like the request to it never ends (not finishes at 5 min)
That's my exact problem. I have an endpoint that will time out at 5 minutes, but using IE or PowerShell, it doesn't end at 5 minutes. What I would like to achieve is for IE or PowerShell to end correctly at the 5 minute timeout of the Mocking endpoint.
> You said: What is the reason to have an endpoint that has no response?
Good question. The whole reason for this exercise is that we're seeing sites with longer running pages having issues with the scheduled task runner. It never ends, so it never runs the regular 5 minute run, causing all of the scheduled tasks to appear as if they are stuck. So, with the mocking endpoint, I'm able to simulate the problem situation.
I realize this is a lot of info, but hopefully it gives some clues.
Thanks again for looking into this!
Scott