AnsweredAssumed Answered

Java thread is being aborted,Channel 33537 destroyed because of client's inactivity

Question asked by kjelavankal on Mar 10, 2015
Latest reply on Mar 25, 2015 by dng

I built a java service interface to PI that quries PI servers in frequent intervals of 1-2 minutes to get data and store it in a application database.

My code

             Connection string - jdbc:pisql://XXXXXX/ Integrated Security=SSPI;Persist Security Info=False;Data Source= XXXXX

              plist.put("DCA", "SAVE");

              plist.put("user", prop.getProperty("WPIUN"));

              plist.put("password", prop.getProperty("WPIPW"));

             Class.forName(driver).newInstance();    

             conn = DriverManager.getConnection(connectionString,plist);

        

I have the above code in a try and catch block to catch any unexpected errors

 

try

{

    Connection string - jdbc:pisql://XXXXXX/ Integrated Security=SSPI;Persist Security Info=False;Data Source= XXXXX

              plist.put("DCA", "SAVE");

              plist.put("user", prop.getProperty("WPIUN"));

              plist.put("password", prop.getProperty("WPIPW"));

             Class.forName(driver).newInstance();    

             conn = DriverManager.getConnection(connectionString,plist);

             PreparedStatement pstmt = conn.prepareStatement (sqlStmt.toString());

             ResultSet rs = pstmt.executeQuery();

} catch (Exception e) {  

        System.out.println("ERROR OBTAINING DATABASE CONNECTION: " + e.getMessage());       

        haveConnection = false;

        error = true;     

}finally {

      if (conn != null && error) {

        try {conn.close();} catch (Exception e) {return null;}

      }else if (error){return null;}

 

The code works fine continually for several hours/days . However after 1-2 days randomly I get an error from the PI server that breaks my thread and stops my service.

 

When I look into the Pi logs from the PI SDK utlity i see the following Message at the time my service stopped

 

"Channel 33537 destroyed because of client's inactivity"

 

The java program keeps pinging the PI server and gets the following messages

Channel has been established

Succesfully connected to server

Chanell has been closed by the client 

 

Then suddenly at one particular instance it returns teh message "Channel 33537 destroyed because of client's inactivity" and that breaks the java thread.

 

Questions

1) Why is this error occuring randomly?

2) How can i modify my java program that ignores such exception and continue without breaking the program?

 

 

Thanks

Kiran

Outcomes