You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "David Geleyn (JIRA)" <di...@incubator.apache.org> on 2005/03/21 10:04:21 UTC

[jira] Created: (DIREVE-151) Shutting down server multiple times results in 'Failed to sync all'

Shutting down server multiple times results in 'Failed to sync all'
-------------------------------------------------------------------

         Key: DIREVE-151
         URL: http://issues.apache.org/jira/browse/DIREVE-151
     Project: Directory Server
        Type: Bug
    Versions: 0.9    
 Environment: Windows XP, J2SE 1.4.2_05, Apache 0.9 SNAPSHOT
    Reporter: David Geleyn
 Assigned to: Alex Karasulu 
 Attachments: Test.java, out.txt

Situation in which the error occurs:

When shutting down server of Product X (which embeds Apache Directory Server) we 
have some problems with shutting down the embeded LDAP server. One of the 
reasons could be the addShutdownhook in RootNexus.java. When embedding the 
LDAP server we need to add a shutdownhook ourselves to make sure the LDAP 
server is gracefully shutdown (see code below). Among other things, the 
shutdown of the embedded LDAP server seems to call the sync on the 
RootNexus as well, causing an IllegalStateException as 2 separate threads 
are accessing the RootNexus.

Java API for System.exit:
The virtual machine's shutdown sequence consists of two phases. In the 
first phase all registered shutdown hooks, if any, are started in some 
unspecified order and allowed to run concurrently until they finish. 

Example of shutting down (which is implicitly a part of our shutdownhook):
Properties env = new Properties();
env.setProperty(Context.PROVIDER_URL, "ou=system");
env.setProperty(Context.INITIAL_CONTEXT_FACTORY, 
"org.apache.ldap.server.jndi.ServerContextFactory");
env.setProperty(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
env.setProperty(Context.SECURITY_CREDENTIALS, "secret");
env.setProperty(EnvKeys.SYNC, "true");
env.setProperty(EnvKeys.SHUTDOWN, "true");
new InitialDirContext(env);

Maybe this is caused by the soluttion for bug report 
http://issues.apache.org/jira/browse/DIREVE-92?

I'm capable of reproducing this behavior in a small program which is attached.
The program will ask for input (via System.in.read). When asked for input, please press Control-C to exit. The program will call the shutdown hook multiple times and will result in a 'Failed to sync all'.

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DIREVE-151) Shutting down server multiple times results in 'Failed to sync all'

Posted by "David Geleyn (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIREVE-151?page=history ]

David Geleyn updated DIREVE-151:
--------------------------------

    Attachment: Test.java

The test program

> Shutting down server multiple times results in 'Failed to sync all'
> -------------------------------------------------------------------
>
>          Key: DIREVE-151
>          URL: http://issues.apache.org/jira/browse/DIREVE-151
>      Project: Directory Server
>         Type: Bug
>     Versions: 0.9
>  Environment: Windows XP, J2SE 1.4.2_05, Apache 0.9 SNAPSHOT
>     Reporter: David Geleyn
>     Assignee: Alex Karasulu
>  Attachments: Test.java, out.txt
>
> Situation in which the error occurs:
> When shutting down server of Product X (which embeds Apache Directory Server) we 
> have some problems with shutting down the embeded LDAP server. One of the 
> reasons could be the addShutdownhook in RootNexus.java. When embedding the 
> LDAP server we need to add a shutdownhook ourselves to make sure the LDAP 
> server is gracefully shutdown (see code below). Among other things, the 
> shutdown of the embedded LDAP server seems to call the sync on the 
> RootNexus as well, causing an IllegalStateException as 2 separate threads 
> are accessing the RootNexus.
> Java API for System.exit:
> The virtual machine's shutdown sequence consists of two phases. In the 
> first phase all registered shutdown hooks, if any, are started in some 
> unspecified order and allowed to run concurrently until they finish. 
> Example of shutting down (which is implicitly a part of our shutdownhook):
> Properties env = new Properties();
> env.setProperty(Context.PROVIDER_URL, "ou=system");
> env.setProperty(Context.INITIAL_CONTEXT_FACTORY, 
> "org.apache.ldap.server.jndi.ServerContextFactory");
> env.setProperty(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
> env.setProperty(Context.SECURITY_CREDENTIALS, "secret");
> env.setProperty(EnvKeys.SYNC, "true");
> env.setProperty(EnvKeys.SHUTDOWN, "true");
> new InitialDirContext(env);
> Maybe this is caused by the soluttion for bug report 
> http://issues.apache.org/jira/browse/DIREVE-92?
> I'm capable of reproducing this behavior in a small program which is attached.
> The program will ask for input (via System.in.read). When asked for input, please press Control-C to exit. The program will call the shutdown hook multiple times and will result in a 'Failed to sync all'.

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DIREVE-151) Shutting down server multiple times results in 'Failed to sync all'

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

