REST call 'lost' - need help to track issue down

I have a really strange issue. My server is running on Linux using .NETCore 2.0 the client is Windows 10 and .NET 4.6.1 and I am using ServiceStack 5.0.2

After successful login I retrieve a couple of data which seem to work just fine. Than I retrieve one specific statistic record from MongoDB and this REST call gets a timeout and NEVER arrives at the server.

Now the crazy thing: If I set a break point in the client BEFORE the call gets fired, it works afterwards!!! I experience this since I am running .NET core, on Windows this never happened.

I switched from async to synchronous calls but no difference. I must say, that the server has many threads because I am using ServerSideEvents and Quartz which has a thread pool of a configurable size.

Here is some of my log-output:

From the Client:

2018-05-23 21:19:30.686 +02:00 [DBG] [BizBusLicenseManager.ViewModel.LoginViewModel] [ThreadId 1] Starting login with init client....
2018-05-23 21:19:30.687 +02:00 [DBG] [BizBusLicenseManager.ViewModel.LoginViewModel] [ThreadId 1] AppServer: linuxdev-tbws2, baseURI: http://linuxdev-tbws2:6090
2018-05-23 21:19:30.727 +02:00 [DBG] [BizBusLicenseManager.ViewModel.LoginViewModel] [ThreadId 1]
2018-05-23T21:19:30.7264690+02:00 - Processing secure pwd....
2018-05-23 21:19:30.727 +02:00 [DBG] [BizBusLicenseManager.ViewModel.LoginViewModel] [ThreadId 1] Starting authentication....
2018-05-23 21:19:46.924 +02:00 [DBG] [BizBusLicenseManager.ViewModel.LoginViewModel] [ThreadId 1] Updating properties file ....
2018-05-23 21:19:46.946 +02:00 [DBG] [BizBusLicenseManager.ViewModel.LoginViewModel] [ThreadId 1] 
2018-05-23T21:19:46.9464082+02:00 - Get user and info ....
2018-05-23 21:19:48.005 +02:00 [DBG] [BizBusLicenseManager.ViewModel.MainViewModel] [ThreadId 1] MainViewModel.UpdateAuthStateMessage() called.
2018-05-23 21:19:48.009 +02:00 [DBG] [BizBusLicenseManager.ViewModel.MainViewModel] [ThreadId 1] MainViewModel.InitMainWindow() called.
2018-05-23 21:19:48.054 +02:00 [DBG] [BizBusLicenseManager.ViewModel.MainViewModel] [ThreadId 1] Entered LoadGlobalData()
2018-05-23 21:19:48.056 +02:00 [DBG] [BizBusLicenseManager.App] [ThreadId 1] App.RefreshMessageStatistics(BizBusLicenseAdmin) entered
2018-05-23 21:21:28.324 +02:00 [ERR] [BizBusLicenseManager.App] [ThreadId 1] Failed to get push message stats for user 'BizBusLicenseAdmin'. Exception: System.Net.WebException: Timeout für Vorgang überschritten  
bei System.Net.HttpWebRequest.GetResponse()
   bei ServiceStack.ServiceClientBase.Send[TResponse](String httpMethod, String relativeOrAbsoluteUrl, Object request)

bei ServiceStack.ServiceClientBase.Get[TResponse](IReturn`1 requestDto)
bei BizBusLicenseManager.App.RefreshMessageStatistics(String username) in D:\Projects\BizBusLicenseManager\BizBusLicenseManager\App.xaml.cs:Zeile 134.

The code on the client is:

    public void RefreshMessageStatistics(string username)
    {
        Logger.Debug($$"App.RefreshMessageStatistics({username}) entered");
        try
        {
            var requestDto = new GetMsgStats4User
            {
                UserName = username,
            };
            var stats = LicenseServiceClient.Get(requestDto);
            Logger.Debug($$"Received the following stats: {stats}");
            SetMsgStats(new PushMessageStatistic4User(stats));
            Logger.Debug($$"Message stats for user {username}: {MessageStats}");

            UpdateMessageMenuHeader();
        }
        catch (WebServiceException we)
        {
            Logger.Error($$"Failed to get push message stats for user '{username}'. Exception: {we}");
        }
        catch (Exception ex)
        {
            Logger.Error($$"Failed to get push message stats for user '{username}'. Exception: {ex}");
        }
    }

If I set a breakpoint on the line Logger.Debug... it reaches the service on the server and returns valid data.

Can anybody give me a hint how I can track down this issue further, it is really strange…

Thanks a lot.

If you’re using .NET Core 2.0 try using JsonHttpClient instead of JsonServiceClient.

Hi Demis,
Thanks, didn’t realize that but now found some info in your documentation. However it is still very slow, takes about 10 to 15 seconds to come back!

And I just wonder: Is there something similar regarding ServerEventsClient? Did not see errors so far and heartbeats are constantly sent, just wondering if this has a performance impact as well…

The ServerEventsClient uses .NET HttpWebRequest so is subject to its concurrent connection limit which you can increase by setting ServicePointManager.DefaultConnectionLimit.

Although this should only have an effect when running on the .NET Framework as .NET Core’s HttpWebRequest was rewritten to work on top of HttpClient.