pwadas(a)jewish.org.pl wrote:
> Full_Name: Piotr Wadas
> Version: 2.4.7 upto 2.4.9
> OS: debian 2.6.18+ kernel
> URL:
> Submission from: (NULL) (195.95.182.4)
>
>
> The issue is discussed at
> http://www.openldap.org/lists/openldap-software/200805/msg00136.html
>
> List message contains debug information, steps to reproduce,
> backtrace logs etc.
> Issue appears since 2.4.7 in 2.4 series.
The config info you posted is missing your index configuration, which is most
relevant here.
From your traces, we could use a little more info as well:
frame 4
print *ava->aa_desc
print *mr
>
> gdb bt quick ref:
>
> #0 0xb7b4842c in free () from /usr/lib/i486-linux-gnu/i686/cmov/libc.so.6
> #1 0xb7e901aa in ber_memfree_x (p=0x0, ctx=0x0) at
> /home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/libraries/liblber/memory.c:152
> #2 0xb7e9019c in ber_memfree_x (p=0x0, ctx=0x0) at
> /home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/libraries/liblber/memory.c:159
> #3 0xb7e90235 in ber_bvarray_free_x (a=0xa96e3354, ctx=0x8279658) at
> /home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/libraries/liblber/memory.c:731
> #4 0xb73028e5 in bdb_filter_candidates (op=0x82792e0, locker=34, f=0xa96e325c,
> ids=0xa9062008, tmp=0xa8ee2008, stack=0xa90e2008)
> at /home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/servers/slapd/back-bdb/filterindex.c:803
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/
emmanuel.duru(a)atosorigin.com wrote:
> Full_Name: Emmanuel Duru
> Version: 2.3.39
> OS: Windows
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (195.68.44.148)
> In t61.c/ldap_utf8s_to_t61s(), the second loop is an infinite loop, there misses
> a "i += j; c += j" at the end of the loop.
Congratulations, you're the first person to use this code in over 6 years. Out
of curiosity, why do you need it?
Thanks for the report, fixed in CVS.
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/
Full_Name: Emmanuel Duru
Version: 2.3.39
OS: Windows
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (195.68.44.148)
In t61.c/ldap_utf8s_to_t61s(), the second loop is an infinite loop, there misses
a "i += j; c += j" at the end of the loop.
Full_Name: Piotr Wadas
Version: 2.4.7 upto 2.4.9
OS: debian 2.6.18+ kernel
URL:
Submission from: (NULL) (195.95.182.4)
The issue is discussed at
http://www.openldap.org/lists/openldap-software/200805/msg00136.html
List message contains debug information, steps to reproduce,
backtrace logs etc.
Issue appears since 2.4.7 in 2.4 series.
gdb bt quick ref:
#0 0xb7b4842c in free () from /usr/lib/i486-linux-gnu/i686/cmov/libc.so.6
#1 0xb7e901aa in ber_memfree_x (p=0x0, ctx=0x0) at
/home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/libraries/liblber/memory.c:152
#2 0xb7e9019c in ber_memfree_x (p=0x0, ctx=0x0) at
/home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/libraries/liblber/memory.c:159
#3 0xb7e90235 in ber_bvarray_free_x (a=0xa96e3354, ctx=0x8279658) at
/home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/libraries/liblber/memory.c:731
#4 0xb73028e5 in bdb_filter_candidates (op=0x82792e0, locker=34, f=0xa96e325c,
ids=0xa9062008, tmp=0xa8ee2008, stack=0xa90e2008)
at /home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/servers/slapd/back-bdb/filterindex.c:803
#5 0xb7303064 in list_candidates (op=0x82792e0, locker=34, flist=0xa96e31ec,
ftype=160, ids=0xa8fe2008, tmp=0xa8ee2008, save=0xa9062008)
at /home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/servers/slapd/back-bdb/filterindex.c:581
#6 0xb73017c7 in bdb_filter_candidates (op=0x82792e0, locker=34, f=0xa96e32bc,
ids=0xa8fe2008, tmp=0xa8ee2008, stack=0xa9062008)
at /home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/servers/slapd/back-bdb/filterindex.c:198
#7 0xb7303064 in list_candidates (op=0x82792e0, locker=34, flist=0xa9be2ec8,
ftype=161, ids=0xa8f62008, tmp=0xa8ee2008, save=0xa8fe2008)
at /home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/servers/slapd/back-bdb/filterindex.c:581
#8 0xb73015ca in bdb_filter_candidates (op=0x82792e0, locker=34, f=0xa9be2ebc,
ids=0xa8f62008, tmp=0xa8ee2008, stack=0xa8fe2008)
at /home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/servers/slapd/back-bdb/filterindex.c:204
#9 0xb7303064 in list_candidates (op=0x82792e0, locker=34, flist=0xa9be2eb0,
ftype=160, ids=0xa9b22e1c, tmp=0xa8ee2008, save=0xa8f62008)
at /home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/servers/slapd/back-bdb/filterindex.c:581
#10 0xb73017c7 in bdb_filter_candidates (op=0x82792e0, locker=34, f=0xa9be2ed4,
ids=0xa9b22e1c, tmp=0xa8ee2008, stack=0xa8f62008)
at /home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/servers/slapd/back-bdb/filterindex.c:198
#11 0xb72fc858 in bdb_search (op=0x82792e0, rs=0xa9be4168) at
/home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/servers/slapd/back-bdb/search.c:1109
#12 0x080d76f1 in overlay_op_walk (op=0x82792e0, rs=0xa9be4168, which=op_search,
oi=0x81f63d8, on=0x81f64d8) at
/home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/servers/slapd/backover.c:646
#13 0x080d7c5d in over_op_func (op=0x82792e0, rs=0xa9be4168, which=op_search) at
/home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/servers/slapd/backover.c:698
#14 0x08077fd3 in fe_op_search (op=0x82792e0, rs=0xa9be4168) at
/home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/servers/slapd/search.c:366
#15 0x080787fc in do_search (op=0x82792e0, rs=0xa9be4168) at
/home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/servers/slapd/search.c:217
#16 0x08075a9f in connection_operation (ctx=0xa9be4248, arg_v=0x82792e0) at
/home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/servers/slapd/connection.c:1084
#17 0x08076196 in connection_read_thread (ctx=0xa9be4248, argv=0x10) at
/home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/servers/slapd/connection.c:1211
#18 0xb7ea1d64 in ldap_int_thread_pool_wrapper (xpool=0x81b09b8) at
/home/pwadas/SRC/SLAPD/DEB249/openldap2.3-2.4.9/libraries/libldap_r/tpool.c:663
#19 0xb7c2c4fb in start_thread () from
/usr/lib/i486-linux-gnu/i686/cmov/libpthread.so.0
#20 0xb7bafe8e in clone () from /usr/lib/i486-linux-gnu/i686/cmov/libc.so.6
This is a multi-part message in MIME format.
--------------050600010007030200030106
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
hyc(a)symas.com wrote:
> We'll probably need to discuss on the -devel list what steps to take from here.
>
I wrote the attached patch for the original issue. Unfortunately it asserted
right away:
[Switching to Thread 1090525504 (LWP 23577)]
0x00002b55e738d535 in raise () from /lib64/libc.so.6
(gdb) bt
#0 0x00002b55e738d535 in raise () from /lib64/libc.so.6
#1 0x00002b55e738e990 in abort () from /lib64/libc.so.6
#2 0x00002b55e7386c16 in __assert_fail () from /lib64/libc.so.6
#3 0x00000000004410e5 in attr_valadd (a=0xb866c8, vals=0x41000670, nvals=0x0,
nn=1) at ../../../r24/servers/slapd/attr.c:394
#4 0x0000000000441a06 in attr_merge_one (e=0xb72c08, desc=0x8b3780,
val=0x41000670, nval=0x0)
at ../../../r24/servers/slapd/attr.c:599
#5 0x000000000043ea0f in slap_add_opattrs (op=0x965ec0, text=<value optimized
out>, textbuf=<value optimized out>,
textlen=<value optimized out>, manage_ctxcsn=<value optimized out>) at
../../../r24/servers/slapd/add.c:664
#6 0x00000000004d9c42 in hdb_add (op=0x965ec0, rs=0x41000ca0) at add.c:108
#7 0x000000000043f1a6 in fe_op_add (op=0x965ec0, rs=0x41000ca0) at
../../../r24/servers/slapd/add.c:334
#8 0x000000000043fa12 in do_add (op=0x965ec0, rs=0x41000ca0) at
../../../r24/servers/slapd/add.c:194
#9 0x00000000004383a7 in connection_operation (ctx=0x41000de0,
arg_v=0x965ec0) at ../../../r24/servers/slapd/connection.c:1084
#10 0x00000000004388cf in connection_read_thread (ctx=0x41000de0, argv=0xc) at
../../../r24/servers/slapd/connection.c:1211
#11 0x000000000054b8ca in ldap_int_thread_pool_wrapper (xpool=0x8bf070) at
../../../r24/libraries/libldap_r/tpool.c:663
#12 0x00002b55e655e09e in start_thread () from /lib64/libpthread.so.0
#13 0x00002b55e741e4cd in clone () from /lib64/libc.so.6
#14 0x0000000000000000 in ?? ()
It was adding the createTimestamp attribute, without providing normalized
values. slap_add_opattrs was written before the generalizedTimeNormalize
function was written... I suspect there will be a fair number of cases that
need to be cleaned up. I don't have time at the moment to chase them all down.
Anyone else want to jump in here? If not, we may have to push this back a bit.
Note that this patch will probably require a fair number of databases to be
reloaded.
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/
--------------050600010007030200030106
Content-Type: text/plain;
name="dif.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="dif.txt"
Index: attr.c
===================================================================
RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/attr.c,v
retrieving revision 1.112.2.7
diff -u -r1.112.2.7 attr.c
--- attr.c 11 Feb 2008 23:26:43 -0000 1.112.2.7
+++ attr.c 30 May 2008 09:33:43 -0000
@@ -366,8 +366,39 @@
BerVarray nvals,
int nn )
{
- int i;
BerVarray v2;
+ int i;
+
+ {
+ /* FIXME: if the schema has been edited, and an equality matching rule
+ * has been added or removed from the attribute definition, the database
+ * values may no longer be in sync with our expectations. Currently this
+ * means the DB must be reloaded.
+ */
+ int have_norm, have_nval, new_nval;
+ have_norm = a->a_desc->ad_type->sat_equality->smr_normalize != NULL;
+ have_nval = a->a_nvals != a->a_vals;
+ new_nval = nvals != NULL;
+
+ /* this check is only relevant if any values already exist */
+ if ( a->a_vals != NULL && have_norm != have_nval ) {
+ Debug(LDAP_DEBUG_ANY,
+ "attr_valadd: database inconsistent with schema definition of %s, reload the DB\n",
+ a->a_desc->ad_cname.bv_val, 0, 0 );
+ return LDAP_OTHER;
+ /* no need to compare have_nval with new_nval; by transitivity they will match if
+ * the above check and the following check succeed.
+ */
+ }
+
+ assert( have_norm == new_nval );
+ if ( have_norm != new_nval ) {
+ Debug(LDAP_DEBUG_ANY,
+ "attr_valadd: new values of %s not properly normalized (should never happen!)\n",
+ a->a_desc->ad_cname.bv_val, 0, 0 );
+ return LDAP_OTHER;
+ }
+ }
v2 = (BerVarray) SLAP_REALLOC( (char *) a->a_vals,
(a->a_numvals + nn + 1) * sizeof(struct berval) );
@@ -469,15 +500,6 @@
if ( *a == NULL ) {
*a = attr_alloc( desc );
- } else {
- /*
- * FIXME: if the attribute already exists, the presence
- * of nvals and the value of (*a)->a_nvals must be consistent
- */
- assert( ( nvals == NULL && (*a)->a_nvals == (*a)->a_vals )
- || ( nvals != NULL && (
- ( (*a)->a_vals == NULL && (*a)->a_nvals == NULL )
- || ( (*a)->a_nvals != (*a)->a_vals ) ) ) );
}
if ( vals != NULL ) {
--------------050600010007030200030106--
unix.gurus(a)gmail.com wrote:
> ------=_Part_4694_18767492.1212106829556
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: base64
> Content-Disposition: inline
>
> VGhpcyBiYWNrdHJhY2UgbWF5IHByb3ZpZGUgc29tZSBmdXJ0aGVyIGluZm86CgojMCAgMHgwMDAw
> N2Y3MjU1OGFhMDk1IGluIHJhaXNlICgpIGZyb20gL2xpYi9saWJjLnNvLjYKIzEgIDB4MDAwMDdm
> NzI1NThhYmFmMCBpbiBhYm9ydCAoKSBmcm9tIC9saWIvbGliYy5zby42CiMyICAweDAwMDA3Zjcy
> NTU4YTMyZGYgaW4gX19hc3NlcnRfZmFpbCAoKSBmcm9tIC9saWIvbGliYy5zby42CiMzICAweDAw
Thanks, the original report was sufficient. It surfaces a larger problem,
which we've been ignoring up till now. The correct action would be to iterate
through all the databases and generate the normalized values for all the
affected attributes. There is currently no code to make that happen though.
(Likewise, if deleting matching rules, the normalized values must also be
deleted.) As such, the only way to progress after such a change would be to
dump and reload the DBs (slapcat/slapadd).
We'll probably need to discuss on the -devel list what steps to take from here.
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/
Full_Name: Sean Burford
Version: 2.4.9
OS: Linux x86_64
URL: ftp://ftp.openldap.org/incoming/sean-burford-080529.tar.gz.1
Submission from: (NULL) (76.104.224.20)
Adding equality and substring matching to an existing in use attribute causes
the schema and database contents to mismatch. I added equality and substring
matching to an attribute in my schema. A modification of an attribute value was
propogated a few days later, triggering the assertion and taking my replicas
offline. Each restart replicated the change and triggered the assertion again.
When no matching is specified, new database entries do not have their normalized
value populated in the database. When the matching is added, new database
entries with have their normalized value populated in the database. There is an
assertion in attr.c that checks that attributes from the database have the
expected normalization.
I have attached a script and config to demonstrate the issue
(ftp://ftp.openldap.org/incoming/sean-burford-080529.tar.gz.1)
These files are in the tarball:
slapd.d/ contains a server configuration that is suitable for reproducing the
problem.
script/trigger-assertion.sh performs the ldap operations necessary to trigger
the assertion. The important ones are:
- An attribute is added to the schema without equality matching.
- An entry is added to the directory that uses the new attribute.
- The schema is modified so that the attribute has equality matching.
- Another attribute value is added to the entry, triggering the assertion.
patch/attr-assertion.patch causes the operation to be rejected and logged,
rather than triggering the assertion. It might not be the optimal patch
for this problem, but it prevents the assertion and rejects the operation.
hyc(a)symas.com wrote:
> Rein Tollevik wrote:
>> My thought was that with serverID=0 reserved for the true single-master
>> configuration and tool mode we could safely ignore a contextCSN with 0 in
>> the sid field when serverID>0 is in use (to get rid of values already
>> in the databases). At startup syncprov could update its own contextCSN
>> value with newer entryCSN values that has 0 in the sid field. Ref
>> ITS#5537. Slapadd'ing on more than one master without synchronizing
>> them between each run could still be a potential problem though..
>
> That's not a viable solution.
>
> The syncprov startup check is primarily to recover from unclean shutdowns.
> I.e., it's looking for newer CSNs that may have been saved before syncprov got
> a chance to write its final checkpoint. Ignoring values, or giving special
> treatment to sid 0 isn't going to work for that purpose.
Hm, have to think about this some more.
Generally, slapadd/slapindex require the directory to be offline. As such, if
you have any running servers, you should be adding entries using ldapadd, not
slapadd. So I'm going to ignore this case for now.
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/
Rein Tollevik wrote:
> Yes, this is a sort of multi-master configuration, but not what I think
> of when I hear it (and read the doc). The doc. could be clearer that
> different serverID values are always required when there are multiple
> master servers, even if the configuration ensures that there will never be
> more than one master for any backend.
We should update the manpages with this ITS as well then.
> Btw, if I have understood things correctly there cannot safely be more
> then one subordinate db (in a glued environment) that replicates from any
> single master,
If the master has multiple DBs, and they're being separately replicated into a
single DB, that would be a problem (regardless of glue on the consumer). If
the DBs are glued on the master, then there's no problem.
> My thought was that with serverID=0 reserved for the true single-master
> configuration and tool mode we could safely ignore a contextCSN with 0 in
> the sid field when serverID>0 is in use (to get rid of values already
> in the databases). At startup syncprov could update its own contextCSN
> value with newer entryCSN values that has 0 in the sid field. Ref
> ITS#5537. Slapadd'ing on more than one master without synchronizing
> them between each run could still be a potential problem though..
That's not a viable solution.
The syncprov startup check is primarily to recover from unclean shutdowns.
I.e., it's looking for newer CSNs that may have been saved before syncprov got
a chance to write its final checkpoint. Ignoring values, or giving special
treatment to sid 0 isn't going to work for that purpose.
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/