Re: Squatter crash with statusdb

2013-06-24 Thread Andy Fiddaman

FWIW, this gets it working again:

--- cyrus-imapd-2.4.17.dist/imap/statuscache_db.c   2013-06-24
10:10:08.219203100 +
+++ cyrus-imapd-2.4.17/imap/statuscache_db.c2013-06-24
10:10:20.537711377 +
@@ -152,7 +152,7 @@
 len = strlcpy(key, mailboxname, sizeof(key));
 key[len++] = '%';
 key[len++] = '%';
-len += strlcpy(key + len, userid, sizeof(key) - len);
+len += strlcpy(key + len, userid ? userid : cyrus, sizeof(key) -
len);

 *keylen = len;


On Mon, 24 Jun 2013, Andy Fiddaman wrote:

;
; Hi,
;
; I've just upgraded my Cyrus installation to 2.4.17 and squatter is
; crashing in statuscache_buildkey() because userid is NULL.
;
; I'm not sure what the best fix for this is. Should squatter even be using
; the statuscache or should it populate cyrus as the username when
; initialising the index, or something else?
;
; Thanks,
;
; Andy
;
; Program received signal SIGSEGV, Segmentation fault.
; [Switching to Thread 1 (LWP 1)]
; 0xfd7ffe3dccb0 in .strlenalign16_loop () from /lib/64/libc.so.1
; (gdb) where
; #0  0xfd7ffe3dccb0 in .strlenalign16_loop () from /lib/64/libc.so.1
; #1  0xfd7ffe414149 in strlcpy () from /lib/64/libc.so.1
; #2  0x004610ac in statuscache_buildkey (
; mailboxname=0x5ab8b0 example.net!user.silo, userid=0x0,
; keylen=0xfd7fffdfe0cc) at statuscache_db.c:155
; #3  0x0046169a in statuscache_update_txn (
; mboxname=0x5ab8b0 example.net!user.silo, sdata=0xfd7fffdfe290,
; tidptr=0xfd7fffdfe218) at statuscache_db.c:326
; #4  0x004619ad in statuscache_invalidate (
; mboxname=0x5ab8b0 example.net!user.silo, sdata=0xfd7fffdfe290)
; at statuscache_db.c:425
; #5  0x00434099 in mailbox_unlock_index (mailbox=0x5db998,
; sdata=0xfd7fffdfe290) at mailbox.c:1637
; #6  0x00422feb in index_unlock (state=0x5af6a0) at index.c:1232
; #7  0x00420c98 in index_open (name=0x5ac960
; example.net!user.silo,
; init=0x0, stateptr=0xfd7fffdfec18) at index.c:246
; #8  0x00420395 in index_me (name=0x5ac960 example.net!user.silo,
; matchlen=20, maycreate=0, rock=0xfd7fffdffcac) at squatter.c:594
; #9  0x004208f9 in main (argc=3, argv=0xfd7fffdffcf8)
; at squatter.c:745
;
;
; (gdb) frame 7
; #7  0x00420c98 in index_open (name=0x5ac960
; example.net!user.silo,
; init=0x0, stateptr=0xfd7fffdfec18) at index.c:246
; 246 in index.c
; (gdb) print *state
; $4 = {mailbox = 0x5db998, num_records = 6933, oldexists = 0, exists =
; 6933,
;   last_uid = 6934, highestmodseq = 1606, delayed_modseq = 0, map =
; 0x5dd740,
;   mapsize = 7168, internalseen = 0, skipped_expunge = 0, seen_dirty = 0,
;   keepingseen = 0, examining = 0, myrights = 0, numrecent = 0,
;   numunseen = 6933, firstnotseen = 1, flagname = {0x0 repeats 128
; times},
;   userid = 0x0, out = 0x0, qresync = 0, authstate = 0x0}
;
; 
; Cyrus Home Page: http://www.cyrusimap.org/
; List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
; To Unsubscribe:
; https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus
;

Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus


Re: Squatter crash with statusdb

2013-06-24 Thread Rudy Gevaert
Hi Andy, could you file a bug for this?  Then it will not be forgotten...

