Hi all,
I installed rrdtool in a Centos 5.5 server , the rrdtool is accessed by a
Java program through a socket:
SocketAddress sa = new InetSocketAddress(config.getRrdServiceHost(), config.getRrdServicePort());
Socket socket = new Socket();
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
PrintWriter out = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()));
String command = StringUtils.join(new String[]{
"create", rrdFileRel,
"--start", Long.toString(timestamp - config.getStartTimeOffset()),
"--step", "300",
"DS:ds0:" + type + ":900:U:U",
"RRA:AVERAGE:0.5:1:8640",
And the reply is read like this:
out.println(command);
out.flush();
response = in.readLine();
The snippet above works most of the time, but for some reason after some dozens of graphics are generated the RRDTOOL closes unexpectedly the sockets it get invoked through, I already took a TCP-dump and it can observed hot the RRDTOOL is invoked successfully many times but unexpectedly closes the connection:
create file:mycounter13180/stats.mycom.rrd --start 1286986228 --step 300 DS:ds0:ABSOLUTE:900:U:U ...
Reply:
OK u:0.00 s:0.01 r:0.01
But the last invocation fails:
create file:anothercounter13180/stats.mycom.rrd --start 1286986228 --step 300 DS:ds0:ABSOLUTE:900:U:U ...
Reply:
none
Thus, the socket suddenly gets closed.
ERROR 2010-10-13 12:10:39,126 [ ] [stat-runner-1] com.colibria.imps.statistics.service.StatisticsService.run - Failed to read stat from imps nodes
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at java.io.BufferedReader.fill(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
If there's a way to prevent this error from my Java program please let me know.
Thanks in advanced.