Re: Non-reproducible AIO failure

Konstantin Knizhnik <knizhnik@garret.ru>

From: Konstantin Knizhnik <knizhnik@garret.ru>
To: Andres Freund <andres@anarazel.de>
Cc: Thomas Munro <thomas.munro@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2025-06-10T18:09:18Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. aio: Stop using enum bitfields due to bad code generation

  2. amcheck: Fix posting tree checks in gin_index_check()

  3. aio: Add missing memory barrier when waiting for IO handle

On 10/06/2025 8:41 pm, Andres Freund wrote:
> I was able to reproduce it with gcc, too.
> I've reproduced it without that bitfield, unfortunately :(.


But also only at MacOS?


I wonder if it is possible to set hardware watchpoint fro program itself 
(not using gdb)? I.e. using ptrace?
Looks like it is not possible to debug yourself:
https://stackoverflow.com/questions/64321402/adding-a-watchpoint-in-the-current-process-not-in-gdb-not-for-debugging

but it is possible to fork process.
In theory it certainly should be possible - gdb is normal process, so at 
least we can implement our mini-gdb.
But not sure how complex it will be.

It will be nice to set watchpoint on for example "op" in 
`pgaio_io_reclaim` and disable it in `pgaio_io_before_start`.
It may have less overhead (both memory and CPU) than using `mprotect` to 
detect illegal access.

But I afraid that if mempory corruption happens in kernal mode then 
memory protection or watchpoints will not help.