ObjectDB ObjectDB

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

#1

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

edit
delete
#2

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
edit
delete
#3

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 

 

edit
delete
#4

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
edit
delete
#5

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?

edit
delete
#6

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

ObjectDB Support
edit
delete

Reply

To post on this website please sign in.