slony1-bugs at lists.slony.info slony1-bugs at lists.slony.info
Tue Sep 15 13:13:03 PDT 2009
http://www.slony.info/bugzilla/show_bug.cgi?id=55


paul cannon <pcannon+slonybugzilla at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pcannon+slonybugzilla at gmail.
                   |                            |com




--- Comment #1 from paul cannon <pcannon+slonybugzilla at gmail.com>  2009-09-15 13:13:02 ---
I've found one bug which would cause the symptoms you describe, although there
may be others :). Present in 1.2.15 and 1.2.16, at least.

The problem should manifest itself when an overly long line is printed to the
log (so it doesn't happen when the log level is low). Here's the case that was
causing my slon to segfault; it's in sync_event() in remote_worker.c:

            slon_log(SLON_DEBUG4, " ssy_action_list value: %s\n",
                     ssy_action_list);

ssy_action_list in this case was over 135000 characters. When this got into
slon_log and that function found that its buffer was not big enough, it tried
to resize the buffer and call vsnprintf() again, but /it reused the va_arg/,
which is not allowed.

Here is one possible approach to fixing the problem:

--- old_misc.c  2009-09-15 13:57:29.000000000 -0600
+++ misc.c      2009-09-15 14:11:10.000000000 -0600
@@ -172,7 +172,10 @@

        off = strlen(outbuf);

-       while (vsnprintf(&outbuf[off], outsize - off, fmt, ap) >= outsize -
off)
+       va_list apcopy;
+       va_copy(apcopy, ap);
+
+       while (vsnprintf(&outbuf[off], outsize - off, fmt, apcopy) >= outsize -
off)
        {
                outsize *= 2;
                outbuf = realloc(outbuf, outsize);
@@ -181,7 +184,12 @@
                        perror("slon_log: realloc()");
                        slon_retry();
                }
+               va_end(apcopy);
+               va_copy(apcopy, ap);
        }
+
+       va_end(apcopy);
+
 #ifdef HAVE_SYSLOG
        if (Use_syslog >= 1)
        {


-- 
Configure bugmail: http://www.slony.info/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
You are the assignee for the bug.


More information about the Slony1-bugs mailing list