Home » Support » Forum » Connection is closed (error 526)

Connection is closed (error 526)

#1

Serval times I found the c/s method will close by unknown reason, when I read only the db.

Exception in thread "main" [ObjectDB 2.2.7_08] javax.persistence.PersistenceException
Connection is closed (error 526)
at com.objectdb.jpa.JpaQuery.getResultList(JpaQuery.java:633)
at fpg.Nodes.getSons(Nodes.java:54)
at src.run.testNodes.getSonsAll(testNodes.java:191)
at src.run.testNodes.main(testNodes.java:308)
Caused by: com.objectdb.o.UserException: Connection is closed
at com.objectdb.o.MSG.d(MSG.java:74)
at com.objectdb.o.CLS.Q(CLS.java:317)
at com.objectdb.o.CLS.P(CLS.java:281)
at com.objectdb.o.CST.US(CST.java:494)
at com.objectdb.o.QRR.g(QRR.java:225)
at com.objectdb.o.QRR.b(QRR.java:144)
at com.objectdb.jpa.JpaQuery.getResultList(JpaQuery.java:627)
... 3 more
Caused by: java.io.EOFException
at com.objectdb.o.NTS.z(NTS.java:317)
at com.objectdb.o.NTS.y(NTS.java:274)
at com.objectdb.o.CLS.R(CLS.java:327)
at com.objectdb.o.CLS.P(CLS.java:274)
... 7 more
Institute of Computer Technologies
#2

If I change the c/s model to local DB, then I get:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at com.objectdb.o.TYW.<init>(TYW.java:100)
at com.objectdb.o.ENH.c(ENH.java:195)
at com.objectdb.o.ENT.R(ENT.java:726)
at com.objectdb.o.LDR.J(LDR.java:477)
at com.objectdb.o.LDR.I(LDR.java:441)
at com.objectdb.o.LDR.D(LDR.java:156)
at com.objectdb.o.OBC.aK(OBC.java:1027)
at com.objectdb.o.OBC.aI(OBC.java:917)
at com.objectdb.o.OBC.UG(OBC.java:802)
at com.objectdb.o.QRR.h(QRR.java:266)
at com.objectdb.o.QRR.b(QRR.java:168)
at com.objectdb.jpa.JpaQuery.getResultList(JpaQuery.java:627)
at fpg.Nodes.getSons(Nodes.java:53)
at src.run.testNodes.getSonsAll(testNodes.java:300)
at src.run.testNodes.main(testNodes.java:283)
java.lang.OutOfMemoryError: Java heap space
at com.objectdb.o.HTB.f(HTB.java:86)
at com.objectdb.o.HTB.q(HTB.java:399)
at com.objectdb.o.PGC.B(PGC.java:402)
at com.objectdb.o.SFL.ah(SFL.java:990)
at com.objectdb.o.SFL.af(SFL.java:950)
at com.objectdb.o.SFL.run(SFL.java:896)
at java.lang.Thread.run(Thread.java:662)

If I set "-Xmx1400m", then the query test will OK.

Institute of Computer Technologies
#3

Maybe you are trying to load the entire tree into memory. Try replacing EAGER with LAZY.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#4

    Always failed at c/s mode, when I visit each branch node in the tree, not load the whole tree.


Exception in thread "main" [ObjectDB 2.2.7_08] javax.persistence.PersistenceException
Connection is closed (error 526)
 at com.objectdb.jpa.JpaQuery.getResultList(JpaQuery.java:633)
 at fpg.Nodes.getSons(Nodes.java:54)
 at src.run.testNodes.getSonsAll(testNodes.java:193)
 at src.run.testNodes.main(testNodes.java:310)
Caused by: com.objectdb.o.UserException: Connection is closed
 at com.objectdb.o.MSG.d(MSG.java:74)
 at com.objectdb.o.CLS.Q(CLS.java:317)
 at com.objectdb.o.CLS.P(CLS.java:281)
 at com.objectdb.o.CST.US(CST.java:494)
 at com.objectdb.o.QRR.g(QRR.java:225)
 at com.objectdb.o.QRR.b(QRR.java:144)
 at com.objectdb.jpa.JpaQuery.getResultList(JpaQuery.java:627)
 ... 3 more
Caused by: java.io.EOFException
 at com.objectdb.o.NTS.z(NTS.java:317)
 at com.objectdb.o.NTS.y(NTS.java:274)
 at com.objectdb.o.CLS.R(CLS.java:327)
 at com.objectdb.o.CLS.P(CLS.java:274)
 ... 7 more

Here is my codes:

private static void getSonsAll() {
  System.out.printf("===========%n");
  int iSum = 0;
  long start = System.currentTimeMillis();
  for (int i=0;i<1<<17;i++){
   Nodes o = em.find(Nodes.class, i+1);
   if (null== o){
    System.out.printf("%s is not Nodes %n", o);
    continue;
   }
   List<Nodes> sons = o.getSons();
   if ( (i & 0xFFF) ==0){
    System.out.printf("getSons time @ %f %n", (System.currentTimeMillis()-start)/1000f);
    if (null==sons) continue;
    int iCnt = sons.size();
    System.out.printf("%d : type:Nodes, sons:%d; ",i+1, iCnt);
    iSum += iCnt;
    Iterator<Nodes> it = sons.iterator();
    while (it.hasNext()){
     Nodes en = it.next();
     System.out.printf("child : %d, ", en.getId());
    }
    System.out.printf("%nIterator time @ %f %n%n", (System.currentTimeMillis()-start)/1000f);
   }
   sons.clear(); sons = null;
  
  }
  System.out.printf("The sum : %d %n", iSum);
  System.out.println();
}

 

Institute of Computer Technologies
#5

Maybe somehow the connection is closed by the application.

Please post a complete test that demonstrates the exception.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login