You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Simon Temple (JIRA)" <di...@incubator.apache.org> on 2006/01/25 15:31:09 UTC

[jira] Created: (DIREVE-330) Allow the installation of the shutdown handler to be optional for embedded servers

Allow the installation of the shutdown handler to be optional for embedded servers
----------------------------------------------------------------------------------

         Key: DIREVE-330
         URL: http://issues.apache.org/jira/browse/DIREVE-330
     Project: Directory Server
        Type: Improvement
  Components: server main  
    Versions: 0.9.4    
 Environment: Windows/UNIX JDK 1.4 - Embedded server within JBoss
    Reporter: Simon Temple
 Assigned to: Alex Karasulu 
    Priority: Minor


I am using the directory embedded in JBoss.  When we shutdown JBoss our
application services need to remove certain entries from the directory.
Unfortunately the shutdown handler in DefaultDirectoryServices closes Eve
out before we get chance to finish and we get errors:

org.apache.ldap.common.exception.LdapServiceUnavailableException:
Context operation unavailable when invoked after Eve provider has been
shutdown

When our services finally stop, we stop the directory using the
ShutdownConfiguration class so we don't really need the additional shutdown
thread.

I've commented out the shutdown hook code and our server is now behaving
how we want but I don't like running with patched source...


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (DIREVE-330) Allow the installation of the shutdown handler to be optional for embedded servers

Posted by "Alex Karasulu (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIREVE-330?page=all ]
     
Alex Karasulu resolved DIREVE-330:
----------------------------------

    Fix Version: 0.9.4
     Resolution: Fixed

Committed revision 373292.

Now you can add the following to your configuration:

  <bean id="configuration" class="org.apache.ldap.server.configuration.MutableServerStartupConfiguration">
    <property name="shutdownHookEnabled"><value>false</value></property>
...

This will prevent the shutdown hook from being registered.  When starting programatically in embedded configurations just call setShutdownHookEnabled(false) on the MutableStartupConfiguration or the MutableServerStartupConfiguratioin.

> Allow the installation of the shutdown handler to be optional for embedded servers
> ----------------------------------------------------------------------------------
>
>          Key: DIREVE-330
>          URL: http://issues.apache.org/jira/browse/DIREVE-330
>      Project: Directory Server
>         Type: Improvement
>   Components: server main
>     Versions: 0.9.4
>  Environment: Windows/UNIX JDK 1.4 - Embedded server within JBoss
>     Reporter: Simon Temple
>     Assignee: Alex Karasulu
>     Priority: Minor
>      Fix For: 0.9.4

>
> I am using the directory embedded in JBoss.  When we shutdown JBoss our
> application services need to remove certain entries from the directory.
> Unfortunately the shutdown handler in DefaultDirectoryServices closes Eve
> out before we get chance to finish and we get errors:
> org.apache.ldap.common.exception.LdapServiceUnavailableException:
> Context operation unavailable when invoked after Eve provider has been
> shutdown
> When our services finally stop, we stop the directory using the
> ShutdownConfiguration class so we don't really need the additional shutdown
> thread.
> I've commented out the shutdown hook code and our server is now behaving
> how we want but I don't like running with patched source...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DIREVE-330) Allow the installation of the shutdown handler to be optional for embedded servers

Posted by "Alex Karasulu (JIRA)" <di...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/DIREVE-330?page=comments#action_12364361 ] 

Alex Karasulu commented on DIREVE-330:
--------------------------------------