Quoting Andy Fiddaman cy...@fiddaman.net, Mon, 24 Jun 2013:

 FWIW, this gets it working again:

 --- cyrus-imapd-2.4.17.dist/imap/statuscache_db.c   2013-06-24
 10:10:08.219203100 +
 +++ cyrus-imapd-2.4.17/imap/statuscache_db.c2013-06-24
 10:10:20.537711377 +
 @@ -152,7 +152,7 @@
  len = strlcpy(key, mailboxname, sizeof(key));
  key[len++] = '%';
  key[len++] = '%';
 -len += strlcpy(key + len, userid, sizeof(key) - len);
 +len += strlcpy(key + len, userid ? userid : cyrus, sizeof(key) -
 len);

  *keylen = len;


 On Mon, 24 Jun 2013, Andy Fiddaman wrote:

 ;
 ; Hi,
 ;
 ; I've just upgraded my Cyrus installation to 2.4.17 and squatter is
 ; crashing in statuscache_buildkey() because userid is NULL.
 ;
 ; I'm not sure what the best fix for this is. Should squatter even be using
 ; the statuscache or should it populate cyrus as the username when
 ; initialising the index, or something else?
 ;
 ; Thanks,
 ;
 ; Andy
 ;
 ; Program received signal SIGSEGV, Segmentation fault.
 ; [Switching to Thread 1 (LWP 1)]
 ; 0xfd7ffe3dccb0 in .strlenalign16_loop () from /lib/64/libc.so.1
 ; (gdb) where
 ; #0  0xfd7ffe3dccb0 in .strlenalign16_loop () from /lib/64/libc.so.1
 ; #1  0xfd7ffe414149 in strlcpy () from /lib/64/libc.so.1
 ; #2  0x004610ac in statuscache_buildkey (
 ; mailboxname=0x5ab8b0 example.net!user.silo, userid=0x0,
 ; keylen=0xfd7fffdfe0cc) at statuscache_db.c:155
 ; #3  0x0046169a in statuscache_update_txn (
 ; mboxname=0x5ab8b0 example.net!user.silo, sdata=0xfd7fffdfe290,
 ; tidptr=0xfd7fffdfe218) at statuscache_db.c:326
 ; #4  0x004619ad in statuscache_invalidate (
 ; mboxname=0x5ab8b0 example.net!user.silo, sdata=0xfd7fffdfe290)
 ; at statuscache_db.c:425
 ; #5  0x00434099 in mailbox_unlock_index (mailbox=0x5db998,
 ; sdata=0xfd7fffdfe290) at mailbox.c:1637
 ; #6  0x00422feb in index_unlock (state=0x5af6a0) at index.c:1232
 ; #7  0x00420c98 in index_open (name=0x5ac960
 ; example.net!user.silo,
 ; init=0x0, stateptr=0xfd7fffdfec18) at index.c:246
 ; #8  0x00420395 in index_me (name=0x5ac960 example.net!user.silo,
 ; matchlen=20, maycreate=0, rock=0xfd7fffdffcac) at squatter.c:594
 ; #9  0x004208f9 in main (argc=3, argv=0xfd7fffdffcf8)
 ; at squatter.c:745
 ;
 ;
 ; (gdb) frame 7
 ; #7  0x00420c98 in index_open (name=0x5ac960
 ; example.net!user.silo,
 ; init=0x0, stateptr=0xfd7fffdfec18) at index.c:246
 ; 246 in index.c
 ; (gdb) print *state
 ; $4 = {mailbox = 0x5db998, num_records = 6933, oldexists = 0, exists =
 ; 6933,
 ;   last_uid = 6934, highestmodseq = 1606, delayed_modseq = 0, map =
 ; 0x5dd740,
 ;   mapsize = 7168, internalseen = 0, skipped_expunge = 0, seen_dirty = 0,
 ;   keepingseen = 0, examining = 0, myrights = 0, numrecent = 0,
 ;   numunseen = 6933, firstnotseen = 1, flagname = {0x0 repeats 128
 ; times},
 ;   userid = 0x0, out = 0x0, qresync = 0, authstate = 0x0}
 ;
 ; 
 ; Cyrus Home Page: http://www.cyrusimap.org/
 ; List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
 ; To Unsubscribe:
 ; https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus
 ;
 
 Cyrus Home Page: http://www.cyrusimap.org/
 List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
 To Unsubscribe:
 https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus

-- 
  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
  Rudy Gevaert e-mail: rudy.geva...@ugent.be
  Directie ICT, Afdeling Infrastructuur
  Groep Systemen  tel: +32 9 264 4750
  Universiteit Gent   fax: +32 9 264 4994
  Krijgslaan 281, gebouw S9, 9000 Gent, Belgie   www.UGent.be
  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --



Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus


