Opened 13 months ago
Closed 13 months ago
#5137 closed defect (fixed)
interrupt handler called in wrong query
|Reported by:||kalenik||Owned by:||pramsey|
kalenik=# select st_npoints(st_buffer(st_makevalid(test.geom), 123, 'quad_segs=99999')) from test; ^CCancel request sent ERROR: canceling statement due to user request kalenik=# select count(*) from test, st_subdivide(test.geom); count ------- 0 (1 row) kalenik=# select count(*) from test, st_subdivide(test.geom); count ------- 119 (1 row)
in the example you may see that after first query was interrupt next query returns empty set although there are 119 after subdivision of geometry in the table which is becomes clear after repeat execution.
I did little investigation and found out that the reason is _lwgeom_interrupt_requested variable which indicates if interruption yet needs to be handled on lwgeom side. in the example this variable is set to 1 while first query execution and is not handled anywhere because interruption happened on GEOS side and query execution just ended. when the second query with ST_Subdivide starts executing variable _lwgeom_interrupt_requested is still set to 1 because no LW_ON_INTERRUPT which sets this variable back to 0 haven't been called yet. ST_Subdivide stumbles over not handled interruption because it has LW_ON_INTERRUPT check and returns empty set and sets _lwgeom_interrupt_requested to 0. Last query returns right result because there is no interrupt to be handled.
So the problem is that if some function got interrupted and this interrupt hasn't been handled by LW_ON_INTERRUPT it won't be handled until function that calls LW_ON_INTERRUPT is encountered which is clearly wrong.
Change History (1)
comment:1 by , 13 months ago
|Status:||new → closed|