Simon we certainly do need to implement this option for not registering the shutdown hook.  I will add this to the core startup configuration which the XML file will also support.  Now the GracefulShutdown mechanism may play into the way the stopService() method should be implemented since this extended request blocks until all clients are properly notified with a GracefulDisconnect followed by a NoticeOfDisconnect (if they don't understand the GracefulDisconnect).  This also gives operations in progress a chance to complete.  I have no idea how this interaction is achieved however I will investigate this.  

For the time being let me just add a configuratioin parameter for you so this hook does not get in your way.  Sorry for taking so long to get to this issue.

Alex


> Allow the installation of the shutdown handler to be optional for embedded servers
> ----------------------------------------------------------------------------------
>
>          Key: DIREVE-330
>          URL: http://issues.apache.org/jira/browse/DIREVE-330
>      Project: Directory Server
>         Type: Improvement
>   Components: server main
>     Versions: 0.9.4
>  Environment: Windows/UNIX JDK 1.4 - Embedded server within JBoss
>     Reporter: Simon Temple
>     Assignee: Alex Karasulu
>     Priority: Minor

>
> I am using the directory embedded in JBoss.  When we shutdown JBoss our
> application services need to remove certain entries from the directory.
> Unfortunately the shutdown handler in DefaultDirectoryServices closes Eve
> out before we get chance to finish and we get errors:
> org.apache.ldap.common.exception.LdapServiceUnavailableException:
> Context operation unavailable when invoked after Eve provider has been
> shutdown
> When our services finally stop, we stop the directory using the
> ShutdownConfiguration class so we don't really need the additional shutdown
> thread.
> I've commented out the shutdown hook code and our server is now behaving
> how we want but I don't like running with patched source...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DIREVE-330) Allow the installation of the shutdown handler to be optional for embedded servers

Posted by "Emmanuel Lecharny (JIRA)" <di...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/DIREVE-330?page=comments#action_12364202 ] 

Emmanuel Lecharny commented on DIREVE-330:
------------------------------------------

Hi Simon,

the problem with shutdown is that we need to clean the network layer (correctly free sockets mainly). As you certainly already experienced, depending on your system configuration, when you jsut "kill" the jvm running ADS, you will be locked because the port will still be in use. To avoid such a behavior, we need to be able to ask the server to commit suicide. This is the GracefulShutdown command.

This handler is *not* mandatory. If you don(t call it, then you will have to kill the process and wait a few seconds before being able to launch the server again on the same port. So there is no need for a property parameter to prohibit this handmer to be called.

In your case, there is something different that should be done. We have to investigate the way AS are stopping or un-deploying applications. I don't know if JBoss support JSR88 or has a undeployment feature that allow the developper to execute a specific action like calling GracefulShutdown, but, in my mind, this is the way to go.

I hope it helps... Any other idea on the subject are welcome !

> Allow the installation of the shutdown handler to be optional for embedded servers
> ----------------------------------------------------------------------------------
>
>          Key: DIREVE-330
>          URL: http://issues.apache.org/jira/browse/DIREVE-330
>      Project: Directory Server
>         Type: Improvement
>   Components: server main
>     Versions: 0.9.4
>  Environment: Windows/UNIX JDK 1.4 - Embedded server within JBoss
>     Reporter: Simon Temple
>     Assignee: Alex Karasulu
>     Priority: Minor

>
> I am using the directory embedded in JBoss.  When we shutdown JBoss our
> application services need to remove certain entries from the directory.
> Unfortunately the shutdown handler in DefaultDirectoryServices closes Eve
> out before we get chance to finish and we get errors:
> org.apache.ldap.common.exception.LdapServiceUnavailableException:
> Context operation unavailable when invoked after Eve provider has been
> shutdown
> When our services finally stop, we stop the directory using the
> ShutdownConfiguration class so we don't really need the additional shutdown
> thread.
> I've commented out the shutdown hook code and our server is now behaving
> how we want but I don't like running with patched source...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DIREVE-330) Allow the installation of the shutdown handler to be optional for embedded servers

Posted by "Emmanuel Lecharny (JIRA)" <di...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/DIREVE-330?page=comments#action_12364204 ] 

Emmanuel Lecharny commented on DIREVE-330:
------------------------------------------

Ok, I get your point.

What you need, is a shutdown service that allows two things :
- Stop accepting new requests, but achieves the current requests
- Allow a kind of ShutDown user to send some last requests to ADS if needed, just before shutdowning the server smoothly (for instance, it could be "clean this specific context...")

Don't forget that ADS? at this point, is not transactionnal. Operations cannot be encapsulated into database like transaction, with a commit and rollback (this is a cool feature we need, however). So your users won't be aware if the server just shutdown. This could be a problem if you want the users to be able to rollback themself their actions before the server shutown. Also consider that if the server just crash, you are exactly in the same situation ;)

At least, the GracefulShutdown command is much better than any other slution, in that way it works smoothly, and can also be extended in a way that allows users to obtain the result of a time consuming request before the shutdown.

Their are many path to explore, many improvment to develop. But this is pretty much something to put in the 1.1, 1.2 or 2.0 roadmap. 

I don't know if this answer is acceptable regarding your timeframe, may be Alex has a different point of view. However, this is really interesting to go farther in your direction, I think.

> Allow the installation of the shutdown handler to be optional for embedded servers
> ----------------------------------------------------------------------------------
>
>          Key: DIREVE-330
>          URL: http://issues.apache.org/jira/browse/DIREVE-330
>      Project: Directory Server
>         Type: Improvement
>   Components: server main
>     Versions: 0.9.4
>  Environment: Windows/UNIX JDK 1.4 - Embedded server within JBoss
>     Reporter: Simon Temple
>     Assignee: Alex Karasulu
>     Priority: Minor

>
> I am using the directory embedded in JBoss.  When we shutdown JBoss our
> application services need to remove certain entries from the directory.
> Unfortunately the shutdown handler in DefaultDirectoryServices closes Eve
> out before we get chance to finish and we get errors:
> org.apache.ldap.common.exception.LdapServiceUnavailableException:
> Context operation unavailable when invoked after Eve provider has been
> shutdown
> When our services finally stop, we stop the directory using the
> ShutdownConfiguration class so we don't really need the additional shutdown
> thread.
> I've commented out the shutdown hook code and our server is now behaving
> how we want but I don't like running with patched source...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DIREVE-330) Allow the installation of the shutdown handler to be optional for embedded servers

Posted by "Alex Karasulu (JIRA)" <di...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/DIREVE-330?page=comments#action_12363984 ] 

Alex Karasulu commented on DIREVE-330:
--------------------------------------

Simon this is where we're working on the IETF draft:

http://docs.safehaus.org/display/APACHEDS/LDAP+Extensions+for+Graceful+Shutdown

It will be implemented very soon in trunk.  Emmanuel has alread done all the ASN1 code.  I can show you how to use an ExtendedRequest with JNDI to make this work.  It's really easy.  However just bear with us as we try to get RC1 out the door.

Alex

> Allow the installation of the shutdown handler to be optional for embedded servers
> ----------------------------------------------------------------------------------
>
>          Key: DIREVE-330
>          URL: http://issues.apache.org/jira/browse/DIREVE-330
>      Project: Directory Server
>         Type: Improvement
>   Components: server main
>     Versions: 0.9.4
>  Environment: Windows/UNIX JDK 1.4 - Embedded server within JBoss
>     Reporter: Simon Temple
>     Assignee: Alex Karasulu
>     Priority: Minor

>
> I am using the directory embedded in JBoss.  When we shutdown JBoss our
> application services need to remove certain entries from the directory.
> Unfortunately the shutdown handler in DefaultDirectoryServices closes Eve
> out before we get chance to finish and we get errors:
> org.apache.ldap.common.exception.LdapServiceUnavailableException:
> Context operation unavailable when invoked after Eve provider has been
> shutdown
> When our services finally stop, we stop the directory using the
> ShutdownConfiguration class so we don't really need the additional shutdown
> thread.
> I've commented out the shutdown hook code and our server is now behaving
> how we want but I don't like running with patched source...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DIREVE-330) Allow the installation of the shutdown handler to be optional for embedded servers

Posted by "Simon Temple (JIRA)" <di...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/DIREVE-330?page=comments#action_12364199 ] 

Simon Temple commented on DIREVE-330:
-------------------------------------

Thanks guys, I can see your very busy with RC1 right now...

I see the extension for graceful shutdown as very useful however when the directory is embedded within an AS framework like JBoss (for example!) I feel it would be better to leave the shutting down of the directory to the AS framework (via the controlled un-deployment process).

In this way any dependencies between AS services can be controlled allowing a clean and graceful system shutdown.

Could we simply use an environment property to prohibit the installation of the shutdown handler and hence delegate the shutdown responsibility to the application server framework?

SimonT


> Allow the installation of the shutdown handler to be optional for embedded servers
> ----------------------------------------------------------------------------------
>
>          Key: DIREVE-330
>          URL: http://issues.apache.org/jira/browse/DIREVE-330
>      Project: Directory Server
>         Type: Improvement
>   Components: server main
>     Versions: 0.9.4
>  Environment: Windows/UNIX JDK 1.4 - Embedded server within JBoss
>     Reporter: Simon Temple
>     Assignee: Alex Karasulu
>     Priority: Minor

>
> I am using the directory embedded in JBoss.  When we shutdown JBoss our
> application services need to remove certain entries from the directory.
> Unfortunately the shutdown handler in DefaultDirectoryServices closes Eve
> out before we get chance to finish and we get errors:
> org.apache.ldap.common.exception.LdapServiceUnavailableException:
> Context operation unavailable when invoked after Eve provider has been
> shutdown
> When our services finally stop, we stop the directory using the
> ShutdownConfiguration class so we don't really need the additional shutdown
> thread.
> I've commented out the shutdown hook code and our server is now behaving
> how we want but I don't like running with patched source...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DIREVE-330) Allow the installation of the shutdown handler to be optional for embedded servers

Posted by "Simon Temple (JIRA)" <di...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/DIREVE-330?page=comments#action_12364203 ] 

Simon Temple commented on DIREVE-330:
-------------------------------------

I can offer some more information on how the embedded server interacts with jBoss...

I have created a directory MBean service:  (see https://issues.apache.org/jira/browse/DIREVE-309)

As you may expect, it has stopService() and startService() methods.  

When the MBean is deployed the startService() method is called which in-turn starts the directory.

The problem is that when jBoss is stopped (ie. * its * shutdown handler is called), stopService() is called on each deployed MBean in reverse dependency order (i.e.  all service that rely upon the directory are stopped first and then finally the directory is stopped)

The directory MBean stopService() calls:

            ShutdownConfiguration cfg = new ShutdownConfiguration(  );
            Hashtable env = createContextEnv(  );
            env.putAll( cfg.toJndiEnvironment(  ) );
            new InitialDirContext( env );

The problem I have is that the directory shutdown hook is being called when the jBoss shutdown hook is called.  Your hook shuts down the directory immediately.  This does not allow the dependent service to gracefully stop their interactions with the directory.

The directory shutdown hook defeats the AS un-deployment dependency linkages.  For this reason I feel that when directory is deployed as an MBean service in JBoss the use of a shutdown hook should be made optional.

Please feel free to comment on this 'Sales Pitch'   ;-)


> Allow the installation of the shutdown handler to be optional for embedded servers
> ----------------------------------------------------------------------------------
>
>          Key: DIREVE-330
>          URL: http://issues.apache.org/jira/browse/DIREVE-330
>      Project: Directory Server
>         Type: Improvement
>   Components: server main
>     Versions: 0.9.4
>  Environment: Windows/UNIX JDK 1.4 - Embedded server within JBoss
>     Reporter: Simon Temple
>     Assignee: Alex Karasulu
>     Priority: Minor

>
> I am using the directory embedded in JBoss.  When we shutdown JBoss our
> application services need to remove certain entries from the directory.
> Unfortunately the shutdown handler in DefaultDirectoryServices closes Eve
> out before we get chance to finish and we get errors:
> org.apache.ldap.common.exception.LdapServiceUnavailableException:
> Context operation unavailable when invoked after Eve provider has been
> shutdown
> When our services finally stop, we stop the directory using the
> ShutdownConfiguration class so we don't really need the additional shutdown
> thread.
> I've commented out the shutdown hook code and our server is now behaving
> how we want but I don't like running with patched source...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DIREVE-330) Allow the installation of the shutdown handler to be optional for embedded servers

Posted by "Emmanuel Lecharny (JIRA)" <di...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/DIREVE-330?page=comments#action_12363963 ] 

Emmanuel Lecharny commented on DIREVE-330:
------------------------------------------

We have added a GracefulShutdown extended operation that is a LDAP request in the next version (1.0-RC1). It can be used as any Ldap request, so if you need to remove some entry before shutdowning Jboss, this can be the last resquest you send to the server.

I don't know if it fits your need, but it may be an option.

> Allow the installation of the shutdown handler to be optional for embedded servers
> ----------------------------------------------------------------------------------
>
>          Key: DIREVE-330
>          URL: http://issues.apache.org/jira/browse/DIREVE-330
>      Project: Directory Server
>         Type: Improvement
>   Components: server main
>     Versions: 0.9.4
>  Environment: Windows/UNIX JDK 1.4 - Embedded server within JBoss
>     Reporter: Simon Temple
>     Assignee: Alex Karasulu
>     Priority: Minor

>
> I am using the directory embedded in JBoss.  When we shutdown JBoss our
> application services need to remove certain entries from the directory.
> Unfortunately the shutdown handler in DefaultDirectoryServices closes Eve
> out before we get chance to finish and we get errors:
> org.apache.ldap.common.exception.LdapServiceUnavailableException:
> Context operation unavailable when invoked after Eve provider has been
> shutdown
> When our services finally stop, we stop the directory using the
> ShutdownConfiguration class so we don't really need the additional shutdown
> thread.
> I've commented out the shutdown hook code and our server is now behaving
> how we want but I don't like running with patched source...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (DIRSERVER-290) Allow the installation of the shutdown handler to be optional for embedded servers

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSERVER-290?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny closed DIRSERVER-290.
---------------------------------------


closed

> Allow the installation of the shutdown handler to be optional for embedded servers
> ----------------------------------------------------------------------------------
>
>                 Key: DIRSERVER-290
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-290
>             Project: Directory ApacheDS
>          Issue Type: Improvement
>    Affects Versions: pre-1.0
>         Environment: Windows/UNIX JDK 1.4 - Embedded server within JBoss
>            Reporter: Simon Temple
>            Assignee: Alex Karasulu
>            Priority: Minor
>             Fix For: 1.0-RC1
>
>
> I am using the directory embedded in JBoss.  When we shutdown JBoss our
> application services need to remove certain entries from the directory.
> Unfortunately the shutdown handler in DefaultDirectoryServices closes Eve
> out before we get chance to finish and we get errors:
> org.apache.ldap.common.exception.LdapServiceUnavailableException:
> Context operation unavailable when invoked after Eve provider has been
> shutdown
> When our services finally stop, we stop the directory using the
> ShutdownConfiguration class so we don't really need the additional shutdown
> thread.
> I've commented out the shutdown hook code and our server is now behaving
> how we want but I don't like running with patched source...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.