Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 900923 (JBPAPP6-1073)

Summary: Unable to undeploy application (stuck in InitialContext.lookup) using prettyfaces
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Tomas Remes <tremes>
Component: NamingAssignee: Cheng Fang <cfang>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: 6.0.0CC: ales.justin, alex, cfang, jpai, maschmid, pgier, rajesh.rajasekaran, smcgowan, tomaz.cerar, werner
Target Milestone: ---   
Target Release: EAP 6.0.1   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jira.jboss.org/jira/browse/JBPAPP6-1073
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-10-25 12:35:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
faces-shortly.war
none
jstack-output none

Description Tomas Remes 2012-09-24 10:56:50 UTC
project_key: JBPAPP6

Running "undeploy appname" from jboss-cli.sh doesn't work for applications using prettyfaces. It gets stuck at:
 
{noformat}
INFO  [com.ocpsoft.pretty.PrettyFilter] (MSC service thread 1-4) PrettyFilter shutting down...
{noformat}
No exception is thrown and application is not undeployed.

Comment 1 Tomas Remes 2012-09-24 10:57:42 UTC
Attaching simple app from Seam 3 examples.

Comment 2 Tomas Remes 2012-09-24 10:57:42 UTC
Attachment: Added: faces-shortly.war


Comment 3 Tomas Remes 2012-09-25 10:34:34 UTC
Attaching jstack output (you can see output for MSC service thread 1-4)

Comment 4 Tomas Remes 2012-09-25 10:34:34 UTC
Attachment: Added: jstack-output


Comment 5 Rajesh Rajasekaran 2012-09-27 15:36:19 UTC
Since this is a CLI issue, assigning to Alexey for triage.

Comment 6 Alexey Loubyansky 2012-09-27 17:32:46 UTC
How come when a thread on the server-side is stuck it is a tool's issue? With that approach any bug in the AS is a CLI bug...
Is there a tool that can successfully undeploy it?

Comment 7 Shelly McGowan 2012-09-30 23:34:05 UTC
Issue discussed in community looks related regarding the issue with undeploying the application.   CLI is not related.
https://community.jboss.org/message/762306

Comment 8 Shelly McGowan 2012-10-01 16:03:53 UTC
@cheng can you assess the root cause of this issue

Comment 9 Cheng Fang 2012-10-01 19:16:45 UTC
I was able to reproduce it on EAP 6.0.1 ER2 build, and AS 7.1.3.Final, but not on AS7 master or AS7 7.1.3.Final-SNAPSHOT build.

So it appears some commits might have fixed it after 7.1.3.Final was tagged.  The last commit in 7.1.3 was:
{noformat}
commit f1f5122c0b675454f91e9c458cc1aa9545f2c32c
Author: Brian Stansberry <brian.stansberry>
Date:   Fri Sep 21 14:14:05 2012 -0500

    Prepare for 7.1.3.Final

commit 59fa8f3e565abb52b958c22380261c03b5b041e7
Author: Scott Marlow <smarlow>
Date:   Thu Sep 13 15:42:20 2012 -0400

    AS7-5549 Add support for @PersistenceContexts
{noformat}

Comment 10 Cheng Fang 2012-10-02 02:30:58 UTC
The direct cause is a wait() call in org/jboss/as/naming/ServiceReferenceObjectFactory while getting object instance from the lookup result:
{code:java}
-        synchronized (listener) {
-            // if we are interrupted just let the exception propagate for now
-            while (!listener.finished) {
-                try {
-                    listener.wait();
-                } catch (InterruptedException e) {
-                    throw MESSAGES.threadInterrupt(serviceName);
-                }
-            }
-        }
{code}

The notifyAll() call in org.jboss.as.naming.ServiceReferenceObjectFactory.ServiceReferenceListener#handleStateChange, which supposedly will end the wait, is not executed in this case.  The controller.state is DOWN during undeployment.

However, by looking at the code path, I don't see why this wait() call is needed.  The listener add operation is synchronous.  After removing the wait() call, I was able to get the undeploy work.

Why does the undeploy work in as7 master build and as7 7.1 post-7.1.3.final build?  The reason is in those more recent builds, the BeanManager resource is bound to jndi as a link ref which points to java:comp/env/BeanManager, and its actual type is ...weld.manager.BeanManagerImpl.  So the lookup operation will not include resolving javax.naming.Reference nor org.jboss.as.naming.ServiceReferenceObjectFactory

2 options from what I can see:
1, for EAP 6.0.1 to pick up whatever has been committed after 7.1.3.final to better support BeanManager resource;

2, for EAP 6.0.1 to keep the current BeanManager resource support in 7.1.3.final, and also fix the wait/notifyAll issue.

Comment 11 Cheng Fang 2012-10-02 03:02:14 UTC
Forum Reference: Added: https://community.jboss.org/thread/205959?tstart=0


Comment 12 Cheng Fang 2012-10-02 18:24:54 UTC
Link: Added: This issue is related to AS7-5489


Comment 13 Paul Gier 2012-10-02 23:34:57 UTC
The upstream fix for AS7-5489 has been merged to EAP.
http://git.app.eng.bos.redhat.com/?p=jbossas/jboss-as.git;a=commitdiff;h=69223d1333052f4ff57f9b470d5729f8e3bd7b19

According to Stuart, the upstream jira is still open because there is still some related lower priority work to be done.

Comment 14 Marek Schmidt 2012-10-25 12:34:28 UTC
Release Notes Docs Status: Added: Not Required
Forum Reference: Removed: https://community.jboss.org/thread/205959?tstart=0 Added: https://community.jboss.org/thread/205959?tstart=0


Comment 15 Marek Schmidt 2012-10-25 12:35:05 UTC
Verified on EAP 6.0.1 ER3

Comment 16 Anne-Louise Tangring 2012-11-13 20:21:01 UTC
Release Notes Docs Status: Removed: Not Required 
Docs QE Status: Removed: NEW