Opened 10 days ago

Closed 4 days ago

#5841 closed defect (fixed)

Pg18 changes pqsignal() return

Reported by: pramsey Owned by: pramsey
Priority: medium Milestone: PostGIS 3.5.3
Component: postgis Version: master
Keywords: Cc:

Description

And this in turn breaks our build. Consultation with pgsql-hackers indicates that we've been Doing It Wrong all along.

https://www.postgresql.org/message-id/flat/4E796D56-79B5-4447-9DA7-5428BC1A6B53%40cleverelephant.ca

Change History (10)

comment:1 by pramsey, 10 days ago

The correct answer is to not try to catch signals at all, leave that to PostgreSQL. Instead, just look at the current value of QueryCancelPending || ProcDiePending from miscadmin.h to find out what the interrupt state is. This turns out to be not hard to do with the existing callback facilities in geos and liblwgeom.

comment:2 by Paul Ramsey <pramsey@…>, 10 days ago

In 1f7c3150/git:

Rework interrupt handling and remove signal handling
from PostGIS. PostGIS does not need to capture signals,
it just needs to look at the state flags exposed by

PgSQL (QueryCancelPending
ProcDiePending) from

time to time and interrupt itself if they are set.
References #5841

comment:3 by pramsey, 10 days ago

Wondering if this should be back-ported into 3.5, since the feedback from pgsql-hackers was that basically our implementation has been broken forever.

comment:4 by Paul Ramsey <pramsey@…>, 10 days ago

In 0549494/git:

Add interrupt support to interpolate grid, and
confirm interrupt support on GDAL contour.
References #5841

comment:5 by Paul Ramsey <pramsey@…>, 9 days ago

In 0b003a8/git:

Remove use of pqsignal in favour of checking pgsql interrupt
variables in order to respect user interrupt request.
References #5841

comment:6 by pramsey, 9 days ago

See #5137 for information on former use of executorHook

comment:7 by robe, 7 days ago

Looks like the commit broke interruptability on winnie, tried triggering a number of times and fails in same spot. The 3.5 branch of hers was green before this. 5 minutes is hard to ignore, but since the other interrupts are passing perhaps its only the GEOS one at issue.

On winnie I see this, but interrupt and interrupt_relate are okay

 ./regress/core/interrupt_buffer .. failed (diff expected obtained: /projects/postgis/tmp/3.5.1dev_pg16_geos3.13_gdal3.9.2w64/test_126_diff)
-----------------------------------------------------------------------------
--- ./regress/core/interrupt_buffer_expected	2024-10-29 18:48:10.401068900 -0400
+++ /projects/postgis/tmp/3.5.1dev_pg16_geos3.13_gdal3.9.2w64/test_126_out	2025-01-25 12:40:10.602262300 -0500
@@ -1,3 +1,3 @@
 ERROR:  canceling statement due to statement timeout
-buffer interrupted on time
+buffer interrupted late: 00:04:53.254363 (00:00:06.07376 tolerated)
 1|5
-----------------------------------------------------------------------------

Dronie did fail once, but I think this is a random interrupt failure

On dronie:

 regress/core/interrupt .. failed (diff expected obtained: /tmp/pgis_reg/test_124_diff)

-----------------------------------------------------------------------------

--- /drone/src/regress/core/interrupt_expected	2025-01-24 23:12:20.455468619 +0000

+++ /tmp/pgis_reg/test_124_out	2025-01-25 00:19:54.053246531 +0000

@@ -1,3 +1,3 @@

 ERROR:  canceling statement due to statement timeout

-segmentize interrupted on time

+ERROR:  canceling statement due to statement timeout

 1|LINESTRING(0 0,2 0,4 0)

-----------------------------------------------------------------------------

 regress/core/interrupt_relate .. ok in 1428 ms

 regress/core/interrupt_buffer .. ok in 618 ms

comment:8 by Regina Obe <lr@…>, 4 days ago

In f5048c59/git:

Fix windows interrupt
References #5841 for PostGIS 3.6.0

comment:9 by robe, 4 days ago

Milestone: PostGIS 3.6.0PostGIS 3.5.3

comment:10 by Regina Obe <lr@…>, 4 days ago

Resolution: fixed
Status: newclosed

In 35e55942/git:

Fix windows interrupt
Closes #5841 for PostGIS 3.5.3

Note: See TracTickets for help on using tickets.