Idle webservices connection disconnected after 5 minutes - web-services

I have a C# application that connects to a JAX-WS webservices endpoint hosted on an embedded tomcat server.
Something is disconnecting the client after exactly 5 minutes of inactivity and I cannot for the life of me work out what's doing it.
I've set server.tomcat.connection-timeout=-1 and server.tomcat.keepAliveTimeout=-1.
session-timeout in web.xml is set to 30 (minutes) and I've checked that the same value is being passed to HttpSession#setMaxInactiveInterval(int).
Nothing is written to the server logs even at TRACE level when a client connection is closed.
I can remotely debug the application server but not sure where to start digging?

After getting the client and server running locally I found the culprit - the keep-alive connection wasn't being closed by the tomcat server it was being closed by a reverse proxy.

Related

Shiny Websocket Idle Timeout

I'm running a shiny app using the command:
shiny::runApp("./app",8080,FALSE,"0.0.0.0")
The app works fine but when running it behind a load balancer the websocket connection gets dropped after 60 seconds because neither the client (web browser) nor the server are sending data. This is due to an unchangeable timeout in the load balancer. Is there some way to get shiny to send a heartbeat message over the websocket every n seconds? Has anyone an idea how to solve this question?

WebRequest timed out in windows service

I use WebRequest in a client to consume a web service on Internet. Each request is triggered in a separate thread.
It works well if hosting the client in IIS. But most of the requests will get timed out error if the client is hosted in a windows service.
When I tried to debug the problem using Fiddler, the WebRequest worked well as all traffic went through 127.0.0.1:8888
Without Fiddler, the traffic goes to Internet directly through a random port, and the time out problem hits again.
The windows service runs under Local System account.
Why do I get time out if the client is in windows service without using a proxy?
Update: My original question wasn't clear. The requests are made concurrently (or at a very short interval). This is to do with the connection limit in the ServicePoint class. By default only 2 connections are allowed to the same external destination. If the destination is local, the limit will be int.Max value. That's why fiddler can magically fix the problem with the proxy. So I manually set the DefaultConnectionLimit to 100 and the requests are on wire.
Adjusting HttpWebRequest Connection Timeout in C#
The most common source of problems that is "magically" fixed by running Fiddler is when your .NET code fails to call Close() on the object returned by GetResponseStream(). See http://www.telerik.com/automated-testing-tools/blog/13-02-28/help-running-fiddler-fixes-my-app.aspx for more details.

Check remote host state in a nework using Indy comps

I have client server application that works with Firebird server. Everytime when clients connect to the server they(client apps) don't check if there is a network connection to the server so at this time my application sometimes freezes when the server computer is switched off or service has stopped, so first of all I need to check connection if remote host is switched on or at some port anything listening....
Before establishing the connection I need to check it and make sure server and service is running using Indy components.
Any ideas? also I can use IcmpClient to ping remote host and then establish connection but which is the most optimal way ?
If you just want to check if the server computer can be reached, you could do a "ping" to check that. However, if you want to check if a specific TCP port is open, then the only way to find that out is to actually do a proper connect, which leads to the "freezing" program while the connection times out if there is no-one listening on that port.

How would Zeus(load balancer) handle the closed connection

Currently, we run into one problem with timeout issue. Our application is based on Jetty and uses Zeus as load balancing. The maxIdleTime is set as default value 30000 in jetty.xml. When a request/connection exceeds 30 seconds, the connection status will change to TIME_WAIT, but we get the HTTP 500 Internal Error in the browser side.
I guess the HTTP 500 error comes from Zeus but I want to confirm this: how would Zeus handle the closed connection?
OR
The jetty service sends 500 to Zeus? If so, how can I confirm this?
The surefire way to iron out what is happening here is to sniff the packets using something like ethereal or tcpdump between the load balancer and the jetty server, and you can use the network tooling in something like firebug or the chrome developer tools to see what is happening on that side of the connection. You can also turn on debug on the jetty side to see what it is doing specifically.
Regardless, if your hitting your timeout settings then you need to either increase those settings or decided on a proper strategy to deal with them to avoid this sort of issue, assuming you don't want that 500 error on the browser.

Windows service running on Windows Server 2003 cannot call an xml web service on the same machine

I have an XML web service running on my Windows 2003 server. I have a windows service running on the same machine. I want to call the XML web service from the windows service.
This works fine on my development machine, which is running Windows XP. However, when I try to do this on my Windows Server 2003 box, it times out and throws an exception. My windows service catches the exception and writes it to the eventlog. This is how the error shows up in the event log :
The description for Event ID ( 0 ) in Source ( myWS ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event:
Exception in MyWS service : [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 [MY IP ADDRESS HERE]
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetRequestStream()
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at TesterClient.Test() in C:\Projects\Odyl\OdylUtilities\MyWS\TesterClient.cs:line 30
at MyWS.MyWSWindowsService.DoMyWSService() in C:\Projects\Odyl\OdylUtilities\MyWS\MyWSWindowsService.cs:line 81
at MyWS.MyWSWindowsService.StartService() in C:\Projects\Odyl\OdylUtilities\MyWS\MyWSWindowsService.cs:line 45].
As you can see, it has some problem with writing to the eventlog (all that AUXSOURCE stuff), but the main problem is that it's getting a timeout error from the web service.
Here's the truly odd thing, though -- from my dev box (running XP), I can call the web service that's running on my Windows 2003 Server box. This is really perplexing -- obviously the web service is working fine, but for some reason, Windows Server 2003 will not let you call a web service from the same machine!
Can anybody please give me a hint as to what's going on?
This sounds like a networking issue related to your Win2K3 server. The network configuration is preventing it from accessing the service url at the given location.
Easiest way to troubleshoot this: RDP to the Win2K3 Server desktop and open up a web browser to connect to the web service. I expect you will get a timeout.
Easiest way to remedy this: if there is a URL to the service that works locally, i.e. localhost, try that from your service. Otherwise, be prepared to get your network administrator involved to understand the DNS settings necessary to support the URL path you want to use for your service.