[jboss-jira] [JBoss JIRA] (AS7-4786) MSC controller hangs when loading an ear with multiple presistance units on a single threaded machine

Scott Marlow (JIRA) jira-events at lists.jboss.org
Wed May 30 09:23:18 EDT 2012


    [ https://issues.jboss.org/browse/AS7-4786?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12697189#comment-12697189 ] 

Scott Marlow commented on AS7-4786:
-----------------------------------

There are two ways to workaround this.

1. Start the AS with -Dorg.jboss.server.bootstrap.maxThreads=3

2. Remove one or both "hibernate.session_factory_name" properties from the persistence.xml
 <property name="hibernate.session_factory_name" value="java:global/hibernate/SessionFactory"/>

The following shows the two threads from the attached hungas7.txt:
{quote}
Thread 5328: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - java.lang.Object.wait() @bci=2, line=485 (Interpreted frame)
 - org.jboss.as.naming.WritableServiceBasedNamingStore$BindListener.await() @bci=8, line=153 (Interpreted frame)
 - org.jboss.as.naming.WritableServiceBasedNamingStore.bind(javax.naming.Name, java.lang.Object) @bci=162, line=72 (Interpreted frame)
 - org.jboss.as.naming.WritableServiceBasedNamingStore.rebind(javax.naming.Name, java.lang.Object) @bci=12, line=90 (Interpreted frame)
 - org.jboss.as.naming.NamingContext.rebind(javax.naming.Name, java.lang.Object) @bci=22, line=237 (Interpreted frame)
 - org.jboss.as.naming.InitialContext.rebind(javax.naming.Name, java.lang.Object) @bci=102, line=195 (Interpreted frame)
 - javax.naming.InitialContext.rebind(javax.naming.Name, java.lang.Object) @bci=7, line=412 (Interpreted frame)
 - org.hibernate.service.jndi.internal.JndiServiceImpl.bind(javax.naming.Name, java.lang.Object, javax.naming.Context) @bci=14, line=120 (Interpreted frame)
 - org.hibernate.service.jndi.internal.JndiServiceImpl.bind(java.lang.String, java.lang.Object) @bci=18, line=110 (Interpreted frame)
 - org.hibernate.internal.SessionFactoryRegistry.addSessionFactory(java.lang.String, java.lang.String, boolean, org.hibernate.SessionFactory, org.hibernate.service.jndi.spi.JndiService) @bci=95, line=89 (Interpreted frame)
 - org.hibernate.internal.SessionFactoryImpl.<init>(org.hibernate.cfg.Configuration, org.hibernate.engine.spi.Mapping, org.hibernate.service.ServiceRegistry, org.hibernate.cfg.Settings, org.hibernate.SessionFactoryObserver) @bci=1749, line=479 (Interpreted frame)
 - org.hibernate.cfg.Configuration.buildSessionFactory(org.hibernate.service.ServiceRegistry) @bci=90, line=1741 (Interpreted frame)
 - org.hibernate.ejb.EntityManagerFactoryImpl.<init>(javax.persistence.spi.PersistenceUnitTransactionType, boolean, java.lang.Class, org.hibernate.cfg.Configuration, org.hibernate.service.ServiceRegistry, java.lang.String) @bci=20, line=93 (Interpreted frame)
 - org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(org.hibernate.service.BootstrapServiceRegistryBuilder) @bci=68, line=905 (Interpreted frame)
 - org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory() @bci=8, line=890 (Interpreted frame)
 - org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo, java.util.Map) @bci=23, line=74 (Interpreted frame)
 - org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory() @bci=31, line=162 (Interpreted frame)
 - org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(org.jboss.msc.service.StartContext) @bci=102, line=85 (Interpreted frame)
 - org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(org.jboss.msc.service.Service, org.jboss.msc.service.StartContext) @bci=13, line=1811 (Interpreted frame)
 - org.jboss.msc.service.ServiceControllerImpl$StartTask.run() @bci=95, line=1746 (Interpreted frame)
 - java.util.concurrent.ThreadPoolExecutor$Worker.runTask(java.lang.Runnable) @bci=59, line=886 (Interpreted frame)
 - java.util.concurrent.ThreadPoolExecutor$Worker.run() @bci=28, line=908 (Interpreted frame)
 - java.lang.Thread.run() @bci=11, line=662 (Interpreted frame)


