Home  Search  Register  Login  Recent Posts

Information on DTN's Industries:
DTN Oil & Gas | DTN Trading | DTN Agriculture | DTN Weather
Follow DTNMarkets on Twitter
DTN.IQ/IQFeed on Twitter
DTN News and Analysis on Twitter
»Forums Index »Archive (2017 and earlier) »IQFeed Developer Support »java connection leak
Author Topic: java connection leak (6 messages, Page 1 of 1)

rkamaly
-Interested User-
Posts: 6
Joined: Aug 10, 2014


Posted: Aug 12, 2014 12:02 AM          Msg. 1 of 6
Hi,

I am currently using java to connect to iqfeed to retrieve historical data. Am using multiple threads to fetch a HTT request. Each thread creates a Feed object whose life cycle looks like this

public void open() throws IOException {
this.socket = new Socket(InetAddress.getByName(FEED_HOST), FEED_PORT);
this.socketReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
this.socketWriter = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
}

public void close() throws IOException {
this.socket.shutdownOutput();
this.socket.shutdownInput();
this.socket.close();
this.socketReader.close();
this.socketWriter.close();
LOGGER.debug("closing connection");
}


After running the process for about 10 symbols and their related option chain, the code just balks. Upon inspection of the feed client ui, it indeed does say there are some connections open. These connections still appear to be active, after the java proc is killed.

Strangeness ensues, when I try to kill the iqconnect.exe from the tray. It looks like it's gone, but is still visible in the windows task manager tab. After I kill it from there, I am able to rerun the historical data pull.

Please advice on how to resolve this.

Thanks!

rkamaly
-Interested User-
Posts: 6
Joined: Aug 10, 2014


Posted: Aug 12, 2014 09:34 AM          Msg. 2 of 6
Btw, am using 20 threads simultaneously, whilst opening and closing em for every HTT request

DTN_Tim Walter
-DTN Guru-
Posts: 1238
Joined: Apr 25, 2006


Posted: Aug 12, 2014 09:47 AM          Msg. 3 of 6
Good morning,

We do have a limit of 15 concurrent connections, but generally a loop of 20 or so works out just fine, and since you are not even getting that far into your loop, it seems unrelated. Have you enabled logging of the data being returned to IQ and compared that to what you are reading off of your sockets. I would guess clues as to where your problem lies could be found there.

But, if your issues persist, just shoot me some more code, especially where you are reading the data off of the socket to our developer email and I would be happy to take a look at it to see if something jumps out at me.

Tim

rkamaly
-Interested User-
Posts: 6
Joined: Aug 10, 2014


Posted: Aug 12, 2014 01:16 PM          Msg. 4 of 6
Hi Tim,

Thank you for your prompt response. I have changed the number of open connections to 3 now and am still facing these issues.

Have send out an email with the relevant java code packages attached.


Thanks for the assistance again.

^_^

rkamaly
-Interested User-
Posts: 6
Joined: Aug 10, 2014


Posted: Aug 12, 2014 01:21 PM          Msg. 5 of 6
Attaching the client status window for further information.

Also if I were to exit the client from the system tray. The process still lingers on, and I have to kill it with task manager.



File Attached: client window.png (downloaded 1061 times)

DTN_Tim Walter
-DTN Guru-
Posts: 1238
Joined: Apr 25, 2006


Posted: Aug 12, 2014 03:01 PM          Msg. 6 of 6
We are still investigating this matter, but for anyone else that might be interested, what appears to be happening here involves the fact that when data is received in the socket, there is no guarantee that the entire return will fit in one message. So when reading from the socket, if you have not yet read in the terminating string of the message, you will want to store off any partial message that is left in your buffer, and prepend that to the next message. You can continue this until the terminating string is received to be sure you have all of your data.

As I mentioned, this is still under investigation, but for anyone that was curious or having similar issues, that is where we are currently.

Tim
 

 

Time: Fri April 18, 2025 3:20 PM CFBB v1.2.0 15 ms.
© AderSoftware 2002-2003