jwagenleitner / groovy-wslite

Lightweight SOAP and REST webservice clients for Groovy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HTTPClient connections not being closed

danboliu opened this issue · comments

By using wslite as REST webservice clients, it appears the code is not closing the underlying socket when the service call fails which is leading to an Out of Memory Error on the application server.

The JDK default connection timeout for a URLConnection is 0 which means it will never timeout. It would be good if WS-Lite had some sensible defaults for the connection and read timeouts, e.g. 5,000 ms and 30,000 ms.

The default URLConnection JDK connect and read timeout settings are not documented anywhere.

We had a scenario where a HTML autocomplete field was calling RESTClient which was then calling a REST service which went down. This lead to OOME on the application server.

I can't replicate this.

As for timeouts, since read and connect timeouts can easily be set per request or on an instance of an httpclient I think it's best to leave the default URLConnection behavior in place.