| From: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> |
|---|---|
| To: | thomas(dot)munro(at)gmail(dot)com |
| Cc: | ranier(dot)vf(at)gmail(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Dereference before NULL check (src/backend/storage/ipc/latch.c) |
| Date: | 2020-11-02 11:50:30 |
| Message-ID: | 20201102.205030.497446798177242065.horikyota.ntt@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
At Mon, 02 Nov 2020 17:25:04 +0900 (JST), Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> wrote in
> I called SetLatch() during WaitLatch(NULL, ) but that doesn't fire
> WL_LATCH_SET event for me on Windows. (I got it fired on Linux..) On
> Windows, the latch is detected after exiting the WaitLatch()
> call. Seems like MyLatch of waiter is different from
> peerPGPROC->procLatch. And... an update for Visual Studio broke my
> environment... I will investigate this further but everything feel
> cumbersome on Windows...
I managed to reproduce the issue. FWIW the attached modifies
pg_backend_pid() to call "WaitLatch(NULL," and
pg_terminate_backend(pid) to SetLatch() to the process latch of the
pid. (It's minunderstanding that I could reproduce this on Linux.)
Session A:
=# select pg_backend_pid(); -- sleeps for 10 seconds.
Session B:
=# select pg_terminate_backend(A-pid);
[11628] LOG: server process (PID 14568) was terminated by exception 0xC0000005
[11628] DETAIL: Failed process was running: select pg_backend_pid();
[11628] HINT: See C include file "ntstatus.h" for a description of the hexadecimal value.
[11628] LOG: terminating any other active server processes
[2948] WARNING: terminating connection because of crash of another server process
2
With the fix patch, it changes to:
[16632] LOG: FALSE LATCH: 0000000000000000
rebards.
--
Kyotaro Horiguchi
NTT Open Source Software Center
| Attachment | Content-Type | Size |
|---|---|---|
| repro.diff | text/x-patch | 1.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Heikki Linnakangas | 2020-11-02 11:52:48 | Re: hash_array_extended() needs to pass down collation |
| Previous Message | Heikki Linnakangas | 2020-11-02 11:46:15 | Re: Getting rid of aggregate_dummy() |