[
https://issues.apache.org/jira/browse/DIRSERVER-1912?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14137016#comment-14137016
]
Patrick Decat commented on DIRSERVER-1912:
------------------------------------------
Hi, I have reproduced this issue using 2.0.0-M17 with this stripped down unit
test:
{noformat:title=DummyTestKo.java}
import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport;
import org.apache.directory.server.core.annotations.ApplyLdifFiles;
import org.apache.directory.server.core.annotations.CreateDS;
import org.apache.directory.server.core.annotations.CreatePartition;
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.server.core.integ.FrameworkRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* This unit test fails at shutdown with Apache DS 2.0.0-M17:
ERROR o.a.d.s.core.integ.FrameworkRunner run - ERR_181 Failed to run the
class DummyTestKo
ERROR o.a.d.s.core.integ.FrameworkRunner run - ERR_265 Grouping many
exceptions on root nexus sync()
org.apache.directory.api.ldap.model.exception.LdapOperationErrorException
at
org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition.saveContextCsn(AbstractBTreePartition.java:3333)
at
org.apache.directory.server.core.shared.partition.DefaultPartitionNexus.sync(DefaultPartitionNexus.java:319)
at
org.apache.directory.server.core.DefaultDirectoryService.shutdown(DefaultDirectoryService.java:1283)
at
org.apache.directory.server.core.integ.FrameworkRunner.run(FrameworkRunner.java:171)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.NullPointerException
at
org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition.saveContextCsn(AbstractBTreePartition.java:3319)
... 9 more
*/
@RunWith(FrameworkRunner.class)
@CreateDS(allowAnonAccess = true, name = "Test", partitions = {
@CreatePartition(name = "Test", suffix = "o=TEST")})
@CreateLdapServer(transports = { @CreateTransport(protocol = "LDAP") })
public class DummyTestKo extends AbstractLdapTestUnit {
@Test
@ApplyLdifFiles("ldap-example-data-with-top-domain.ldif")
public void dummyTest() {
}
}
{noformat}
LDIF data:
{noformat:title=ldap-example-data-with-top-domain.ldif}
version: 1
#################################################
#
# host: localhost
# port: 10389
# user: uid=admin,ou=system
# password: secret
# base dn: o=TEST
#
#################################################
dn: o=TEST
objectclass: domain
objectclass: top
objectclass: extensibleObject
dc: TEST
o: TEST
dn: ou=applications,o=TEST
objectclass: organizationalUnit
objectclass: top
ou: applications
{noformat}
To work-around the issue, you have to define the contextEntry on the
@CreatePartition annotation:
{noformat:title=DummyTestOk.java}
import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport;
import org.apache.directory.server.core.annotations.ApplyLdifFiles;
import org.apache.directory.server.core.annotations.ContextEntry;
import org.apache.directory.server.core.annotations.CreateDS;
import org.apache.directory.server.core.annotations.CreatePartition;
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.server.core.integ.FrameworkRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* This unit test works with Apache DS 2.0.0-M17
*/
@RunWith(FrameworkRunner.class)
@CreateDS(allowAnonAccess = true, name = "Test", partitions = {
@CreatePartition(name = "Test", suffix = "o=TEST",
contextEntry =
@ContextEntry(entryLdif = "dn: o=TEST\n"
+ "objectclass:
domain\n"
+ "objectclass:
top\n"
+ "objectclass:
extensibleObject\n" + "dc: TEST\n" + "o: TEST")) })
@CreateLdapServer(transports = { @CreateTransport(protocol = "LDAP") })
public class DummyTestOk extends AbstractLdapTestUnit {
@Test
@ApplyLdifFiles("ldap-example-data-without-top-domain.ldif")
public void dummyTest() {
}
}
{noformat}
LDIF data:
{noformat:title=ldap-example-data-without-top-domain.ldif}
version: 1
#################################################
#
# host: localhost
# port: 10389
# user: uid=admin,ou=system
# password: secret
# base dn: o=TEST
#
#################################################
# Defined by the unit test class to work-around
https://issues.apache.org/jira/browse/DIRSERVER-1912
#dn: o=TEST
#objectclass: domain
#objectclass: top
#objectclass: extensibleObject
#dc: TEST
#o: TEST
dn: ou=applications,o=TEST
objectclass: organizationalUnit
objectclass: top
ou: applications
{noformat}
> Shutdown process fails from a NPE in AbstractBTreePartition
> -----------------------------------------------------------
>
> Key: DIRSERVER-1912
> URL: https://issues.apache.org/jira/browse/DIRSERVER-1912
> Project: Directory ApacheDS
> Issue Type: Bug
> Affects Versions: 2.0.0-M15
> Reporter: Mark DeBusschere
>
> During shutdown a NPE is thrown and stops the shutdown process.
> [22:38:54] DEBUG [org.apache.directory.server.core.DefaultDirectoryService] -
> +++ DirectoryService Shutdown required
> [22:38:54] DEBUG [org.apache.directory.server.core.DefaultDirectoryService] -
> --- Syncing the nexus
> [22:38:54] DEBUG
> [org.apache.directory.api.ldap.model.schema.syntaxCheckers.CsnSyntaxChecker]
> - Syntax valid for '20130826073011.649000Z#000000#001#000000'
> [22:38:54] DEBUG
> [org.apache.directory.api.ldap.model.schema.syntaxCheckers.GeneralizedTimeSyntaxChecker]
> - Syntax valid for '20131102053854.055Z'
> [22:38:54] DEBUG
> [org.apache.directory.api.ldap.model.schema.comparators.UuidComparator] -
> comparing UUID objects '55e570e6-68be-4175-a2f5-72b0a008b365' with
> 'ff64c5d1-d2ec-441e-a1c0-306c89de2264'
> [22:38:54] DEBUG
> [org.apache.directory.api.ldap.model.schema.comparators.UuidComparator] -
> comparing UUID objects 'da0b5bea-a4b2-4059-ac8d-78eee3aa0c1b' with
> 'ff64c5d1-d2ec-441e-a1c0-306c89de2264'
> [22:38:54] DEBUG
> [org.apache.directory.api.ldap.model.schema.comparators.UuidComparator] -
> comparing UUID objects 'ff64c5d1-d2ec-441e-a1c0-306c89de2264' with
> 'ff64c5d1-d2ec-441e-a1c0-306c89de2264'
> [22:38:54] DEBUG
> [org.apache.directory.api.ldap.model.schema.comparators.UuidComparator] -
> comparing UUID objects 'ff64c5d1-d2ec-441e-a1c0-306c89de2264' with
> 'ff64c5d1-d2ec-441e-a1c0-306c89de2264'
> [22:38:54] DEBUG
> [org.apache.directory.api.ldap.model.schema.registries.DefaultSchemaObjectRegistry]
> - Found ATTRIBUTE_TYPE ( 1.3.6.1.4.1.4203.666.1.7
> NAME 'entryCSN'
> DESC change sequence number of the entry
> EQUALITY csnMatch
> ORDERING csnOrderingMatch
> SYNTAX 1.3.6.1.4.1.4203.666.11.2.1
> SINGLE-VALUE
> NO-USER-MODIFICATION
> USAGE directoryOperation
> )
> with oid: entrycsn
> [22:38:54] WARN
> [org.apache.directory.server.core.shared.partition.DefaultPartitionNexus] -
> Failed to save the contextCSN attribute value in ou=system entry.
> org.apache.directory.api.ldap.model.exception.LdapOperationErrorException
> at
> org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition.modify(AbstractBTreePartition.java:1223)
> at
> org.apache.directory.server.core.shared.partition.DefaultPartitionNexus.sync(DefaultPartitionNexus.java:335)
> at
> org.apache.directory.server.core.DefaultDirectoryService.shutdown(DefaultDirectoryService.java:1298)
> at
> org.apache.directory.server.core.DefaultDirectoryService$1.run(DefaultDirectoryService.java:1229)
> at java.lang.Thread.run(Thread.java:724)
> Caused by: java.lang.NullPointerException
> at
> org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition.updateCsnIndex(AbstractBTreePartition.java:2163)
> at
> org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition.modify(AbstractBTreePartition.java:1259)
> at
> org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition.modify(AbstractBTreePartition.java:1213)
> ... 4 more
> [22:38:54] WARN [org.apache.directory.server.core.DefaultDirectoryService] -
> Failed to shut down the directory service: default
> org.apache.directory.api.util.exception.MultiException: ERR_265 Grouping many
> exceptions on root nexus sync()
> at
> org.apache.directory.server.core.shared.partition.DefaultPartitionNexus.sync(DefaultPartitionNexus.java:343)
> at
> org.apache.directory.server.core.DefaultDirectoryService.shutdown(DefaultDirectoryService.java:1298)
> at
> org.apache.directory.server.core.DefaultDirectoryService$1.run(DefaultDirectoryService.java:1229)
> at java.lang.Thread.run(Thread.java:724)
> Nested exceptions to follow:
> ----------- Debug information
> There is no ENTRY_CSN in the entry object hence returns a null.
> in private void updateCsnIndex( Entry entry, String id ) throws Exception
> {
> String entryCsn = entry.get( SchemaConstants.ENTRY_CSN_AT
> ).getString();
> entryCsnIdx.drop( id );
> entryCsnIdx.add( entryCsn, id );
> }
> ---- The 'entry' object is the following.
> dn[n]: ou=system
> objectclass: top
> objectclass: organizationalUnit
> description: The System context entry
> contextCSN: 20130826073011.649000Z#000000#001#000000
> entryParentId: 00000000-0000-0000-0000-000000000000
> ou: system
> entryUUID: ff64c5d1-d2ec-441e-a1c0-306c89de2264
> modifyTimestamp: 20131102091722.945Z
> I am not sure if the bug is ENTRY_CSN was not found, or this is a valid
> case and the f() should check for NULL following entry.get()
> Using default instance from fresh install this case doesn't show up.
> I tested with adding a check for null and just returned and shutdown appears
> to
> finish without error.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)