> On Thu, 2011-09-29 at 16:56 +0200, Jan Zelený wrote:
> > > Jan Zelený <jzel...@redhat.com> writes:
> > > >> > As you described it, it looks like issue similar to what Stephen
> > > >> > found earlier and is now fixed. It probably isn't caused by the
> > > >> > size of groups but rather membership structure. Could you be more
> > > >> > specific how the structure is organized? Do you use rfc2307 or
> > > >> > rfc2307bis? If the latter is the case, how deep your membership
> > > >> > structure goes and how does it approximately look like?
> > > >> 
> > > >> This is rfc2307.
> > > > 
> > > > There must be something else going on. I tested 2307 on a group with
> > > > ~1000 users and I found no problem.
> > > > 
> > > > Could you provide me a backtrace of the place where the process
> > > > hangs? Any other information you might have will be useful as well.
> > > 
> > > I don't have a backtrace, since I compiled this as an rpm. However, an
> > > strace of sssd_be hopefully holds a clue or two:
> > > PS. I forgot to mention that I'm using sssd 1.5.12 + memberof patch on
> > > rhel6 x86_64, since it required the least amount of effort to compile
> > > and install.
> > > 
> > > Regards,
> > 
> > I managed to reproduce this issue, however I'm not sure it was related to
> > the plugin itself. What seemed to resolve it was update to latest
> > packages in F15 and restart. However I did a small memory optimization,
> > so I'm sending the corrected patch. Please let me know if everything
> > works for you now. In not, try attaching gdb to sssd_be process *after*
> > it freezes and send me a backtrace.
> 
> Still seeing issues with this latest round of patches (by the way,
> please always send all patches in a series when updating, it makes it
> easier to keep track of them).
> 

Sorry about that. I meant to send all of them, but I somehow forgot.

> Please note that the issue is that we're calling talloc_free(msg) on msg
> at a time when msg = 0x1. (This can only happen in two error conditions,
> 1) member_name = ldb_msg_find_attr_as_string(member, DB_NAME, NULL);
> has returned NULL for member_name, or
> 
> 2) entry_is_user_object() returned something other than LDB_SUCCESS or
> LDB_ERR_NO_SUCH_ATTRIBUTE
> So there are two bugs here. 1) We need to initialize msg to NULL. 2) We
> need to figure out which of the above two failures is happening, and
> why.

I'm sending corrected set of patches, both issues have been addressed. However 
I was unable to test them properly, I'm seeing a strange error on my machine 
which simply can't happen. I suspect that something is wrong with my machine, 
but I'm unable to troubleshoot it. Please let me know it these patches work 
for you.

Thanks
Jan

Attachment: 0001-Memberof-plugin-rewritten.patch.tar.bz2
Description: application/bzip-compressed-tar

From 35f6232548bded7b83ee945e6f280887138b8327 Mon Sep 17 00:00:00 2001
From: Jan Zeleny <jzel...@redhat.com>
Date: Wed, 21 Sep 2011 10:59:45 -0400
Subject: [PATCH 2/4] Added sysdb_memberof_rebuild function

---
 src/db/sysdb.h     |    2 ++
 src/db/sysdb_ops.c |   39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/src/db/sysdb.h b/src/db/sysdb.h
index 2985a1a0c4b241f152a5d79af5b6c66436f0d38a..be9b3c9ea03a2230828c4e7b72247d7b2c667495 100644
--- a/src/db/sysdb.h
+++ b/src/db/sysdb.h
@@ -697,4 +697,6 @@ errno_t sysdb_get_direct_parents(TALLOC_CTX *mem_ctx,
                                  const char *name,
                                  char ***_direct_parents);
 
+errno_t sysdb_memberof_rebuild(struct sysdb_ctx *sysdb);
+
 #endif /* __SYS_DB_H__ */
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index 522bbb08637d0208c3803ed1b10d1a5e57cf119a..48cbd36f23345540ec19008772bdd099f3a124dc 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -2928,3 +2928,42 @@ done:
     talloc_free(msg);
     return ret;
 }
+
+errno_t sysdb_memberof_rebuild(struct sysdb_ctx *sysdb)
+{
+    errno_t ret;
+    int lret;
+    struct ldb_message *msg;
+    bool in_transaction = false;
+
+    msg = talloc_zero(NULL, struct ldb_message);
+    if (msg == NULL) {
+        ret = ENOMEM;
+        goto done;
+    }
+
+    msg->dn = ldb_dn_new(msg, sysdb->ldb, "@MEMBEROF-REBUILD");
+    if (msg->dn == NULL) {
+        ret = ENOMEM;
+        goto done;
+    }
+
+    ret = sysdb_transaction_start(sysdb);
+    if (ret != EOK) goto done;
+    in_transaction = true;
+
+    lret = ldb_add(sysdb->ldb, msg);
+    if (lret != LDB_SUCCESS) {
+        ret = sysdb_error_to_errno(lret);
+        goto done;
+    }
+
+    ret = sysdb_transaction_commit(sysdb);
+
+done:
+    if (ret != EOK && in_transaction) {
+        sysdb_transaction_cancel(sysdb);
+    }
+    talloc_free(msg);
+    return ret;
+}
-- 
1.7.6.4

From b6cb560b346218bbf86389e58d1f421a93922c44 Mon Sep 17 00:00:00 2001
From: Jan Zeleny <jzel...@redhat.com>
Date: Wed, 21 Sep 2011 11:00:40 -0400
Subject: [PATCH 3/4] New test in sysdb test suite - rebuild memberof tree

---
 src/tests/sysdb-tests.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index c2765828836ff0cd3903dcc4a6e4e2b08edb5f9a..584da3c58f281149420099a83b501eeaee75418b 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -1901,6 +1901,25 @@ START_TEST (test_sysdb_memberof_close_loop)
 }
 END_TEST
 
+START_TEST (test_sysdb_memberof_rebuild)
+{
+    struct sysdb_test_ctx *test_ctx;
+    int ret;
+
+    /* Setup */
+    ret = setup_sysdb_tests(&test_ctx);
+    if (ret != EOK) {
+        fail("Could not set up the test");
+        return;
+    }
+
+    ret = sysdb_memberof_rebuild(test_ctx->sysdb);
+
+    fail_if(ret != EOK, "Could not rebuild memberof structure");
+    talloc_free(test_ctx);
+}
+END_TEST
+
 START_TEST (test_sysdb_memberof_store_user)
 {
     struct sysdb_test_ctx *test_ctx;
@@ -3073,6 +3092,7 @@ Suite *create_sysdb_suite(void)
 
     tcase_add_loop_test(tc_memberof, test_sysdb_memberof_store_group, 0, 10);
     tcase_add_test(tc_memberof, test_sysdb_memberof_close_loop);
+    tcase_add_test(tc_memberof, test_sysdb_memberof_rebuild);
     tcase_add_loop_test(tc_memberof, test_sysdb_memberof_store_user, 0, 10);
     tcase_add_loop_test(tc_memberof, test_sysdb_memberof_add_group_member,
                         0, 10);
-- 
1.7.6.4

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to