Bug 963167 - Unable to complete tasks when server is shutdown
Summary: Unable to complete tasks when server is shutdown
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Core Server
Version: JON 3.1.2
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ER01
: JON 3.2.0
Assignee: Thomas Segismont
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On: 957689 958217
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-05-15 10:03 UTC by Thomas Segismont
Modified: 2018-12-02 18:47 UTC (History)
3 users (show)

Fixed In Version:
Clone Of: 957689
Environment:
Last Closed: 2014-01-02 20:43:00 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Thomas Segismont 2013-05-15 10:03:02 UTC
+++ This bug was initially created as a clone of Bug #957689 +++

Description of problem:
When the server is shutdown, several components (datasources, ejbs) go down before RHQ's shutdown listener code completes.

Version-Release number of selected component (if applicable):
4.6

How reproducible:
Always

Steps to Reproduce:
1. Add a 'Thread.sleep' statement in Data Purge Job code
2. Change the scheduling code to start the Data Purge Job 30 seconds after server startup
2. Rebuild, start, wait and stop the server when purge job is executed
  
Actual results:
Errors in the server log: http://pastebin.test.redhat.com/138892

Expected results:
The server should not go down until data purge job and shutdown listener code finish.

Additional info:
To be verified: it looks like AS7, unlike AS 4.2.3, does not wait for our Shutdown listener code to complete execution before shutting down all resources (datasources, EJBs, etc...)

--- Additional comment from Thomas Segismont on 2013-04-30 15:29:02 CEST ---

Before RHQ4.6, shutdown listener was implemented as a JMX notification listener. Now it is implemented as a Singleton bean and shutdown logic is in the @PreDestroy method.

It's not really needed to hack the Data Purge Job code to show this. Almost always, when you hit Ctrl-C on a server started in console mode, you'll see the same exception message:

javax.ejb.EJBException: JBAS014559: Invocation cannot proceed as component is shutting down 

This message was introduced in this AS7 pull request:
https://github.com/wildfly/wildfly/pull/1889

Calling @EJB methods in @PreDestroy callbacks is normally allowed by the spec. Somebody reported similar (but not same) problem and the issue was accepted and resolved:
https://community.jboss.org/message/764240
https://issues.jboss.org/browse/AS7-4808

Note: shutdown notification should come back in Wildfly
http://lists.jboss.org/pipermail/jboss-as7-dev/2012-April/005834.html

Comment 1 Thomas Segismont 2013-06-25 14:21:16 UTC
Fixed in master

See comment https://bugzilla.redhat.com/show_bug.cgi?id=957689#c3

Comment 2 Thomas Segismont 2013-06-28 10:50:35 UTC
Second commit in master

See comment https://bugzilla.redhat.com/show_bug.cgi?id=957689#c4

Comment 3 Larry O'Leary 2013-09-06 14:30:59 UTC
As this is MODIFIED or ON_QA, setting milestone to ER1.


Note You need to log in before you can comment on or make changes to this bug.