Re: BUG #1270: stack overflow in thread in fe_getauthname

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Davie <Peter(dot)Davie(at)relevance(dot)com(dot)au>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1270: stack overflow in thread in fe_getauthname
Date: 2004-09-27 23:56:27
Message-ID: 200409272356.i8RNuSM14208@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tom Lane wrote:
> "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org> writes:
> > With the THREAD_SAFETY changes, a buffer is defined on the stack as:
> > char pwdbuf[BUFSIZ];
> > This buffer overflows the stack when used in a thread. As the application
> > creating the thread cannot be modified to increase the stack size, it would
> > probably be prudent to reduce this buffer size (I believe that BUFSIZ is
> > around 8192 bytes on most modern Unix implementations).
>
> No, it would be prudent to fix the app. While this one particular
> buffer might be larger than needed, we are *not* going to buy into the
> notion that libpq needs to run successfully in an 8K stack. This
> particular problem is only the tip of the iceberg; hewing to any
> such limit is going to require far more drastic changes that just don't
> seem worthwhile.

Agreed. I fixed the cases were the buffers was really too large, but
there is no way we could run on an 8k stack. I assume you were having
problems where you were doing multiple lookups in a single thread but am
not sure that ever really happens.

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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2004-09-28 00:05:20 Re: BUG #1270: stack overflow in thread in fe_getauthname
Previous Message Tom Lane 2004-09-27 23:55:55 Re: BUG #1270: stack overflow in thread in fe_getauthname