Thread 5327: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - java.lang.Object.wait() @bci=2, line=485 (Interpreted frame)
 - org.jboss.as.naming.WritableServiceBasedNamingStore$UnbindListener.await() @bci=8, line=180 (Interpreted frame)
 - org.jboss.as.naming.WritableServiceBasedNamingStore.unbind(javax.naming.Name) @bci=57, line=109 (Interpreted frame)
 - org.jboss.as.naming.WritableServiceBasedNamingStore.rebind(javax.naming.Name, java.lang.Object) @bci=2, line=85 (Interpreted frame)
 - org.jboss.as.naming.NamingContext.rebind(javax.naming.Name, java.lang.Object) @bci=22, line=237 (Interpreted frame)
 - org.jboss.as.naming.InitialContext.rebind(javax.naming.Name, java.lang.Object) @bci=102, line=195 (Interpreted frame)
 - javax.naming.InitialContext.rebind(javax.naming.Name, java.lang.Object) @bci=7, line=412 (Interpreted frame)
 - org.hibernate.service.jndi.internal.JndiServiceImpl.bind(javax.naming.Name, java.lang.Object, javax.naming.Context) @bci=14, line=120 (Interpreted frame)
 - org.hibernate.service.jndi.internal.JndiServiceImpl.bind(java.lang.String, java.lang.Object) @bci=18, line=110 (Interpreted frame)
 - org.hibernate.internal.SessionFactoryRegistry.addSessionFactory(java.lang.String, java.lang.String, boolean, org.hibernate.SessionFactory, org.hibernate.service.jndi.spi.JndiService) @bci=95, line=89 (Interpreted frame)
 - org.hibernate.internal.SessionFactoryImpl.<init>(org.hibernate.cfg.Configuration, org.hibernate.engine.spi.Mapping, org.hibernate.service.ServiceRegistry, org.hibernate.cfg.Settings, org.hibernate.SessionFactoryObserver) @bci=1749, line=479 (Interpreted frame)
 - org.hibernate.cfg.Configuration.buildSessionFactory(org.hibernate.service.ServiceRegistry) @bci=90, line=1741 (Interpreted frame)
 - org.hibernate.ejb.EntityManagerFactoryImpl.<init>(javax.persistence.spi.PersistenceUnitTransactionType, boolean, java.lang.Class, org.hibernate.cfg.Configuration, org.hibernate.service.ServiceRegistry, java.lang.String) @bci=20, line=93 (Interpreted frame)
 - org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(org.hibernate.service.BootstrapServiceRegistryBuilder) @bci=68, line=905 (Interpreted frame)
 - org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory() @bci=8, line=890 (Interpreted frame)
 - org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo, java.util.Map) @bci=23, line=74 (Interpreted frame)
 - org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory() @bci=31, line=162 (Interpreted frame)
 - org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(org.jboss.msc.service.StartContext) @bci=102, line=85 (Interpreted frame)
 - org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(org.jboss.msc.service.Service, org.jboss.msc.service.StartContext) @bci=13, line=1811 (Interpreted frame)
 - org.jboss.msc.service.ServiceControllerImpl$StartTask.run() @bci=95, line=1746 (Interpreted frame)
 - java.util.concurrent.ThreadPoolExecutor$Worker.runTask(java.lang.Runnable) @bci=59, line=886 (Interpreted frame)
 - java.util.concurrent.ThreadPoolExecutor$Worker.run() @bci=28, line=908 (Interpreted frame)
 - java.lang.Thread.run() @bci=11, line=662 (Interpreted frame)
{quote}

I'll look into how PersistenceUnitServiceImpl.start could run in its own thread pool and signal asynchronously that the PersistenceUnitServiceImpl start is started.
                
> MSC controller hangs when loading an ear with multiple presistance units on a single threaded machine
> -----------------------------------------------------------------------------------------------------
>
>                 Key: AS7-4786
>                 URL: https://issues.jboss.org/browse/AS7-4786
>             Project: Application Server 7
>          Issue Type: Bug
>         Environment: Centos 6, single core lib-virt VM
>            Reporter: Wouter De Borger
>            Assignee: Scott Marlow
>              Labels: hibernate, naming, race
>         Attachments: hungas7.txt
>
>
> When deploying an EAR with two persistence units on single core machines, the server hangs.
> When increasing the number of cores to two, the same server just works. 
> I traced the bug to the method in org.jboss.as.naming.WritableServiceBasedNamingStore.unbind 
> The container attempts to register "hibernate/SessionFactory" twice.
> The first time it works, the second time it hangs on the wait statement.
> I suspect a race condition in the ServiceControllerImpl.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list