Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4899291

"Unexpected Signal : EXCEPTION_FLT_STACK_CHECK" in jdbc odbc bridge driver

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P3 P3
    • None
    • 1.4.2
    • core-libs



      Name: rmT116609 Date: 07/31/2003


      FULL PRODUCT VERSION :
      java version "1.4.2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
      Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)

      FULL OS VERSION :
      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      This exception kills the vm reliably after creating 848 PreparedStatements and calling preparedStatement.set*() 845 times. The exception does not occur if regular Statements are used. This effect is cumulative and does not appear to be affected by the number of connections created or time running or anything like that. For example, your application could be running for days and could create a new connection for every prepared statement, but after you hit some magic number, the stack overflow occurs and your vm dies.

      Here's the exception:

      Unexpected Signal : EXCEPTION_FLT_STACK_CHECK (0xc0000092) occurred at PC=0xA4CAA8
      Function=[Unknown.]
      Library=(N/A)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      I was able to reproduce this bug reliably simply by writing a few queries using PreparedStatement (regular Statements do not cause it) and running them in a loop until the exception is thrown. My tests caused the crash at 2034 PreparedStatements with no set*() called, or 848 PreparedStatements with set*() called 845 times. This is assuming that preparedStatement.executeQuery() was called for every prepared statement. If executeQuery() is not called, the bug does not show up for me. It's speculation on my part but the culprit code may very well be tied to PreparedStatement.executeQuery().

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      the vm should crash and the exception should be:

      Unexpected Signal : EXCEPTION_FLT_STACK_CHECK (0xc0000092) occurred at PC=0xA4CAA8
      Function=[Unknown.]
      Library=(N/A)
      ACTUAL -
      my vm dies and the exception is:

      Unexpected Signal : EXCEPTION_FLT_STACK_CHECK (0xc0000092) occurred at PC=0xA4CAA8
      Function=[Unknown.]
      Library=(N/A)

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Unexpected Signal : EXCEPTION_FLT_STACK_CHECK (0xc0000092) occurred at PC=0xA4CAA8
      Function=[Unknown.]
      Library=(N/A)

      NOTE: We are unable to locate the function name symbol for the error
            just occurred. Please refer to release documentation for possible
            reason and solutions.


      Current Java thread:

      Dynamic libraries:
      0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe
      0x77F80000 - 0x77FFA000 C:\WINNT\system32\ntdll.dll
      0x77DB0000 - 0x77E0B000 C:\WINNT\system32\ADVAPI32.dll
      0x77E80000 - 0x77F31000 C:\WINNT\system32\KERNEL32.dll
      0x77D30000 - 0x77DA1000 C:\WINNT\system32\RPCRT4.dll
      0x77E10000 - 0x77E6F000 C:\WINNT\system32\USER32.dll
      0x77F40000 - 0x77F79000 C:\WINNT\system32\GDI32.dll
      0x78000000 - 0x78046000 C:\WINNT\system32\MSVCRT.dll
      0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll
      0x77570000 - 0x775A0000 C:\WINNT\System32\WINMM.dll
      0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll
      0x007E0000 - 0x007EE000 C:\j2sdk1.4.2\jre\bin\verify.dll
      0x007F0000 - 0x00808000 C:\j2sdk1.4.2\jre\bin\java.dll
      0x00810000 - 0x0081D000 C:\j2sdk1.4.2\jre\bin\zip.dll
      0x18270000 - 0x1827C000 C:\j2sdk1.4.2\jre\bin\JdbcOdbc.dll
      0x1F7B0000 - 0x1F7E1000 C:\WINNT\System32\ODBC32.dll
      0x71710000 - 0x71794000 C:\WINNT\system32\COMCTL32.dll
      0x76B30000 - 0x76B6D000 C:\WINNT\system32\comdlg32.dll
      0x70BD0000 - 0x70C35000 C:\WINNT\system32\SHLWAPI.DLL
      0x782F0000 - 0x78534000 C:\WINNT\system32\SHELL32.DLL
      0x1F850000 - 0x1F866000 C:\WINNT\System32\odbcint.dll
      0x62890000 - 0x6294F000 C:\PROGRAM FILES\TIMBERLINE OFFICE\SHARED\tssimba.dll
      0x63690000 - 0x636CE000 C:\PROGRAM FILES\TIMBERLINE OFFICE\SHARED\tsdb.dll
      0x07C80000 - 0x07C91000 C:\PROGRAM FILES\TIMBERLINE OFFICE\SHARED\w3isr101.dll
      0x07CA0000 - 0x07CB1000 C:\PVSW\BIN\w3btrv7.dll
      0x6C370000 - 0x6C462000 C:\WINNT\System32\MFC42.DLL
      0x780C0000 - 0x78121000 C:\WINNT\System32\MSVCP60.dll
      0x60AE0000 - 0x60CD1000 C:\PROGRAM FILES\TIMBERLINE OFFICE\SHARED\tsCommon.dll
      0x63030000 - 0x63082000 C:\PROGRAM FILES\TIMBERLINE OFFICE\SHARED\tsUpgrad.dll
      0x60930000 - 0x60942000 C:\PROGRAM FILES\TIMBERLINE OFFICE\SHARED\tsBase.dll
      0x77A50000 - 0x77B45000 C:\WINNT\system32\ole32.dll
      0x779B0000 - 0x77A4B000 C:\WINNT\system32\OLEAUT32.dll
      0x77820000 - 0x77827000 C:\WINNT\system32\VERSION.dll
      0x759B0000 - 0x759B6000 C:\WINNT\system32\LZ32.DLL
      0x719B0000 - 0x719B8000 C:\WINNT\System32\SHFOLDER.dll
      0x76620000 - 0x76630000 C:\WINNT\system32\MPR.dll
      0x63390000 - 0x633C3000 C:\PROGRAM FILES\TIMBERLINE OFFICE\SHARED\tsWin.dll
      0x77800000 - 0x7781E000 C:\WINNT\System32\WINSPOOL.DRV
      0x62830000 - 0x6284B000 C:\PROGRAM FILES\TIMBERLINE OFFICE\SHARED\tsSendingWrapper.dll
      0x695E0000 - 0x69609000 C:\WINNT\System32\OLEPRO32.DLL
      0x60470000 - 0x604D1000 C:\PROGRAM FILES\TIMBERLINE OFFICE\SHARED\tcl.dll
      0x63500000 - 0x63522000 C:\PROGRAM FILES\TIMBERLINE OFFICE\SHARED\tsactg.dll
      0x63830000 - 0x63926000 C:\PROGRAM FILES\TIMBERLINE OFFICE\SHARED\tsdm.dll
      0x02E70000 - 0x0300A000 C:\PROGRAM FILES\TIMBERLINE OFFICE\SHARED\TSOG70_AS.dll
      0x1F800000 - 0x1F818000 C:\WINNT\System32\odbccp32.dll
      0x03420000 - 0x03431000 C:\PVSW\BIN\w3scmv7.dll
      0x03450000 - 0x03476000 C:\Pvsw\Bin\W3AIF109.DLL
      0x67E00000 - 0x67E1D000 C:\Pvsw\Bin\W3BIF133.DLL
      0x034A0000 - 0x034F6000 C:\Pvsw\Bin\W3CRS10E.DLL
      0x03610000 - 0x037E3000 C:\Pvsw\Bin\W3ENC104.DLL
      0x67D00000 - 0x67D38000 C:\Pvsw\Bin\W3MIF137.DLL
      0x77920000 - 0x77943000 C:\WINNT\system32\imagehlp.dll
      0x72A00000 - 0x72A2D000 C:\WINNT\system32\DBGHELP.dll
      0x690A0000 - 0x690AB000 C:\WINNT\System32\PSAPI.DLL

      Heap at VM Abort:
      Heap
       def new generation total 576K, used 242K [0x10010000, 0x100b0000, 0x104f0000)
        eden

      ****************
      Another exception has been detected while we were handling last error.
      Dumping information about last error:
      ERROR REPORT FILE = (N/A)
      PC = 0x00a4caa8
      SIGNAL = -1073741678
      FUNCTION NAME = (N/A)
      OFFSET = 0xFFFFFFFF
      LIBRARY NAME = (N/A)
      Please check ERROR REPORT FILE for further information, if there is any.
      Good bye.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      One would have to set up a database for this to work, but let's assume you set up an Access database with a dsn called "OdbcTestDSN" and a table called TEST with the columns 'id' and 'name'.

      import java.sql.Connection;
      import java.sql.DriverManager;
      import java.sql.PreparedStatement;
      import java.sql.ResultSet;
      import java.sql.SQLException;

      public class SunOdbcBugTestCase {
        private static final String SQL_QUERY_IDS = "SELECT id FROM TEST";
        private static final String SQL_QUERY_NAME_BY_ID = "SELECT name FROM TEST WHERE id = ?";
        private Connection _conn;
        private static long _preparedStatementCounter;
        private static long _preparedStatementSetCounter;

        public SunOdbcBugTestCase() {
          try {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          } catch (ClassNotFoundException cnfe) {
            System.out.println("Class not found");
          }
        }

        private Connection createConnection() {
          String url = "jdbc:odbc:OdbcTestDSN";
          System.out.println("Instantiating a new ODBC connection: url = [" + url + "]");
          Connection con = null;
          try {
            con = DriverManager.getConnection(url.toString());
          } catch (SQLException e) {
            e.printStackTrace();
          }
          return con;
        }

        private Connection getConnection() {
          try {
            if (_conn == null || _conn.isClosed()) {
              _conn = createConnection();
            }
          } catch (SQLException e1) {
            e1.printStackTrace();
          }
          return _conn;
        }

        public void queryIds() {
          Connection conn = getConnection();
          try {
            psCount();
            PreparedStatement ps = conn.prepareStatement(SQL_QUERY_IDS);
            ResultSet rs = ps.executeQuery();
            while (rs.next()) {
              String id = rs.getString(1);
              queryNameById(conn, id);
            }
            rs.close();
            ps.close();
          } catch (SQLException e) {
            System.out.println(e.getMessage());
          }
        }

        public void queryNameById(Connection conn, String id) throws SQLException {
          psCount();
          PreparedStatement ps = conn.prepareStatement(SQL_QUERY_IDS);
          psSetCount();
          ps.setString(1, (id));
          ResultSet rs = ps.executeQuery();
          if (rs.next()) {
            System.out.println("Id [" + id + "] Name [" + rs.getString(1) + "]");
          }
          rs.close();
          ps.close();
        }

        private void psSetCount() {
          _preparedStatementSetCounter++;
          System.out.println(_preparedStatementSetCounter + " PS Sets called");
        }

        private void psCount() {
          _preparedStatementCounter++;
          System.out.println(_preparedStatementCounter + " Prepared Statements Created");
        }

        public static void main(String[] args) {
          System.out.println("Running..");
          SunOdbcBugTestCase app = new SunOdbcBugTestCase();
          int count = 0;
          while (true) {
            System.out.println("Iteration " + ++count);
            /*try {
              Thread.sleep(1000);
            } catch (InterruptedException e) {
              e.printStackTrace();
            } */
            app.queryIds();
          }
        }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Using regular Statements by means of Connection.createStatement() and statement.executeQuery(String query) seem to work without problems. I was able to create and execute over 100,000 statements without having the error.
      (Incident Review ID: 193280)
      ======================================================================

            jbrucesunw Jonathan Bruce (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: