Just upgraded to the latest version (4.5.10, from from 4.0.X) and I experience timeouts and hangs. I cannot revert to the 4.0.X version, since we have customer nugetr packages depening on SS > 4.5.8.
We are experiencing weird behaviour on JsonServiceClient which starts to hang after 5 calls. When I restart the process, the same happens. Note that this only happens when there is more than 1 machine invloved. When I run locally, everything works fine.
I managed to pinpoint the issue to ServiceClientBase.cs, where it calls into
The specific method is this:
protected virtual WebRequest SendRequest(string httpMethod, string requestUri, object request)
return PrepareWebRequest(httpMethod, requestUri, request, client =>
using (var requestStream = PclExport.Instance.GetRequestStream(client))
Since there are multiple concurrent calls going on, I managed to pause the running instance and I see 2 threads stuck on this:
Which corresponds to the same line.
As soon as this hits, I need to stop the service and restart. But, after 5 consecutive calls, it is the same. Please advise how to fix this, since this will prevent me from a go-live at a customer.
When the JsonServiceClient hangs it usually means there's a HttpWebResponse that's not being disposed somewhere, this can silently happen when sending a POST/PUT request to a Request DTO that doesn't have a IReturn interface as it will return a HttpWebResponse (since it doesn't know the Response) which needs to be disposed. These APIs are obsolete so check your warnings to make sure you're not using any deprecated Service Client APIs, if you are adding an IReturnVoid to the Request DTO will change it to use an API that disposes the Response.
If the issue persists can you create a small stand-alone repro we can run locally to see it.
Thx for the response. I believe it has to do with the IReturnVoid that was lacking I am testing this now.
The IReturnVoid was missing and this caused the issue. Is there any way to enforcing this as a requirement? Any DTO used with a ServiceClient should require an IReturn* interface
Nothing built-in, but you could add some code that goes through each Request DTO in an AfterInitCallbacks that goes through Metadata.RequestTypes to check they each have an IReturn* interface.
In the next major v5 release well be removing these deprecated APIs so you'll get a build error if using an API that silently returns a HttpWebResponse.