Re: BUG #17910: gcc-introduced load may cause concurrency bug

Поиск
Список
Период
Сортировка
От Daniel Gustafsson
Тема Re: BUG #17910: gcc-introduced load may cause concurrency bug
Дата
Msg-id A34A108F-E4AA-42DD-9EAC-9754D003AF3E@yesql.se
обсуждение исходный текст
Ответ на BUG #17910: gcc-introduced load may cause concurrency bug  (PG Bug reporting form <noreply@postgresql.org>)
Список pgsql-bugs
> On 27 Apr 2023, at 10:45, PG Bug reporting form <noreply@postgresql.org> wrote:

> we discover that, under Ubuntu 20.04 with gcc-12.1, built
> postgres-release-15.2 has an
> compiled-introduced load operation in "_bt_parallel_build_main(dsm_segment
> *seg, shm_toc *toc)",

Thanks for your report!

> we can see the compiled program load `btshared->isconcurrent` twice, and
> each loaded value is used
> for an assignment. And `btshared->isconcurrent` seems to be a shared object,
> if it's modified
> concurrently else where between the `cmp` and `mov` instructions, there may
> be some concurrency
> bugs.

The isconcurrent struct member is set to indicate if the operation is a CREATE
INDEX CONCURRENTLY or not, and should not be changed at any point during the
index creation.  If you look at the definition of BTShared it has this comment:

    /*
     * These fields are not modified during the sort.  They primarily exist
     * for the benefit of worker processes that need to create BTSpool state
     * corresponding to that used by the leader.
     */
    Oid         heaprelid;
    Oid         indexrelid;
    bool        isunique;
    bool        nulls_not_distinct;
    bool        isconcurrent;
    int         scantuplesortstates;

There should be no concurrent modifications of this, did you observe any such
case where this caused an issue?

--
Daniel Gustafsson




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

Предыдущее
От: Richard Guo
Дата:
Сообщение: Re: BUG #17909: CREATE SCHEMA AUTHORIZATION sch CREATE TABLE foo ( id INT ) will coredump
Следующее
От: Daniel Gustafsson
Дата:
Сообщение: Re: pg_basebackup: errors on macOS on directories with ".DS_Store" files