Re: Squatter crash with statusdb

2013-06-24 Thread Simon Matter
 Hi Andy, could you file a bug for this?  Then it will not be forgotten...

Or, could you check this bug here
http://bugzilla.cyrusimap.org/show_bug.cgi?id=3757

The patch below was the fix, could you verify if it also fixes your issue?

Thanks,
Simon

From 1661683d453ea444aae5832b4a2cb7fd54489672 Mon Sep 17 00:00:00 2001
From: Bron Gondwana br...@opera.com
Date: Sun, 09 Dec 2012 19:42:17 +
Subject: Bug #3757 - don't segfault on mailbox close with no user

Broke squatter and possibly other users as well.

This is probably a 2.4 only fix - the code has changed
for statuscache a bit since.
---
diff --git a/imap/statuscache_db.c b/imap/statuscache_db.c
index fadc58d..41dfd2b 100644
--- a/imap/statuscache_db.c
+++ b/imap/statuscache_db.c
@@ -150,9 +150,11 @@ static char *statuscache_buildkey(const char
*mailboxname, const char *userid,

 /* Build statuscache key */
 len = strlcpy(key, mailboxname, sizeof(key));
+/* double % is a safe separator, it can't exist in a mailboxname */
 key[len++] = '%';
 key[len++] = '%';
-len += strlcpy(key + len, userid, sizeof(key) - len);
+if (userid)
+   len += strlcpy(key + len, userid, sizeof(key) - len);

 *keylen = len;

@@ -410,11 +412,9 @@ int statuscache_invalidate(const char *mboxname,
struct statusdata *sdata)
 drock.db = statuscachedb;
 drock.tid = NULL;

-key = statuscache_buildkey(mboxname, , keylen);
+key = statuscache_buildkey(mboxname, /*userid*/NULL, keylen);

-/* strip off the second NULL that buildkey added, so we match
- * the entires for all users */
-r = DB-foreach(drock.db, key, keylen - 1, NULL, delete_cb,
+r = DB-foreach(drock.db, key, keylen, NULL, delete_cb,
drock, drock.tid);
 if (r != CYRUSDB_OK) {
syslog(LOG_ERR, DBERROR: error invalidating: %s (%s),



 Quoting Andy Fiddaman cy...@fiddaman.net, Mon, 24 Jun 2013:

 FWIW, this gets it working again:

 --- cyrus-imapd-2.4.17.dist/imap/statuscache_db.c   2013-06-24
 10:10:08.219203100 +
 +++ cyrus-imapd-2.4.17/imap/statuscache_db.c2013-06-24
 10:10:20.537711377 +
 @@ -152,7 +152,7 @@
  len = strlcpy(key, mailboxname, sizeof(key));
  key[len++] = '%';
  key[len++] = '%';
 -len += strlcpy(key + len, userid, sizeof(key) - len);
 +len += strlcpy(key + len, userid ? userid : cyrus, sizeof(key) -
 len);

  *keylen = len;


 On Mon, 24 Jun 2013, Andy Fiddaman wrote:

 ;
 ; Hi,
 ;
 ; I've just upgraded my Cyrus installation to 2.4.17 and squatter is
 ; crashing in statuscache_buildkey() because userid is NULL.
 ;
 ; I'm not sure what the best fix for this is. Should squatter even be
 using
 ; the statuscache or should it populate cyrus as the username when
 ; initialising the index, or something else?
 ;
 ; Thanks,
 ;
 ; Andy
 ;
 ; Program received signal SIGSEGV, Segmentation fault.
 ; [Switching to Thread 1 (LWP 1)]
 ; 0xfd7ffe3dccb0 in .strlenalign16_loop () from /lib/64/libc.so.1
 ; (gdb) where
 ; #0  0xfd7ffe3dccb0 in .strlenalign16_loop () from
 /lib/64/libc.so.1
 ; #1  0xfd7ffe414149 in strlcpy () from /lib/64/libc.so.1
 ; #2  0x004610ac in statuscache_buildkey (
 ; mailboxname=0x5ab8b0 example.net!user.silo, userid=0x0,
 ; keylen=0xfd7fffdfe0cc) at statuscache_db.c:155
 ; #3  0x0046169a in statuscache_update_txn (
 ; mboxname=0x5ab8b0 example.net!user.silo,
 sdata=0xfd7fffdfe290,
 ; tidptr=0xfd7fffdfe218) at statuscache_db.c:326
 ; #4  0x004619ad in statuscache_invalidate (
 ; mboxname=0x5ab8b0 example.net!user.silo,
 sdata=0xfd7fffdfe290)
 ; at statuscache_db.c:425
 ; #5  0x00434099 in mailbox_unlock_index (mailbox=0x5db998,
 ; sdata=0xfd7fffdfe290) at mailbox.c:1637
 ; #6  0x00422feb in index_unlock (state=0x5af6a0) at
 index.c:1232
 ; #7  0x00420c98 in index_open (name=0x5ac960
 ; example.net!user.silo,
 ; init=0x0, stateptr=0xfd7fffdfec18) at index.c:246
 ; #8  0x00420395 in index_me (name=0x5ac960
 example.net!user.silo,
 ; matchlen=20, maycreate=0, rock=0xfd7fffdffcac) at
 squatter.c:594
 ; #9  0x004208f9 in main (argc=3, argv=0xfd7fffdffcf8)
 ; at squatter.c:745
 ;
 ;
 ; (gdb) frame 7
 ; #7  0x00420c98 in index_open (name=0x5ac960
 ; example.net!user.silo,
 ; init=0x0, stateptr=0xfd7fffdfec18) at index.c:246
 ; 246 in index.c
 ; (gdb) print *state
 ; $4 = {mailbox = 0x5db998, num_records = 6933, oldexists = 0, exists =
 ; 6933,
 ;   last_uid = 6934, highestmodseq = 1606, delayed_modseq = 0, map =
 ; 0x5dd740,
 ;   mapsize = 7168, internalseen = 0, skipped_expunge = 0, seen_dirty =
 0,
 ;   keepingseen = 0, examining = 0, myrights = 0, numrecent = 0,
 ;   numunseen = 6933, firstnotseen = 1, flagname = {0x0 repeats 128
 ; times},
 ;   userid = 0x0, out = 0x0, qresync = 0, authstate = 0x0}
 ;
 ; 
 ; Cyrus Home Page: http://www.cyrusimap.org/
 ; List Archives/Info: 

