Thread: dbmirror bug

dbmirror bug

From
Hai-Chen Tu
Date:
Your name               : Hai-Chen Tu
Your email address      : hctu@yahoo.com


System Configuration
---------------------
  Architecture (example: Intel Pentium)         :

  Operating System (example: Linux 2.0.26 ELF)  :

  PostgreSQL version (example: PostgreSQL-7.3):
PostgreSQL-7.3

  Compiler used (example:  gcc 2.95.2)          :


Please enter a FULL description of your problem:
------------------------------------------------
dbmirror generates "out of memory" error in some
cases when the DEBUG_OUTPUT is enabled.




Please describe a way to repeat the problem.   Please
try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------
The cause of the problem is that pending.c in dbmirror
uses
    elog(NOTICE, cpKeyData)
and
    elog(NOTICE, cpFieldData)
to print column data where elog
interprets the second argument as sprintf
format string, which fails if
cpKeyData/cpFieldData contains '%'.




If you know how this problem might be fixed, list the
solution below:
---------------------------------------------------------------------

The solution is to change
    elog(NOTICE, ...)
to
    elog(NOTICE, "%s", ...)

This applies to all cpKeyData and cpFieldData,
and probably cpFieldName.


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus – Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

Re: dbmirror bug

From
Bruce Momjian
Date:
Good catch.  Fix will be in 7.3.

---------------------------------------------------------------------------

Hai-Chen Tu wrote:
> Your name               : Hai-Chen Tu
> Your email address      : hctu@yahoo.com
>
>
> System Configuration
> ---------------------
>   Architecture (example: Intel Pentium)         :
>
>   Operating System (example: Linux 2.0.26 ELF)  :
>
>   PostgreSQL version (example: PostgreSQL-7.3):
> PostgreSQL-7.3
>
>   Compiler used (example:  gcc 2.95.2)          :
>
>
> Please enter a FULL description of your problem:
> ------------------------------------------------
> dbmirror generates "out of memory" error in some
> cases when the DEBUG_OUTPUT is enabled.
>
>
>
>
> Please describe a way to repeat the problem.   Please
> try to provide a
> concise reproducible example, if at all possible:
> ----------------------------------------------------------------------
> The cause of the problem is that pending.c in dbmirror
> uses
>     elog(NOTICE, cpKeyData)
> and
>     elog(NOTICE, cpFieldData)
> to print column data where elog
> interprets the second argument as sprintf
> format string, which fails if
> cpKeyData/cpFieldData contains '%'.
>
>
>
>
> If you know how this problem might be fixed, list the
> solution below:
> ---------------------------------------------------------------------
>
> The solution is to change
>     elog(NOTICE, ...)
> to
>     elog(NOTICE, "%s", ...)
>
> This applies to all cpKeyData and cpFieldData,
> and probably cpFieldName.
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus – Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: dbmirror bug

From
Tom Lane
Date:
Hai-Chen Tu <hctu@yahoo.com> writes:
> The cause of the problem is that pending.c in dbmirror
> uses
>     elog(NOTICE, cpKeyData)
> and
>     elog(NOTICE, cpFieldData)
> to print column data where elog
> interprets the second argument as sprintf
> format string, which fails if
> cpKeyData/cpFieldData contains '%'.

Good catch!  Trawling the sources identified a dozen other places with
the same error --- all fixed now.

            regards, tom lane