Re: Fwd: race in pg_ctl start -w

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: Fwd: race in pg_ctl start -w
Дата
Msg-id 507BC402.40807@vmware.com
обсуждение исходный текст
Ответ на Re: Fwd: race in pg_ctl start -w  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Fwd: race in pg_ctl start -w  (Dave Vitek <dvitek@grammatech.com>)
Список pgsql-bugs
On 11.10.2012 22:36, Tom Lane wrote:
> Heikki Linnakangas<hlinnakangas@vmware.com>  writes:
>> Hmm, starting with 9.3, postmaster can not only create and append to the
>> end of file, it can also inject a line in the middle, shifting the
>> following lines forwards. In theory, if a new line is injected into the
>> middle of the file between fgets() calls, readfile() could read part of
>> the same line twice. Not sure what consequences that could have; pg_ctl
>> might try to connect to wrong address or socket directory.
>
> Hm.  IIRC, the postmaster is careful to write the whole thing in a
> single write() call, which in principle is atomic.  Perhaps you're
> right that we'd better have pg_ctl read it in a single read() to
> ensure that it sees a consistent file state.  Otherwise we're making
> assumptions about what sort of buffering underlies the stdio functions.

Ok, changed it to slurp the whole file to memory with one read() call.

Dave, did this silence the static analysis tool you used?

- Heikki

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: BUG #7595: terminate process in an unusual way
Следующее
От: John Nash
Дата:
Сообщение: WebSphere Application Server support for postgres