cancel
Showing results for 
Search instead for 
Did you mean: 

Cache issues when having long running transaction

Former Member
0 Kudos

We have a long running job synchronizing Facet Search Configuration from staging to live config. The job first removes existing linked models using "modelService.removeAll" and then copies over from staging to live. All of this is in a single transaction and takes about a minute. When the job is running and in the same time a search is made or viewing a category in the live catalog in the storefront we get the following exception:


Caused by: item 8796551809180 no longer valid (was removed): object no longer valid
at de.hybris.platform.jalo.Item$CachedGetter.get(Item.java:675)                                
Clearly the problem is not with the isolation level as by default Repeatable Read is used. For some reason the removeAll operation makes the cache inconsistent.

Any help or suggestions will be appreciated?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

The solution that worked is disabling the cache within the transaction. Transaction.current().activateCache(false);

Former Member
0 Kudos

Hi Hamdi, Does it really work? Where do i place this code line? Thx

legozajozsef
Explorer
0 Kudos

This solution worked for us too: we used it in the beginning of the execute() method of the TransactionBody like this:

 Transaction.current().execute( new TransactionBody()
     {
         public Object execute()
         {
             Transaction.current().activateCache(false); 
             doSomething();
             Transaction.current().activateCache(true); 
             return something;
         }    
     }
 );
Former Member
0 Kudos

Try flushing the transaction before the second operation to ensure all the deletes are hitting the database. Read more about delayed store to understand the optimization that has been made to improve performance https://wiki.hybris.com/display/release5/Transactions#Transactions-DelayedStore