shaa108 / h2database

Automatically exported from code.google.com/p/h2database
1 stars 0 forks source link

dead Cycle when connect db #605

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
when connect db thread Pending,
dead Cycle in:LobStorageMap.java  init() method row 109,
two dump,
one:
名称: localhost-startStop-1
状态: RUNNABLE
总阻止数: 1, 总等待数: 1

堆栈跟踪: 
org.h2.mvstore.cache.CacheLongKeyLIRS.get(CacheLongKeyLIRS.java:234)
org.h2.mvstore.MVStore.readPage(MVStore.java:1835)
org.h2.mvstore.MVMap.readPage(MVMap.java:736)
org.h2.mvstore.Page.getChildPage(Page.java:218)
org.h2.mvstore.MVMap.binarySearch(MVMap.java:468)
org.h2.mvstore.MVMap.get(MVMap.java:450)
org.h2.store.LobStorageMap.init(LobStorageMap.java:110)
org.h2.engine.Database.open(Database.java:761)
   - 已锁定 org.h2.engine.Database@f93810
org.h2.engine.Database.openDatabase(Database.java:266)
org.h2.engine.Database.<init>(Database.java:260)
org.h2.engine.Engine.openSession(Engine.java:60)
org.h2.engine.Engine.openSession(Engine.java:167)
   - 已锁定 org.h2.engine.Engine@1304f78
org.h2.engine.Engine.createSessionAndValidate(Engine.java:145)
org.h2.engine.Engine.createSession(Engine.java:128)
org.h2.engine.Engine.createSession(Engine.java:26)
org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:347)
org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:108)
org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:92)
org.h2.Driver.connect(Driver.java:72)
com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java
:148)

Another one :

名称: localhost-startStop-1
状态: RUNNABLE
总阻止数: 1, 总等待数: 1

堆栈跟踪: 
org.h2.mvstore.type.ObjectDataType.compare(ObjectDataType.java:104)
org.h2.mvstore.MVMap.compare(MVMap.java:708)
org.h2.mvstore.Page.binarySearch(Page.java:335)
org.h2.mvstore.MVMap.getMinMax(MVMap.java:411)
org.h2.mvstore.MVMap.getMinMax(MVMap.java:432)
org.h2.mvstore.MVMap.getMinMax(MVMap.java:405)
org.h2.mvstore.MVMap.floorKey(MVMap.java:382)
org.h2.store.LobStorageMap.init(LobStorageMap.java:116)
org.h2.engine.Database.open(Database.java:761)
   - 已锁定 org.h2.engine.Database@f0a07c
org.h2.engine.Database.openDatabase(Database.java:266)
org.h2.engine.Database.<init>(Database.java:260)
org.h2.engine.Engine.openSession(Engine.java:60)
org.h2.engine.Engine.openSession(Engine.java:167)
   - 已锁定 org.h2.engine.Engine@1ecf8f1
org.h2.engine.Engine.createSessionAndValidate(Engine.java:145)
org.h2.engine.Engine.createSession(Engine.java:128)
org.h2.engine.Engine.createSession(Engine.java:26)
org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:347)
org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:108)
org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:92)
org.h2.Driver.connect(Driver.java:72)
com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java
:148)

Original issue reported on code.google.com by yuedaxi...@gmail.com on 8 Mar 2015 at 2:27

GoogleCodeExporter commented 8 years ago
this bug since h2-2015-03-02 ,the h2-2015-1-16  is ok

Original comment by yuedaxi...@gmail.com on 9 Mar 2015 at 2:08

GoogleCodeExporter commented 8 years ago
I can't upload test file and db file.The test file:
package com.ecc.test;

import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;

import com.gentlesoft.commons.util.ObjectType;

public class Testh2 {
    public static void main(String[] args) throws Exception {

        ddff();
    }

    private static void ddff() throws  Exception {
        Connection connection=getConnection();//getnewCon();

        Statement ss=connection.createStatement();
        ResultSet rs=ss.executeQuery("call current_timestamp()");
        while (rs.next()){
          Object tem=   rs.getObject(1);
          System.out.println(tem);
        }
        rs.close();
        ss.close();
        System.out.println("Connection h2 ok");
        connection.close();
    }
    public static Connection getConnection() throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException{
        DriverManager.registerDriver((Driver)Class.forName("org.h2.Driver").newInstance());
        Connection connection=DriverManager.getConnection("jdbc:h2:D:\\eclipse\\mydb", "sa", "");
        return connection;
    }

    public static Connection getnewCon() throws Exception{
        Driver driver=createDriver("org.h2.Driver");
        String url="jdbc:h2:D:\\eclipse\\mydb";
        Properties info=new Properties();
        info.put("user", "sa");
        info.put("password", "");
        Connection nativeConnection = driver.connect(url, info);
        return nativeConnection;
    }
    public static Driver createDriver(String className) throws SQLException, ClassNotFoundException {
        Class<?> rawDriverClass = ObjectType.loadClass(className);

        if (rawDriverClass == null) {
            throw new SQLException("jdbc-driver's class not found. '" + className + "'");
        }

        Driver rawDriver;
        try {
            rawDriver = (Driver) rawDriverClass.newInstance();
        } catch (InstantiationException e) {
            throw new SQLException("create driver instance error, driver className '" + className + "'", e);
        } catch (IllegalAccessException e) {
            throw new SQLException("create driver instance error, driver className '" + className + "'", e);
        }

        return rawDriver;
    }
}

Original comment by yuedaxi...@gmail.com on 9 Mar 2015 at 2:33

GoogleCodeExporter commented 8 years ago
This bug cause by lob ,if a table has lob data ,cause  dead cycle

Original comment by yuedaxi...@gmail.com on 9 Mar 2015 at 2:36

GoogleCodeExporter commented 8 years ago
Hi,

The issue tracker is only if you have a simple, standalone test case. But your 
test code is just connecting to the database, so with that alone I can't 
reproduce the problem of course.

Could you use the mailing list next time instead of filing a non-reproducible 
bug? There, you can send the database file (we would need that). Or send it to 
me directly.

Regards,
Thomas

Original comment by thomas.t...@gmail.com on 12 Mar 2015 at 6:54

GoogleCodeExporter commented 8 years ago

Original comment by thomas.t...@gmail.com on 12 Mar 2015 at 6:54

GoogleCodeExporter commented 8 years ago
I can't upload db file,Because GFW.In china can't visite google any service.
What your email,I send db to you,my email:yuedaxia76@gmail.com

Original comment by yuedaxi...@gmail.com on 12 Mar 2015 at 2:27

GoogleCodeExporter commented 8 years ago
Hi,

Thanks a lot! You are right, this is an endless loop, it is a bug introduced in 
version 1.4.186. I have fixed this bug now (in the trunk).

Regards,
Thomas

Original comment by thomas.t...@gmail.com on 13 Mar 2015 at 6:44

GoogleCodeExporter commented 8 years ago
Should be fixed with version 1.4.187

Original comment by thomas.t...@gmail.com on 10 Apr 2015 at 6:54