First off what is Product X?  Just curious.

> Shutting down server multiple times results in 'Failed to sync all'
> -------------------------------------------------------------------
>
>          Key: DIREVE-151
>          URL: http://issues.apache.org/jira/browse/DIREVE-151
>      Project: Directory Server
>         Type: Bug
>     Versions: 0.9
>  Environment: Windows XP, J2SE 1.4.2_05, Apache 0.9 SNAPSHOT
>     Reporter: David Geleyn
>     Assignee: Alex Karasulu
>  Attachments: Test.java, out.txt
>
> Situation in which the error occurs:
> When shutting down server of Product X (which embeds Apache Directory Server) we 
> have some problems with shutting down the embeded LDAP server. One of the 
> reasons could be the addShutdownhook in RootNexus.java. When embedding the 
> LDAP server we need to add a shutdownhook ourselves to make sure the LDAP 
> server is gracefully shutdown (see code below). Among other things, the 
> shutdown of the embedded LDAP server seems to call the sync on the 
> RootNexus as well, causing an IllegalStateException as 2 separate threads 
> are accessing the RootNexus.
> Java API for System.exit:
> The virtual machine's shutdown sequence consists of two phases. In the 
> first phase all registered shutdown hooks, if any, are started in some 
> unspecified order and allowed to run concurrently until they finish. 
> Example of shutting down (which is implicitly a part of our shutdownhook):
> Properties env = new Properties();
> env.setProperty(Context.PROVIDER_URL, "ou=system");
> env.setProperty(Context.INITIAL_CONTEXT_FACTORY, 
> "org.apache.ldap.server.jndi.ServerContextFactory");
> env.setProperty(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
> env.setProperty(Context.SECURITY_CREDENTIALS, "secret");
> env.setProperty(EnvKeys.SYNC, "true");
> env.setProperty(EnvKeys.SHUTDOWN, "true");
> new InitialDirContext(env);
> Maybe this is caused by the soluttion for bug report 
> http://issues.apache.org/jira/browse/DIREVE-92?
> I'm capable of reproducing this behavior in a small program which is attached.
> The program will ask for input (via System.in.read). When asked for input, please press Control-C to exit. The program will call the shutdown hook multiple times and will result in a 'Failed to sync all'.

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (DIREVE-151) Shutting down server multiple times results in 'Failed to sync all'

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

    Resolution: Won't Fix

David, a Shutdown hook is invoked only when you're shutting down the JVM.  The test code you have here is not going to shutdown the JVM.  So you registered hooks will not run.  Looks like you're using the facility incorrectly.  

I'm going to close this issue.  You have to revisit exactly what you're doing in product X.  Plus don't worry about having to shut down the server on JVM exist.  The shutdown feature is only there if you are shutting down without JVM exists.  Like in test cases which build a database run tests, shut the server down, clean up and do this all over again without existing the JVM.  The server registers its own hooks to make sure data is not lost from the cache on the backend subsystem if there is a JVM exit.  You need not handle this manually.



> Shutting down server multiple times results in 'Failed to sync all'
> -------------------------------------------------------------------
>
>          Key: DIREVE-151
>          URL: http://issues.apache.org/jira/browse/DIREVE-151
>      Project: Directory Server
>         Type: Bug
>     Versions: 0.9
>  Environment: Windows XP, J2SE 1.4.2_05, Apache 0.9 SNAPSHOT
>     Reporter: David Geleyn
>     Assignee: Alex Karasulu
>      Fix For: 0.9
>  Attachments: Test.java, out.txt
>
> Situation in which the error occurs:
> When shutting down server of Product X (which embeds Apache Directory Server) we 
> have some problems with shutting down the embeded LDAP server. One of the 
> reasons could be the addShutdownhook in RootNexus.java. When embedding the 
> LDAP server we need to add a shutdownhook ourselves to make sure the LDAP 
> server is gracefully shutdown (see code below). Among other things, the 
> shutdown of the embedded LDAP server seems to call the sync on the 
> RootNexus as well, causing an IllegalStateException as 2 separate threads 
> are accessing the RootNexus.
> Java API for System.exit:
> The virtual machine's shutdown sequence consists of two phases. In the 
> first phase all registered shutdown hooks, if any, are started in some 
> unspecified order and allowed to run concurrently until they finish. 
> Example of shutting down (which is implicitly a part of our shutdownhook):
> Properties env = new Properties();
> env.setProperty(Context.PROVIDER_URL, "ou=system");
> env.setProperty(Context.INITIAL_CONTEXT_FACTORY, 
> "org.apache.ldap.server.jndi.ServerContextFactory");
> env.setProperty(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
> env.setProperty(Context.SECURITY_CREDENTIALS, "secret");
> env.setProperty(EnvKeys.SYNC, "true");
> env.setProperty(EnvKeys.SHUTDOWN, "true");
> new InitialDirContext(env);
> Maybe this is caused by the soluttion for bug report 
> http://issues.apache.org/jira/browse/DIREVE-92?
> I'm capable of reproducing this behavior in a small program which is attached.
> The program will ask for input (via System.in.read). When asked for input, please press Control-C to exit. The program will call the shutdown hook multiple times and will result in a 'Failed to sync all'.

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DIREVE-151) Shutting down server multiple times results in 'Failed to sync all'

Posted by "David Geleyn (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIREVE-151?page=comments#action_61751 ]
     
David Geleyn commented on DIREVE-151:
-------------------------------------

> The test code you have here is not going to shutdown the JVM. 
> So you registered hooks will not run.

The program will ask for input (via System.in.read). When asked for input, please press Control-C to exit the JVM. The program will call the shutdown hook multiple times and will result in a 'Failed to sync all'. The out.txt file I attached to the problem report contains lines written in the shutdown hook, so it is executed.

> The server registers its own hooks to make sure data is not lost from
> the cache on the backend subsystem if there is a JVM exit. 
> You need not handle this manually. 

Do we have to execute the following code in our shutdown hook to stop the JNDI provider/LDAP server? It's a snippet from the website...

Properties env = new Properties();
env.setProperty(Context.PROVIDER_URL, "ou=system");
env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.ldap.server.jndi.ServerContextFactory");
env.setProperty(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
env.setProperty(Context.SECURITY_CREDENTIALS, "secret");
env.setProperty(EnvKeys.SYNC, "true");
env.setProperty(EnvKeys.SHUTDOWN, "true");
new InitialDirContext(env);

I've downloaded new jars today and the problem still occurs...


> Shutting down server multiple times results in 'Failed to sync all'
> -------------------------------------------------------------------
>
>          Key: DIREVE-151
>          URL: http://issues.apache.org/jira/browse/DIREVE-151
>      Project: Directory Server
>         Type: Bug
>     Versions: 0.9
>  Environment: Windows XP, J2SE 1.4.2_05, Apache 0.9 SNAPSHOT
>     Reporter: David Geleyn
>     Assignee: Alex Karasulu
>      Fix For: 0.9
>  Attachments: Test.java, out.txt, out2.txt
>
> Situation in which the error occurs:
> When shutting down server of Product X (which embeds Apache Directory Server) we 
> have some problems with shutting down the embeded LDAP server. One of the 
> reasons could be the addShutdownhook in RootNexus.java. When embedding the 
> LDAP server we need to add a shutdownhook ourselves to make sure the LDAP 
> server is gracefully shutdown (see code below). Among other things, the 
> shutdown of the embedded LDAP server seems to call the sync on the 
> RootNexus as well, causing an IllegalStateException as 2 separate threads 
> are accessing the RootNexus.
> Java API for System.exit:
> The virtual machine's shutdown sequence consists of two phases. In the 
> first phase all registered shutdown hooks, if any, are started in some 
> unspecified order and allowed to run concurrently until they finish. 
> Example of shutting down (which is implicitly a part of our shutdownhook):
> Properties env = new Properties();
> env.setProperty(Context.PROVIDER_URL, "ou=system");
> env.setProperty(Context.INITIAL_CONTEXT_FACTORY, 
> "org.apache.ldap.server.jndi.ServerContextFactory");
> env.setProperty(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
> env.setProperty(Context.SECURITY_CREDENTIALS, "secret");
> env.setProperty(EnvKeys.SYNC, "true");
> env.setProperty(EnvKeys.SHUTDOWN, "true");
> new InitialDirContext(env);
> Maybe this is caused by the soluttion for bug report 
> http://issues.apache.org/jira/browse/DIREVE-92?
> I'm capable of reproducing this behavior in a small program which is attached.
> The program will ask for input (via System.in.read). When asked for input, please press Control-C to exit. The program will call the shutdown hook multiple times and will result in a 'Failed to sync all'.

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Closed: (DIRSERVER-380) Shutting down server multiple times results in 'Failed to sync all'

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

Emmanuel Lecharny closed DIRSERVER-380.
---------------------------------------


Closing all issues created in 2005 and before which are marked resolved

> Shutting down server multiple times results in 'Failed to sync all'
> -------------------------------------------------------------------
>
>                 Key: DIRSERVER-380
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-380
>             Project: Directory ApacheDS
>          Issue Type: Bug
>         Environment: Windows XP, J2SE 1.4.2_05, Apache 0.9 SNAPSHOT
>            Reporter: David Geleyn
>         Assigned To: Alex Karasulu
>         Attachments: out.txt, out2.txt, Test.java
>
>
> Situation in which the error occurs:
> When shutting down server of Product X (which embeds Apache Directory Server) we 
> have some problems with shutting down the embeded LDAP server. One of the 
> reasons could be the addShutdownhook in RootNexus.java. When embedding the 
> LDAP server we need to add a shutdownhook ourselves to make sure the LDAP 
> server is gracefully shutdown (see code below). Among other things, the 
> shutdown of the embedded LDAP server seems to call the sync on the 
> RootNexus as well, causing an IllegalStateException as 2 separate threads 
> are accessing the RootNexus.
> Java API for System.exit:
> The virtual machine's shutdown sequence consists of two phases. In the 
> first phase all registered shutdown hooks, if any, are started in some 
> unspecified order and allowed to run concurrently until they finish. 
> Example of shutting down (which is implicitly a part of our shutdownhook):
> Properties env = new Properties();
> env.setProperty(Context.PROVIDER_URL, "ou=system");
> env.setProperty(Context.INITIAL_CONTEXT_FACTORY, 
> "org.apache.ldap.server.jndi.ServerContextFactory");
> env.setProperty(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
> env.setProperty(Context.SECURITY_CREDENTIALS, "secret");
> env.setProperty(EnvKeys.SYNC, "true");
> env.setProperty(EnvKeys.SHUTDOWN, "true");
> new InitialDirContext(env);
> Maybe this is caused by the soluttion for bug report 
> http://issues.apache.org/jira/browse/DIREVE-92?
> I'm capable of reproducing this behavior in a small program which is attached.
> The program will ask for input (via System.in.read). When asked for input, please press Control-C to exit. The program will call the shutdown hook multiple times and will result in a 'Failed to sync all'.

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


[jira] Updated: (DIREVE-151) Shutting down server multiple times results in 'Failed to sync all'

Posted by "David Geleyn (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIREVE-151?page=history ]

David Geleyn updated DIREVE-151:
--------------------------------

    Attachment: out2.txt

This is a stacktrace that occurs when we exit the scriptura server.

> Shutting down server multiple times results in 'Failed to sync all'
> -------------------------------------------------------------------
>
>          Key: DIREVE-151
>          URL: http://issues.apache.org/jira/browse/DIREVE-151
>      Project: Directory Server
>         Type: Bug
>     Versions: 0.9
>  Environment: Windows XP, J2SE 1.4.2_05, Apache 0.9 SNAPSHOT
>     Reporter: David Geleyn
>     Assignee: Alex Karasulu
>      Fix For: 0.9
>  Attachments: Test.java, out.txt, out2.txt
>
> Situation in which the error occurs:
> When shutting down server of Product X (which embeds Apache Directory Server) we 
> have some problems with shutting down the embeded LDAP server. One of the 
> reasons could be the addShutdownhook in RootNexus.java. When embedding the 
> LDAP server we need to add a shutdownhook ourselves to make sure the LDAP 
> server is gracefully shutdown (see code below). Among other things, the 
> shutdown of the embedded LDAP server seems to call the sync on the 
> RootNexus as well, causing an IllegalStateException as 2 separate threads 
> are accessing the RootNexus.
> Java API for System.exit:
> The virtual machine's shutdown sequence consists of two phases. In the 
> first phase all registered shutdown hooks, if any, are started in some 
> unspecified order and allowed to run concurrently until they finish. 
> Example of shutting down (which is implicitly a part of our shutdownhook):
> Properties env = new Properties();
> env.setProperty(Context.PROVIDER_URL, "ou=system");
> env.setProperty(Context.INITIAL_CONTEXT_FACTORY, 
> "org.apache.ldap.server.jndi.ServerContextFactory");
> env.setProperty(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
> env.setProperty(Context.SECURITY_CREDENTIALS, "secret");
> env.setProperty(EnvKeys.SYNC, "true");
> env.setProperty(EnvKeys.SHUTDOWN, "true");
> new InitialDirContext(env);
> Maybe this is caused by the soluttion for bug report 
> http://issues.apache.org/jira/browse/DIREVE-92?
> I'm capable of reproducing this behavior in a small program which is attached.
> The program will ask for input (via System.in.read). When asked for input, please press Control-C to exit. The program will call the shutdown hook multiple times and will result in a 'Failed to sync all'.

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Re: [jira] Created: (DIREVE-151) Shutting down server multiple times results in 'Failed to sync all'

Posted by Da...@inventivedesigners.com.
Hi,

At this point we're not capable to gracefully shutdown our sever due to 
this issue. 
We're willing to hunt down the bug ourselfs, but it would be nice to give 
us some hints.
- Is it an Apache DS issue or a JDBM issue?
- Where do we have to look? Any idea where there is non thread-safe code?
- I already asked this in an other post but... How about upgrading? Assume 
we're using a snapshot version of 0.9 in our release X.Y.0 and some months 
later we release X.Y.1 with a new ApacheDS (the release 0.9). Will the 
databases be compatible? Will there be an export/import functionality?

Thanks!

David.


--------------------------------------------------
Inventive Designers' Email Disclaimer:

http://www.inventivedesigners.com/email-disclaimer

[jira] Updated: (DIREVE-151) Shutting down server multiple times results in 'Failed to sync all'

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

Alex Karasulu updated DIREVE-151:
---------------------------------

    Fix Version: 0.9

Looking into this now.

> Shutting down server multiple times results in 'Failed to sync all'
> -------------------------------------------------------------------
>
>          Key: DIREVE-151
>          URL: http://issues.apache.org/jira/browse/DIREVE-151
>      Project: Directory Server
>         Type: Bug
>     Versions: 0.9
>  Environment: Windows XP, J2SE 1.4.2_05, Apache 0.9 SNAPSHOT
>     Reporter: David Geleyn
>     Assignee: Alex Karasulu
>      Fix For: 0.9
>  Attachments: Test.java, out.txt
>
> Situation in which the error occurs:
> When shutting down server of Product X (which embeds Apache Directory Server) we 
> have some problems with shutting down the embeded LDAP server. One of the 
> reasons could be the addShutdownhook in RootNexus.java. When embedding the 
> LDAP server we need to add a shutdownhook ourselves to make sure the LDAP 
> server is gracefully shutdown (see code below). Among other things, the 
> shutdown of the embedded LDAP server seems to call the sync on the 
> RootNexus as well, causing an IllegalStateException as 2 separate threads 
> are accessing the RootNexus.
> Java API for System.exit:
> The virtual machine's shutdown sequence consists of two phases. In the 
> first phase all registered shutdown hooks, if any, are started in some 
> unspecified order and allowed to run concurrently until they finish. 
> Example of shutting down (which is implicitly a part of our shutdownhook):
> Properties env = new Properties();
> env.setProperty(Context.PROVIDER_URL, "ou=system");
> env.setProperty(Context.INITIAL_CONTEXT_FACTORY, 
> "org.apache.ldap.server.jndi.ServerContextFactory");
> env.setProperty(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
> env.setProperty(Context.SECURITY_CREDENTIALS, "secret");
> env.setProperty(EnvKeys.SYNC, "true");
> env.setProperty(EnvKeys.SHUTDOWN, "true");
> new InitialDirContext(env);
> Maybe this is caused by the soluttion for bug report 
> http://issues.apache.org/jira/browse/DIREVE-92?
> I'm capable of reproducing this behavior in a small program which is attached.
> The program will ask for input (via System.in.read). When asked for input, please press Control-C to exit. The program will call the shutdown hook multiple times and will result in a 'Failed to sync all'.

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DIREVE-151) Shutting down server multiple times results in 'Failed to sync all'

Posted by "David Geleyn (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIREVE-151?page=history ]

David Geleyn updated DIREVE-151:
--------------------------------

    Attachment: out.txt

The output of the test program

> Shutting down server multiple times results in 'Failed to sync all'
> -------------------------------------------------------------------
>
>          Key: DIREVE-151
>          URL: http://issues.apache.org/jira/browse/DIREVE-151
>      Project: Directory Server
>         Type: Bug
>     Versions: 0.9
>  Environment: Windows XP, J2SE 1.4.2_05, Apache 0.9 SNAPSHOT
>     Reporter: David Geleyn
>     Assignee: Alex Karasulu
>  Attachments: Test.java, out.txt
>
> Situation in which the error occurs:
> When shutting down server of Product X (which embeds Apache Directory Server) we 
> have some problems with shutting down the embeded LDAP server. One of the 
> reasons could be the addShutdownhook in RootNexus.java. When embedding the 
> LDAP server we need to add a shutdownhook ourselves to make sure the LDAP 
> server is gracefully shutdown (see code below). Among other things, the 
> shutdown of the embedded LDAP server seems to call the sync on the 
> RootNexus as well, causing an IllegalStateException as 2 separate threads 
> are accessing the RootNexus.
> Java API for System.exit:
> The virtual machine's shutdown sequence consists of two phases. In the 
> first phase all registered shutdown hooks, if any, are started in some 
> unspecified order and allowed to run concurrently until they finish. 
> Example of shutting down (which is implicitly a part of our shutdownhook):
> Properties env = new Properties();
> env.setProperty(Context.PROVIDER_URL, "ou=system");
> env.setProperty(Context.INITIAL_CONTEXT_FACTORY, 
> "org.apache.ldap.server.jndi.ServerContextFactory");
> env.setProperty(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
> env.setProperty(Context.SECURITY_CREDENTIALS, "secret");
> env.setProperty(EnvKeys.SYNC, "true");
> env.setProperty(EnvKeys.SHUTDOWN, "true");
> new InitialDirContext(env);
> Maybe this is caused by the soluttion for bug report 
> http://issues.apache.org/jira/browse/DIREVE-92?
> I'm capable of reproducing this behavior in a small program which is attached.
> The program will ask for input (via System.in.read). When asked for input, please press Control-C to exit. The program will call the shutdown hook multiple times and will result in a 'Failed to sync all'.

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DIREVE-151) Shutting down server multiple times results in 'Failed to sync all'

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

Yah this stack trace is a result of trying to close the database when it has already been closed so its harmless.  The thing is are you shutting down the server explicitly somewhere?  If so remove that code and try shutting down again.  The server will naturally apply its own shutdown hook.  

Also perhaps we can make the shutdown hook inside the server check if the server is already shutdown before trying again to avoid this trace.  Let me know what your results are if you remove the your hook that shutsdown the LDAP server.  Based on that we might mess with the hook inside apacheds.

> Shutting down server multiple times results in 'Failed to sync all'
> -------------------------------------------------------------------
>
>          Key: DIREVE-151
>          URL: http://issues.apache.org/jira/browse/DIREVE-151
>      Project: Directory Server
>         Type: Bug
>     Versions: 0.9
>  Environment: Windows XP, J2SE 1.4.2_05, Apache 0.9 SNAPSHOT
>     Reporter: David Geleyn
>     Assignee: Alex Karasulu
>      Fix For: 0.9
>  Attachments: Test.java, out.txt, out2.txt
>
> Situation in which the error occurs:
> When shutting down server of Product X (which embeds Apache Directory Server) we 
> have some problems with shutting down the embeded LDAP server. One of the 
> reasons could be the addShutdownhook in RootNexus.java. When embedding the 
> LDAP server we need to add a shutdownhook ourselves to make sure the LDAP 
> server is gracefully shutdown (see code below). Among other things, the 
> shutdown of the embedded LDAP server seems to call the sync on the 
> RootNexus as well, causing an IllegalStateException as 2 separate threads 
> are accessing the RootNexus.
> Java API for System.exit:
> The virtual machine's shutdown sequence consists of two phases. In the 
> first phase all registered shutdown hooks, if any, are started in some 
> unspecified order and allowed to run concurrently until they finish. 
> Example of shutting down (which is implicitly a part of our shutdownhook):
> Properties env = new Properties();
> env.setProperty(Context.PROVIDER_URL, "ou=system");
> env.setProperty(Context.INITIAL_CONTEXT_FACTORY, 
> "org.apache.ldap.server.jndi.ServerContextFactory");
> env.setProperty(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
> env.setProperty(Context.SECURITY_CREDENTIALS, "secret");
> env.setProperty(EnvKeys.SYNC, "true");
> env.setProperty(EnvKeys.SHUTDOWN, "true");
> new InitialDirContext(env);
> Maybe this is caused by the soluttion for bug report 
> http://issues.apache.org/jira/browse/DIREVE-92?
> I'm capable of reproducing this behavior in a small program which is attached.
> The program will ask for input (via System.in.read). When asked for input, please press Control-C to exit. The program will call the shutdown hook multiple times and will result in a 'Failed to sync all'.

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira