581 words

Attempt to open a non existing file '/tmp/objectdb_xxxx/SortQueryItr_6.mrg'

#1
2015-02-11 03:52

Hi,

I came across an error - but i have not been able to create a simple reproducible case - the error does not happen often and does not happen always - 

Let me explain:

1/ I run 5 java applications at the same time on one machine - each application is using an ODB file (each one is using a different one). Basically each application does a sorted query ( qqq = em.createQuery("SELECT bk FROM OBN bk ORDER BY bk.time ASC", OBN); )

2/ after a little while - some of the applications throw this error message:

Caused by: com.objectdb.o._PersistenceException: Attempt to open a non existing file '/tmp/objectdb_2116263629532821442/SortQueryItr_6.mrg'
        at com.objectdb.o._PersistenceException.b(_PersistenceException.java:45)
        at com.objectdb.o.JPE.g(JPE.java:145)
        at com.objectdb.o.ERR.f(ERR.java:56)
        at com.objectdb.o.OBC.onObjectDBError(OBC.java:1503)
        at com.objectdb.jpa.JpaQuery.getResultList(JpaQuery.java:725)

(i am using objectDb 2.6.0_02 )

I was not aware that ObjectDB is using a /tmp/ folder - but it looks like the sorted query is creating/using a SortQueryItr_6.mrg file - but b/c there are several applications running at the same time - maybe one application deleted the tmp file of another application.

I hope this description is sufficient.

EKK

EKK
EKK's picture
Joined on 2013-03-05
User Post #22
#2
2015-02-11 12:04

ObjectDB deletes its temporary files in 2 ways:

  1. Every process deletes its own temporary files that become unreachable (tracked by using weak references).
  2. When a process starts it tries to delete temporary files of other processes that are not locked (active temporary files are always locked).

The cause of the reported issue is unclear.

We added in build 2.6.0_04 an ability to disable these deletion actions:

    // To disable deletion within process - 1 above):
    System.setProperty("objectdb.temp.no-temp-file-purge", "true");
 
    // To disable deletion of other processes - 2 above):
    System.setProperty("objectdb.temp.no-temp-file-clean", "true");

You can try setting these system properties before accessing ObjectDB in your code or as parameters to the JVM, and post an update about the results.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,133
#3
2015-02-11 12:21

Thanks a lot - my guess is that 2 will fix it - 

Is there a way to know if the temp mrg file "belongs" to the current process or to the other processes? I think it will help deciding whether the cause is due to a problem in the logic of 1/ or in the logic of 2/

Thanks again 

 

EKK
EKK's picture
Joined on 2013-03-05
User Post #23
#4
2015-02-11 12:37

Every instance of ObjectDB (usually a separate process, but more precisely a separate class loader) manages its own directory of temporary files, e.g. /tmp/objectdb_2116263629532821442. This directory is created as soon as a temporary file is required. The name is random so you cannot identify the process of each temporary directory.

In that directory a lock file, lock.lck, is created and hold for the life of the process (or class loader).

Before deleting the entire temporary directory of a process, an attempt to delete lock.lck is made. It should fail if the process is still running and succeed if the process is not running. If lock.lck cannot be deleted the entire directory of temporary files is not deleted.

You may check if deleting a lock file of a running process is possible on your system.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,136
#5
2015-02-12 10:19

Thanks - I have been running my 5 applications for more than 24h and the error is gone with fix 2/

so the fix works for me - Thanks a lot

If you have two processes trying to delete the same folder and the folder deletion is protected from concurrency issue with one lock - then when the first process delete the lock and then the folder - what happen to the second process which was waiting for the lock? does the second process continue and try to delete the (already deleted) folder as well?

EKK
EKK's picture
Joined on 2013-03-05
User Post #24
#6
2015-02-13 09:43

It is possible that two processes will try to delete the same obsolete directory concurrently, but this should not cause any problem.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,139

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Attachments:
Maximum file size: 32 MB
Cancel