botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

[WebChat] Getting 503 (Service Unavailable) and 502 (Bad Gateway) errors?

Open ThisIsColinB opened this issue 8 years ago • 10 comments

Bot Info

  • App ID: 62a3f1ae-f10a-43f4-ac70-d2c22b3f69a5
  • SDK Platform: .NET
  • SDK Version: 3.8.5
  • Active Channels: WebChat
  • Deployment Environment: Azure App Service

Issue Description

Webchat responses/requests seem to be significantly slower than before. Started experiencing this a couple hours ago. No code change, this just started happening all of a sudden. Every 2nd or 3rd request causes 503/502 errors. This causes the webchat responses/request to be extremely delayed or not work at all.

webchaterror

Reproduction Steps

  1. Start conversation (say hi)
  2. Request expected option (ex: printer)
  3. check console in dev tools in browser to check for error.

Expected Behavior

WebChat should respond with expected response (a link) within 3-5 seconds.

Actual Results

Will occasionally work as expected, most of the time it says the request timed out, or "couldnt send, retry", but it actually does send, just takes 20-30 seconds. So in summary, sometimes the requests go through but take much longer than expected. And sometimes they don't make it through at all and throw 503's and 502's.

couldntsend

Let me know if you require further information. Thanks.

ThisIsColinB avatar Dec 11 '17 16:12 ThisIsColinB

+1 We are experiencing the same issue basically. It usually only starts to happen for us when the app is under 'load' i.e. 5 or more concurrent users. Which I would not really call much load. This is via our DirectLine integration.

Here are some logs from AppInsights:


System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond XX.XXX.XX.XXX:443 at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) --- End of inner exception stack trace --- at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar) --- End of inner exception stack trace --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Rest.RetryDelegatingHandler.<>c__DisplayClass11_0.<b__1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Rest.RetryDelegatingHandler.d__11.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Connector.JwtTokenRefresher.d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.Bot.Connector.BotState.d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Connector.BotStateExtensions.d__7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Atura.BotSite.Controllers.MessagesController.d__5.MoveNext() in d:\a\1\s\Bla\Bla.BotSite\Controllers\MessagesController.cs:line 71


E.g. calls:

https://state.botframework.com/v3/botstate/directline/conversations/CUgSMYbMPqJFakLhjfFFVe https://state.botframework.com/v3/botstate/directline/conversations/HGUEVFqYOM0JkVuxd4cPyM https://state.botframework.com/v3/botstate/directline/conversations/4ifUN0DCpUc8u71Ml826Bz


Dependency duration:

4:17:46 PM | Dependency | 42.04 sec@RD0003FF559E4E /v3/botstate/directline/conversations/4ifUN0DCpUc8u71Ml826Bz


Time 4:17:51 PM Duration 21.02 sec Outgoing Command /v3/botstate/directline/conversations/HGUEVFqYOM0JkVuxd4cPyM https://state.botframework.com/v3/botstate/directline/conversations/HGUEVFqYOM0JkVuxd4cPyM


Time 4:18:10 PM Duration 42.04 sec Outgoing Command /v3/botstate/directline/conversations/2nHCblRjz4l83uIKPRgw7T https://state.botframework.com/v3/botstate/directline/conversations/2nHCblRjz4l83uIKPRgw7T

JPThorne avatar Dec 13 '17 14:12 JPThorne

Have you implemented a custom state service or are you both using the default @ThisIsColinB @JPThorne. Also are you load testing directline or are you following this guide

JasonSowers avatar Jan 08 '18 23:01 JasonSowers

@JasonSowers thanks yep that was the case as identified on a separate issue as well. We were still using the default state client. Only saw that blog post from you guys recently.

JPThorne avatar Jan 09 '18 06:01 JPThorne

Worth mentioning, @JasonSowers to be fair the 'load' was only 5 concurrent users over a period of 2 minutes. Hardly what I'd call real load.

JPThorne avatar Jan 09 '18 10:01 JPThorne

503 (Service Unavailable) issue occurs on WebChat as well as DirectLine. Often (once in a 5 to 6 messages) there is a delay receiving message from BotFramework to the backend

Bot Info

  • SDK Platform: Node.js
  • SDK Version: 3.11.0
  • Active Channels: Direct Line, WebChat
  • Deployment Environment: AWS

Issue Description

503 /v3/conversations/88YzQf6Cdk7G2Uv6R2omhb

The delay from Botframework is upto 8 seconds. time

preetham avatar Jan 18 '18 09:01 preetham

+1, getting this on webchat also. No load, one user, but bot was left idle. Sending a message to bot stops the errors occurring for approx 3 minutes.

Only happening since upgrading from botbuilder 3.11.0 to 3.13.1

stoconnor avatar Jan 19 '18 15:01 stoconnor

@stoconnor Issue resolved when custom storage for state data was implemented. I don't know how these are connected but that resolved the issue for me

preetham avatar Jan 20 '18 06:01 preetham

@kamidipreetham thanks, I moved to CosmosDB for bot storage. Issue looks to be resolved for me also

stoconnor avatar Jan 22 '18 16:01 stoconnor

+1 I also have this issue. My applicatie is succesfully deployed en I created a Web App Bot. The default messaging endpoint works fine but when I changed it to my own messaging endpoint of mijn applicatie. something likes this: https://Your_Application_Name.azurewebsites.net/api/messages, then it didnt work any more. It gave also a 505 bad gateway error. Do I need some dependency injection in my code? I'm using bot framework v3 version Can someone help me?

pancongying avatar Dec 14 '18 13:12 pancongying

Hi @pancongying

This is a closed issue, and this repository is only taking DCRs. If you are still struggling with this issue, please ask a question on StackOverlow. If you believe this is a bug in the SDK, please direct the issue to the V3 repository: https://github.com/Microsoft/BotBuilder-V3/issues/new/choose Also, please provide more information. Such as the actual endpoint you are trying to use along with your bot's handle and Microsoft App Id.

EricDahlvang avatar Dec 14 '18 17:12 EricDahlvang