NIO buffer force error

Joe Quinn
2011-11-30
2014-01-19
  • Joe Quinn

    Joe Quinn - 2011-11-30

    Hi, I am getting the following error message in my logs:

    2011-11-29 18:33:04,062(7250531)  WARN hsqldb.db.HSQLDB2B2F235168.ENGINE  - NIO buffer force error JVM threw unsupported Exception
    java.lang.NullPointerException
    at org.hsqldb.persist.ScaledRAFileNIO.synch(ScaledRAFileNIO.java:488)
    at org.hsqldb.persist.ScaledRAFileHybrid.newStore(ScaledRAFileHybrid.java:165)
    at org.hsqldb.persist.ScaledRAFileHybrid.ensureLength(ScaledRAFileHybrid.java:138)
    at org.hsqldb.persist.DataFileCache.setFilePos(DataFileCache.java:706)
    at org.hsqldb.persist.DataFileCache.add(DataFileCache.java:729)
    at org.hsqldb.persist.RowStoreAVLDisk.add(RowStoreAVLDisk.java:132)
    at org.hsqldb.persist.RowStoreAVLDisk.getNewCachedObject(RowStoreAVLDisk.java:153)
    at org.hsqldb.Table.insertSingleRow(Table.java:2551)
    at org.hsqldb.StatementDML.insertSingleRow(StatementDML.java:848)
    at org.hsqldb.StatementInsert.getResult(StatementInsert.java:127)
    at org.hsqldb.StatementDMQL.execute(StatementDMQL.java:190)
    at org.hsqldb.Session.executeCompiledStatement(Session.java:1344)
    at org.hsqldb.Session.execute(Session.java:997)
    at org.hsqldb.jdbc.JDBCPreparedStatement.fetchResult(JDBCPreparedStatement.java:4651)
    at org.hsqldb.jdbc.JDBCPreparedStatement.executeUpdate(JDBCPreparedStatement.java:311)

    I looked in the ScaledRAFileNIO class and found the code where it is being thrown:

        public void synch() {
            boolean error = false;
            for (int i = 0; i < buffers.length; i++) {
                try {
                    buffers[i].force();
                } catch (Throwable t) {
                    database.logger.logWarningEvent("NIO buffer force error "
                                                    + JVM_ERROR + " ", t);
                    error = true;
                }
            }
            if (error) {
                for (int i = 0; i < buffers.length; i++) {
                    try {
                        buffers[i].force();
                    } catch (Throwable t) {
                        database.logger.logWarningEvent("NIO buffer force error "
                                                        + JVM_ERROR + " ", t);
                    }
                }
            }
            try {
                fileDescriptor.sync();
                buffersModified = false;
            } catch (Throwable t) {}
        }
    

    I don't know what is causing this however. Anyone any ideas?

    My code looks like this:

            Connection c = null;
            PreparedStatement ps = null;
            try {
                c = ConnectionHelper.getConnection();
                ps = c.prepareStatement("INSERT INTO db.interface (deviceId,ifIndex,ifDescr,ifType,ifMTU," +
                        "ifSpeed,ifPhysAddress,ifAdminStatus,ifOperStatus,ifLastChange) " +
                        "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
    
                for(Interface iface: allInterfaces)
                {
                    ps.setInt(1, iface.getDeviceId());
                    ps.setInt(2, iface.getIfIndex());
                    ps.setString(3, iface.getIfDescr());
                    ps.setInt(4, iface.getIfType());
                    ps.setInt(5, iface.getIfMTU());
                    ps.setInt(6, iface.getIfSpeed());
                    ps.setString(7, iface.getIfPhysAddress());
                    ps.setInt(8, iface.getIfAdminStatus());
                    ps.setInt(9, iface.getIfOperStatus());
                    ps.setDouble(10, iface.getIfLastChange());
                    ps.executeUpdate();
                }
                // Update the id in the returned object. This is important as this value must get returned to the client.
                allInterfaces.clear();
                deviceIds.clear();
                ps.close();
            } catch (Exception e) {
                logger.error("Error storing interfaces ", e);
                throw new DAOException(e);
            } finally {
                ConnectionHelper.close(c);
            }
    

    So its coming from the "ps.executeUpdate();" line…
    This doesn't happen all the time just some of the time.

     
  • Fred Toussi

    Fred Toussi - 2011-11-30

    Yes, I noticed this issue just after the latest release. Fix has been committed to SVN /base/trunk

    You can checkout and build from SVN, which is now easier using Gradle or Ant.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks