2

In continue to my previous issue Neo4j Embedded database hangs after abnormal application termination

I noticed that everything works properly if I use graphDatabaseService.shutdown(); method before terminating of my application.. Otherwise after restart my application hangs on the database operations.

After hours of investigation I think, I have found the general source of this issue but have no idea right now how to fix it.

This is my Spring Boot WebSecurityConfig:

@Configuration
@EnableWebSecurity
@EnableWebMvcSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {


    @Autowired
    private SocialAuthenticationSuccessHandler socialAuthenticationSuccessHandler;

    @Autowired
    private TokenAuthenticationService tokenAuthenticationService;

    @Autowired
    private TokenAuthenticationFilter tokenAuthenticationFilter;

    @Autowired
    private DBUserDetailsService userDetailsService;

.....

}

I autowired 4 fields that internally use Neo4j(DAO, repositories and so on). Neo4j hangs on restart after unclean shutdown when these fields are present inside of my WebSecurityConfig. When I remove these fields the issue disappears.

I use:

OS: Windows 8.1
jdk1.8.0_51
Spring 4.1.7.RELEASE
Spring Boot 1.2.5.RELEASE
Spring Security 3.2.7.RELEASE 
neo4j version 2.2.3
lucene version 3.6.2
spring-data-neo4j version 3.4.0.M1

This issue will appear if WebSecurityConfighas references on Neo4j related stuff, otherwise everything works properly..

It hangs on transaction commit:

2015-07-29 16:47:51 [main] DEBUG o.s.t.jta.JtaTransactionManager - Initiating transaction commit

What can be wrong ?

UPDATED

stack-trace when it hanging:

Thread [main] (Suspended (breakpoint at line 229 in LuceneDataSource))  
    LuceneDataSource.getWriteLock() line: 229   
    LuceneCommandApplier.visitIndexDefineCommand(IndexDefineCommand) line: 98   
    LegacyIndexApplier.applier(IndexCommand) line: 94   
    LegacyIndexApplier.visitIndexRemoveCommand(IndexCommand$RemoveCommand) line: 153    
    CommandApplierFacade.visitIndexRemoveCommand(IndexCommand$RemoveCommand) line: 221  
    IndexCommand$RemoveCommand.handle(NeoCommandHandler) line: 253  
    CommandApplierFacade.visit(Command) line: 82    
    CommandApplierFacade.visit(Object) line: 1  
    PhysicalTransactionRepresentation.accept(Visitor<Command,IOException>) line: 72 
    TransactionRepresentationStoreApplier.apply(TransactionRepresentation, ValidatedIndexUpdates, LockGroup, long, TransactionApplicationMode) line: 108    
    TransactionRepresentationCommitProcess.applyToStore(TransactionRepresentation, LockGroup, CommitEvent, ValidatedIndexUpdates, long, TransactionApplicationMode) line: 107   
    TransactionRepresentationCommitProcess.commit(TransactionRepresentation, LockGroup, CommitEvent, TransactionApplicationMode) line: 64   
    KernelTransactionImplementation.commit() line: 502  
    KernelTransactionImplementation.close() line: 418   
    TopLevelTransaction.close() line: 112   
    Neo4jEmbeddedTransactionManager$TxState.commit() line: 39   
    Neo4jEmbeddedTransactionManager.commit() line: 77   
    UserTransactionAdapter.commit() line: 82    
    JtaTransactionManager.doCommit(DefaultTransactionStatus) line: 1021 
    JtaTransactionManager(AbstractPlatformTransactionManager).processCommit(DefaultTransactionStatus) line: 757 
    JtaTransactionManager(AbstractPlatformTransactionManager).commit(TransactionStatus) line: 726   
    TransactionInterceptor(TransactionAspectSupport).commitTransactionAfterReturning(TransactionAspectSupport$TransactionInfo) line: 521    
    TransactionInterceptor(TransactionAspectSupport).invokeWithinTransaction(Method, Class<?>, InvocationCallback) line: 291    
    TransactionInterceptor.invoke(MethodInvocation) line: 96    
    CglibAopProxy$CglibMethodInvocation(ReflectiveMethodInvocation).proceed() line: 179 
    CglibAopProxy$DynamicAdvisedInterceptor.intercept(Object, Method, Object[], MethodProxy) line: 653  
    DataGenerator$$EnhancerBySpringCGLIB$$96453c81.initialDatabaseSetup() line: not available   
    Application.lambda$0(Neo4jTemplate, DataGenerator, String[]) line: 37   
    1625413756.run(String[]) line: not available    
    SpringApplication.runCommandLineRunners(ApplicationContext, String...) line: 672    
    SpringApplication.afterRefresh(ConfigurableApplicationContext, String[]) line: 690  
    SpringApplication.run(String...) line: 321  
    SpringApplication.run(Object[], String[]) line: 957 
    SpringApplication.run(Object, String...) line: 946  
    Application.main(String[]) line: 44 

It hangs on obtaining the write lock for org.neo4j.kernel.impl.api.LegacyIndexApplier

Community
  • 1
  • 1
alexanoid
  • 24,051
  • 54
  • 210
  • 410

1 Answers1

1

I can confirm that this issue related to the following fix - https://github.com/neo4j/neo4j/commit/c9596af0d990d7dde9a9053799b7295985ae3c05

I have applied the changes from this commit and the issue is gone.

So, right now I'm waiting for Neo4j 2.2.4 release.

Do you know the planned release date for Neo4j 2.2.4 ?

alexanoid
  • 24,051
  • 54
  • 210
  • 410