Re: Proposal: allow database-specific role memberships

From: Kenaniah Cerny <kenaniah(at)gmail(dot)com>
To: Julien Rouhaud <rjuju123(at)gmail(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Asif Rehman <asifr(dot)rehman(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Proposal: allow database-specific role memberships
Date: 2022-01-22 13:28:05
Message-ID: CA+r_aq8RK3AquJKUZaBGFn4ePrF_xwqkftCBvJpTTmkfa-+ogw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thank you so much for the backtrace!

This latest patch should address by moving the dumpRoleMembership call to
before the pointer is closed.

On Sat, Jan 22, 2022 at 1:11 AM Julien Rouhaud <rjuju123(at)gmail(dot)com> wrote:

> Hi,
>
> On Fri, Jan 21, 2022 at 07:01:21PM -0800, Kenaniah Cerny wrote:
> > Thanks for the feedback.
> >
> > I have attached an alternate version of the v5 patch that incorporates
> the
> > suggested changes to the documentation and DRYs up some of the acl.c code
> > for comparison. As for the databaseOid / InvalidOid parameter, I'm open
> to
> > any suggestions for how to make that even cleaner, but am currently at a
> > loss as to how that would look.
> >
> > CI is showing a failure to run pg_dump on just the Linux - Debian
> Bullseye
> > job (https://cirrus-ci.com/task/5265343722553344). Does anyone have any
> > ideas as to where I should look in order to debug that?
>
> Did you try to reproduce it on some GNU/Linux system? FTR I had and I get
> a
> segfault in pg_dumpall:
>
> (gdb) bt
> #0 __pthread_kill_implementation (threadid=<optimized out>,
> signo=signo(at)entry=6, no_tid=no_tid(at)entry=0) at pthread_kill.c:44
> #1 0x00007f329e7e40cf in __pthread_kill_internal (signo=6,
> threadid=<optimized out>) at pthread_kill.c:78
> #2 0x00007f329e7987a2 in __GI_raise (sig=sig(at)entry=6) at
> ../sysdeps/posix/raise.c:26
> #3 0x00007f329e783449 in __GI_abort () at abort.c:79
> #4 0x00007f329e7d85d8 in __libc_message (action=action(at)entry=do_abort,
> fmt=fmt(at)entry=0x7f329e90b6aa "%s\n") at ../sysdeps/posix/libc_fatal.c:155
> #5 0x00007f329e7edcfa in malloc_printerr (str=str(at)entry=0x7f329e9092c3
> "free(): invalid pointer") at malloc.c:5536
> #6 0x00007f329e7ef504 in _int_free (av=<optimized out>, p=<optimized
> out>, have_lock=0) at malloc.c:4327
> #7 0x00007f329e7f1f81 in __GI___libc_free (mem=<optimized out>) at
> malloc.c:3279
> #8 0x00007f329e7dbec5 in __GI__IO_free_backup_area (fp=fp(at)entry=0x561775f126c0)
> at genops.c:190
> #9 0x00007f329e7db6af in _IO_new_file_overflow (f=0x561775f126c0, ch=-1)
> at fileops.c:758
> #10 0x00007f329e7da7be in _IO_new_file_xsputn (n=2, data=<optimized out>,
> f=<optimized out>) at
> /usr/src/debug/sys-libs/glibc-2.34-r4/glibc-2.34/libio/libioP.h:947
> #11 _IO_new_file_xsputn (f=0x561775f126c0, data=<optimized out>, n=2) at
> fileops.c:1197
> #12 0x00007f329e7cfd32 in __GI__IO_fwrite (buf=0x7ffc90bb0ac0, size=1,
> count=2, fp=0x561775f126c0) at
> /usr/src/debug/sys-libs/glibc-2.34-r4/glibc-2.34/libio/libioP.h:947
> #13 0x000056177483c758 in flushbuffer (target=0x7ffc90bb0a90) at
> snprintf.c:310
> #14 0x000056177483c4e8 in pg_vfprintf (stream=0x561775f126c0,
> fmt=0x561774840dec "\n\n", args=0x7ffc90bb0f00) at snprintf.c:259
> #15 0x000056177483c5ce in pg_fprintf (stream=0x561775f126c0,
> fmt=0x561774840dec "\n\n") at snprintf.c:270
> #16 0x0000561774831893 in dumpRoleMembership (conn=0x561775f09600,
> databaseId=0x561775f152d2 "1") at pg_dumpall.c:991
> #17 0x0000561774832426 in dumpDatabases (conn=0x561775f09600) at
> pg_dumpall.c:1332
> #18 0x000056177483049e in main (argc=3, argv=0x7ffc90bb1658) at
> pg_dumpall.c:596
>
> I didn't look in detail, but:
>
> @@ -1323,6 +1327,10 @@ dumpDatabases(PGconn *conn)
> exit_nicely(1);
> }
>
> + /* Dump database-specific roles if server is running 15.0 or later
> */
> + if (server_version >= 150000)
> + dumpRoleMembership(conn, dbid);
> +
>
> Isn't that trying print to OPF after the possible fclose(OPF) a bit before
> and
> before it's reopened?
>

Attachment Content-Type Size
database-role-memberships-v6.patch application/x-patch 69.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2022-01-22 14:56:44 Re: Proposal: allow database-specific role memberships
Previous Message James Coleman 2022-01-22 13:18:33 Re: Document atthasmissing default optimization avoids verification table scan