Openwings Home
Introduction
Search
In the News
Frequently Asked Questions
Registration
Open Forum
Openwings Tutorial
Bug Database
Openwings API
Download
Expert Teams
Process Management Office
Projects
Links
Terms of Use
Comment on this bug

04122:

Provided services not removed on a graceful shutdown

Category: Component
Status: Closed

Severity: HIGH
Reported against release: 0.8
Fixed in release: 0.9

PROBLEM:

When components are shut down via the shell "process -stop" command,  
their services do not always go away. Components using the services do 
not receive a "providedServiceRemoved()" callback.

ANALYSIS:

The de-registration of services from the Jini Lookup Service by the 
Jini Discovery Plugin is performed via a thread registered as a 
shutdown hook (see java.lang.Runtime.addShutdownHook()).  The nature of 
shutdown hooks is that they only have a limited amount of time to run, 
and no guarantee of being able to complete. After some testing, it is 
also apparent that shutdown hooks are executed in parallel with each 
other and with the rest of JVM shutdown, which includes disabling of 
socket access.

This defect was originally created because of a component whose 
application code registered an additional shutdown hook, in addition to 
the Component Services shutdown hook. In these circumstances, there 
just wasn't enough CPU cycles to go around to get the services de-
registered in time.

The use of the shutdown hook to de-register services in the Jini 
Discovery plugin was always intended as a convenience, not as a 
guarantee. Service de-registration was always the first action 
performed by the shutdown hook, therefore there is really no fix to be 
made. See the workaround section for discussion of what can be done to 
avoid this problem.

WORKAROUND:

Note that using the shell "process -stop" command does not necessarily 
connote a graceful shutdown of processes controlled by a container 
manager.

For standalone process, the process is killed via the 
java.lang.Process.destroy() method. Graceful shutdown of standalone 
processes is an upcoming feature of Container Services.

For processes running in containers, they can use the ContainerAccess 
API to register a callback with the container core. This callback 
method will be used for a graceful shutdown.

back to top

home | vision | search | in the news | faq | registration | open forum | tutorial | bug database
 API | download | expert teams | process management office | projects | links | terms of use

© Copyright 2001-2006 General Dynamics C4 Systems. All rights reserved.