pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #17370: shmem lost on segfault
4+ messages / 3 participants
[nested] [flat]

* BUG #17370: shmem lost on segfault
@ 2022-01-19 03:05  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 4+ messages in thread

From: PG Bug reporting form @ 2022-01-19 03:05 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: rekgrpth@gmail.com

The following bug has been logged on the website:

Bug reference:      17370
Logged by:          RekGRpth
Email address:      rekgrpth@gmail.com
PostgreSQL version: 14.1
Operating system:   docker alpine
Description:        

In developing my https://github.com/RekGRpth/pg_task I found strange
behavior of shared memory segment.
I setup shared memory segment and give it to background worker, which I
start with default restart interval.
See
https://github.com/RekGRpth/pg_task/blob/d951723b6e556479f9a3fa960a6b3d1fb8f52164/conf.c#L67-L134
And everything works fine, even if background worker exits on error (if for
example I drop needed table task), then it restarts and can access to shared
memory segment.
See
https://github.com/RekGRpth/pg_task/blob/d951723b6e556479f9a3fa960a6b3d1fb8f52164/work.c#L742
But if third other process terminates by segmentation fault, my background
worker restarts fine but can not access to shared memory segment.
dsm_attach returns NULL
What I need to do to solve this problem?



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #17370: shmem lost on segfault
@ 2022-01-19 09:28  Julien Rouhaud <rjuju123@gmail.com>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 4+ messages in thread

From: Julien Rouhaud @ 2022-01-19 09:28 UTC (permalink / raw)
  To: rekgrpth@gmail.com; pgsql-bugs@lists.postgresql.org

Hi,

On Wed, Jan 19, 2022 at 03:05:56AM +0000, PG Bug reporting form wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      17370
> Logged by:          RekGRpth
> Email address:      rekgrpth@gmail.com
> PostgreSQL version: 14.1
> Operating system:   docker alpine
> Description:        
> 
> In developing my https://github.com/RekGRpth/pg_task I found strange
> behavior of shared memory segment.

This is not a postgres bug.  If you need help with developing an extension you
should send a message to -hackers.

That being said, in case of unclean shutdown (which happens if a process
segfaults), the postmaster will restart and any shared memory will be lost, so
I'm assuming that you somehow serialize a handle which isn't valid anymore
after a restart, unclean or not.





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #17370: shmem lost on segfault
@ 2022-01-19 09:34  RekGRpth <rekgrpth@gmail.com>
  parent: Julien Rouhaud <rjuju123@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: RekGRpth @ 2022-01-19 09:34 UTC (permalink / raw)
  To: Julien Rouhaud <rjuju123@gmail.com>; +Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>

Ok, thanks.

What I should do in this case (postmaster restarts my background
worker and shared memory is lost)?
When I storage in bgw_extra field - everything is ok (with restarting
after segfault), but it size too small.

ср, 19 янв. 2022 г. в 14:28, Julien Rouhaud <rjuju123@gmail.com>:
>
> Hi,
>
> On Wed, Jan 19, 2022 at 03:05:56AM +0000, PG Bug reporting form wrote:
> > The following bug has been logged on the website:
> >
> > Bug reference:      17370
> > Logged by:          RekGRpth
> > Email address:      rekgrpth@gmail.com
> > PostgreSQL version: 14.1
> > Operating system:   docker alpine
> > Description:
> >
> > In developing my https://github.com/RekGRpth/pg_task I found strange
> > behavior of shared memory segment.
>
> This is not a postgres bug.  If you need help with developing an extension you
> should send a message to -hackers.
>
> That being said, in case of unclean shutdown (which happens if a process
> segfaults), the postmaster will restart and any shared memory will be lost, so
> I'm assuming that you somehow serialize a handle which isn't valid anymore
> after a restart, unclean or not.





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #17370: shmem lost on segfault
@ 2022-01-19 09:46  Julien Rouhaud <rjuju123@gmail.com>
  parent: RekGRpth <rekgrpth@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Julien Rouhaud @ 2022-01-19 09:46 UTC (permalink / raw)
  To: RekGRpth <rekgrpth@gmail.com>; +Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>

Hi,

On Wed, Jan 19, 2022 at 02:34:13PM +0500, RekGRpth wrote:
> Ok, thanks.
> 
> What I should do in this case (postmaster restarts my background
> worker and shared memory is lost)?
> When I storage in bgw_extra field - everything is ok (with restarting
> after segfault), but it size too small.

I don't know, and as I said you should ask on -hackers, ideally with a good
description of how everything works or a minimal code to reproduce your
problem as it's not really clear right now.





^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2022-01-19 09:46 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19 03:05 BUG #17370: shmem lost on segfault PG Bug reporting form <noreply@postgresql.org>
2022-01-19 09:28 ` Julien Rouhaud <rjuju123@gmail.com>
2022-01-19 09:34   ` RekGRpth <rekgrpth@gmail.com>
2022-01-19 09:46     ` Julien Rouhaud <rjuju123@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox