-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: unable to remove index: Lock obtain timed out
PostPosted: Mon Aug 25, 2008 10:38 am 
Regular
Regular

Joined: Tue Apr 01, 2008 5:39 pm
Posts: 61
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.3.0 GA core
3.1.0 Beta1

Mapping documents:

Code between sessionFactory.openSession() and session.close():
Code:
@Transactional(propagation=Propagation.REQUIRES_NEW,
                   isolation=Isolation.SERIALIZABLE,
                   readOnly=true)
public void batchProcessPostingIndex
{
Session session = this.getHibernateTemplate().getSessionFactory().getCurrentSession();
        FullTextSession fullTextSession = Search.getFullTextSession(session);
        fullTextSession.setFlushMode(FlushMode.MANUAL);
        fullTextSession.setCacheMode(CacheMode.IGNORE);
        //Scrollable results will avoid loading too many objects in memory
        ScrollableResults results = fullTextSession.createCriteria(Post.class )
            .setFetchSize(BATCH_SIZE)
            .scroll( ScrollMode.FORWARD_ONLY );
        int index = 0;
        while( results.next() ) {
            index++;
            fullTextSession.index( results.get(0) ); //index each element
            if (index % BATCH_SIZE == 0) {
                fullTextSession.flushToIndexes(); //apply changes to indexes
                fullTextSession.clear(); //clear since the queue is processed
            }
        }
}


Full stack trace of any exception that occurs:
Code:
Exception in thread "main" org.hibernate.search.SearchException: Unable to remov
e from Lucene index: class ups.message.board.domain.Post#192114
        at org.hibernate.search.backend.impl.lucene.LuceneWorker.remove(LuceneWo
rker.java:108)
        at org.hibernate.search.backend.impl.lucene.LuceneWorker.performWork(Luc
eneWorker.java:79)
        at org.hibernate.search.backend.impl.lucene.LuceneWorker.performWork(Luc
eneWorker.java:46)
        at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueProcessor.
run(LuceneBackendQueueProcessor.java:98)
        at org.hibernate.search.backend.impl.BatchedQueueingProcessor.performWor
ks(BatchedQueueingProcessor.java:151)
        at org.hibernate.search.backend.impl.PostTransactionWorkQueueSynchroniza
tion.flushWorks(PostTransactionWorkQueueSynchronization.java:63)
        at org.hibernate.search.backend.impl.TransactionalWorker.flushWorks(Tran
sactionalWorker.java:63)
        at org.hibernate.search.impl.FullTextSessionImpl.flushToIndexes(FullText
SessionImpl.java:100)
        at ups.message.board.dao.PostingDaoHibernateImpl.batchPro
cessPostingIndex(PostingDaoHibernateImpl.java:110)
        at ups.message.board.service.PostingServiceImpl.batchProc
essPostingIndex(PostingServiceImpl.java:70)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:310)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
inpoint(ReflectiveMethodInvocation.java:182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:149)
        at org.springframework.transaction.interceptor.TransactionInterceptor.in
voke(TransactionInterceptor.java:106)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.transaction.interceptor.TransactionInterceptor.in
voke(TransactionInterceptor.java:106)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.transaction.interceptor.TransactionInterceptor.in
voke(TransactionInterceptor.java:106)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy14.batchProcessPostingIndex(Unknown Source)
        at ups.message.board.main.BatchPostingIndex.main(BatchPostingIndex.java
:27)
Caused by: org.apache.lucene.store.LockObtainFailedException: Lock obtain timed
out: SimpleFSLock@C:\searchIndex\Post\write.lock
        at org.apache.lucene.store.Lock.obtain(Lock.java:85)
        at org.apache.lucene.index.DirectoryIndexReader.acquireWriteLock(Directo
ryIndexReader.java:250)
        at org.apache.lucene.index.IndexReader.deleteDocument(IndexReader.java:7
25)
        at org.hibernate.search.backend.impl.lucene.LuceneWorker.remove(LuceneWo
rker.java:103)
        ... 25 more


Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 25, 2008 12:11 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
It's possible you terminated a previous run of indexing, leaving your index in locked state.
Close you applications using the index, and verify there is no lock file in the index directory, if it exists delete it.
This shouldn't happen in normal operation (when quitting without killing the app).

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.