kdcllc / CometD.NetCore

CometD for use with Salesforce Platform Events
MIT License
28 stars 16 forks source link

Timeout value in LongPollingTransport.GetRequestStreamCallback #3

Closed search4sound closed 4 years ago

search4sound commented 5 years ago

This project is awesome but one thing is that I'm getting timeouts followed by re-subscribe (ReceiveMeta/SendMeta) logged to the console. Timeout exception is:

System.Net.WebException (HResult=0x80131509) Message=The operation has timed out. Source=System.Net.Requests StackTrace: at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at CometD.NetCore.Client.Transport.LongPollingTransport.GetResponseCallback(IAsyncResult asynchronousResult)

Looking at the call stack, this appears to be called from LongPollingTransport.GetRequestStreamCallback(IAsyncResult asynchronousResult), where there is a constant timeout of 2 minutes.

What is the thought behind choosing 2 minutes? Any thought to allowing passing a timeout value as a parameter, perhaps as part of SalesforceConfiguration?

Thanks.

In case it helps, here is what my log looks like...

ReceiveMeta: {"clientId":"****","channel":"/meta/connect","id":"3","successful":true} SendMeta: {"channel":"/meta/connect","connectionType":"long-polling","id":"4","clientId":"****"} dbug: LongPollingTransport[0] Send: [{"channel":"/meta/connect","connectionType":"long-polling","id":"4","clientId":"****"}] System.Net.WebException: The operation has timed out. at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at CometD.NetCore.Client.Transport.LongPollingTransport.GetResponseCallback(IAsyncResult asynchronousResult) ReceiveMeta: {"id":"4","successful":false,"channel":"/meta/connect","message":[{"channel":"/meta/connect","connectionType":"long-polling","id":"4","clientId":"****"}],"exception":{"ClassName":"System.Net.WebException","Message":"The operation has timed out.","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":" at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)\r\n at CometD.NetCore.Client.Transport.LongPollingTransport.GetResponseCallback(IAsyncResult asynchronousResult)","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":null,"HResult":-2146233079,"Source":"System.Net.Requests","WatsonBuckets":null}} SendMeta: {"channel":"/meta/connect","connectionType":"long-polling","advice":{"timeout":0},"id":"5","clientId":"****"} dbug: LongPollingTransport[0] Send: [{"channel":"/meta/connect","connectionType":"long-polling","advice":{"timeout":0},"id":"5","clientId":"****"}] ReceiveMeta: {"clientId":"****","advice":{"interval":0,"timeout":110000,"reconnect":"retry"},"channel":"/meta/connect","id":"5","successful":true} SendMeta: {"channel":"/meta/connect","connectionType":"long-polling","id":"6","clientId":"****"} dbug: LongPollingTransport[0] Send: [{"channel":"/meta/connect","connectionType":"long-polling","id":"6","clientId":"****"}]

kdcllc commented 5 years ago

@search4sound I will take a PR for this issue, I think to have the ability to set the timeout is helpful.