Re: Squatter crash with statusdb

2013-06-24 Thread Andy Fiddaman

On Mon, 24 Jun 2013, Simon Matter wrote:
;
; Or, could you check this bug here
; http://bugzilla.cyrusimap.org/show_bug.cgi?id=3757
;
; The patch below was the fix, could you verify if it also fixes your issue?

Yes that patch fixes my issue too. I did search bugzilla but didn't
see that one because it is marked as resolved. I didn't see it fixed
in git either (http://git.cyrusimap.org/cyrus-imapd/tree/imap/statuscache_db.c)
but I see now it's fixed in the 2.4 branch only.

Thanks,

Andy


Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus


Re: Squatter crash with statusdb

2013-06-24 Thread Jeroen van Meeuwen (Kolab Systems)
On 2013-06-24 13:24, Simon Matter wrote:
 Hi Andy, could you file a bug for this?  Then it will not be 
 forgotten...
 
 Or, could you check this bug here
 http://bugzilla.cyrusimap.org/show_bug.cgi?id=3757
 
 The patch below was the fix, could you verify if it also fixes your 
 issue?
 
 Thanks,
 Simon
 
 From 1661683d453ea444aae5832b4a2cb7fd54489672 Mon Sep 17 00:00:00 2001
 From: Bron Gondwana br...@opera.com
 Date: Sun, 09 Dec 2012 19:42:17 +
 Subject: Bug #3757 - don't segfault on mailbox close with no user
 

This seems to still apply indeed, barring a DB-foreach() = 
cyrusdb_foreach() merge conflict.

I have it in:

   [master 9766afa] Bug #3757 - don't segfault on mailbox close with no 
user

so it'll be in Cyrus IMAP 2.5 when I push (I have a couple of other 
things to push as well).

Kind regards,

Jeroen van Meeuwen

-- 
Systems Architect, Kolab Systems AG

e: vanmeeuwen at kolabsys.com
m: +44 74 2516 3817
w: http://www.kolabsys.com

pgp: 9342 BF08

Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus