I have an OSB application that communicates with a web service. I'm sending requests with the test console. The result returned to the test console is empty. How can I increase the time while the application is waiting for a response?
There are two parameters for connection. Connection Timeout & Read Timeout. Make sure, you are putting these value optimal.
(1) Connection Timeout - Timeout for making TCP connection to end-point. (usually 2 sec to 5 seconds.)
(2) Read Timeout - Timeout for getting & reading response from server/endpoint after successful TCP connection. (This should be based on SLA for interface contract.)
Thanks, Anil
If you want to increase business service response timeout, in OEPE (Eclipse).
Please select that Business Service -> HTTP Transport -> (Read Timeout or Connection Timeout).
Update it to appropriate value.
By default its value 0 (zero), means no timeout.
Related
We have a server that allows thousands of TCP connections to connect on port 52999 and exchange data. Each connection has its own thread. So there are thousands of threads.
If I keep the ThreadPool's default setting of minimum connections, the server can only accept two connections per second. When there were 200 connections waiting to be accepted by the server, it took more than a minute. Most of the connections timed out.
So I did this:
ThreadPool.SetMinThreads(5000, 1000);
After I did this, the server was able to accept 20 connections per second.
Initially, the TCP server was started in Global.asax.cs in an ASP.NET MVC server on IIS. Everything was fine.
Then I decided to let the TCP server run as a Windows Service. Once I changed over, ThreadPool.SetMinThreads returned false.
Why?
I try to use influxDB to save some monitor data. I started influxDB with default configuration and used python to write some test data through HTTP API in my own mac, everything going well in the beginning. But I encountered a ConnectionError every time after I wrote some data. My test code is
for event_id in xrange(0, 100000):
requests.post("http://127.0.0.1:8086/write?db=mydb", data="test_a,event={0} value=100 1538841600000000000".format(event_id))
After about 16300 executions, an error will be reported.
HTTPConnectionPool(host='127.0.0.1', port=8086): Max retries exceeded with url: /write?db=mydb (Caused by NewConnectionError("<urllib3.connection.HTTPConnection object at 0x110a5fb10>: Failed to establish a new connection: [Errno 49] Can't assign requested address",)
And then, I should wait about 2 seconds before I write new data.
My OS is MacOS 10.14, and all data is saved in an HDD hard disk.
influxDB version is vv1.6.4 (git: master c75cdfdfa6f71a08473fefcec71f6cbcbdef1ff4)
Is influxDB doing some tidying up?
OK, I found the reason, because this API is HTTP protocol and requests use TCP connection to send HTTP request, so every time a request finished, the TCP connection not closed, it will goto TIME_WAIT and wait a timeout before close. So the port resource of my OS are exhausted......
I have a Windows Service that works with an advantage database and occasionally makes some http calls. On rare occasions these calls can be very long. To the tune that my database connection times out. I'm not using a Data Module or anything. Just creating the connection manually.
My primary question is what usually prevents the connection from timing out if I just haven't used it in a while? Do the TAdsComponents send a keep alive message that gets called in the background somehow? Is that dependent on the vcl so I don't have that in my service? Somehow I feel like creating a thread to make my http call, and in the main thread checking for it to finish every few seconds would prevent the connection from dying. Is that ever true?
Yes, there is a keepalive mechanism as you expect. The client (for all communication types, TCP, UDP, Shared memory) sends a "ping" to the server every so often to let the server know that connection is still alive. The frequency of that keepalive ping is based on the server configuration parameter CLIENT_TIMEOUT. With the default settings, I believe the keepalive ping is sent every 30 seconds.
The keepalive logic runs in a separate thread that is started by the code that handles the communication. In other words, it does not depend on any of the VCL components; if you have a connection to the server, then that thread should be running.
One way to check if your connections are timing out is to look in the Advantage error log. There should be 7020 errors corresponding to timed out connections.
Some things that come to mind that might result in timed out connections include:
The client process being suspended for some reason so that the keepalive thread could not run. This seems unlikely.
The keepalive thread was killed for some reason. This also seems unlikely; you would have to go out of your way to make this happen.
A firewall may close the connection if there is no activity for a time. I would think, though, that a 30 second interval would be sufficient to prevent that.
A firewall may disallow the UDP keepalive packets. Firewalls, by nature, are "suspicious" of UDP packets. You might make sure you are using TCP/IP.
I am using TClientSocket and TServerSocket to comunicate with a server the problem is that sometimes connection is lost either by the server issuing me the following exceptions : Error on WsaSend, acess violation etc or by the Client : Asychronious socket error.
Witch is the best method to recover from these errors and keep the connection open no mather what ?
There is no such thing as "keeping the connection open no matter what". What if the cable gets cut? The best you can do is to send a heartbeat on some interval to let intermediate routers know you are still interested in using that connection, and to carefully handle all errors, and, if necessary, re-establish the connection.
Great question... what you're receiving is WSAECONNABORTED (Asynchronous Socket Error 10053).
How did i prevent it from happening in MY code ? well, there's something called Keepalive, if you look carefully into the name, Keep-Alive, it meant to keep the connection alive, just send Null data to the connection (Can be One-way), that's all...
i made a Timer (named it TmrKeepAlive) and set its interval to 5000ms (5 seconds), More info on KeepAlive.
Edit: Also, if you don't want to write your own KeepAlive mechanism, check this out
When I call the function
IdFtp.List(myList, '', false);
afterwards I have logged in and changed the ftp directory, I get a socket-error #10054 exception ("Connection reset by peer.") occesionally.
When I call that function e.g. 20 times consecutively I get that exception 1 time.
That problem I have only encountered on Vista OS.
Does anybody know what the problem is or how I can avoid it?
Not much you can do about this, because the disconnection is done by the FTP server.
You have a few choices:
Increase (or disable) the timeout settings (every FTP server has a different name for it) on your FTP Server connection settings.
Tell server that you are alive by sending NOOP command periodically (switching to Passive mode can also help).
Catch that exception and reconnect silently (This is my preferred solution because we have many FTP servers and I don't trust the sys-admins to change the FTP server time-out settings).
Here is a screen-shot from FileZilla FTP server time-out settings:
Note that with the above settings, the FTP client will be disconnected after 2 min of non-activity.
setting that value to 0, will disable the time-out.
The FTP protocol uses multiple socket connections. Every time you call List(), a new socket connection is established to transfer the requested listing data. It sounds like the FTP server is not always closing the socket correctly at the end of a transfer.
In the component "IdFTP", change the following properties:
"Passive" = "False"
"TransferType" = "ftASCII"