Opened 10 years ago

Last modified 6 years ago

#3145 new enhancement

ST_StraightSkeleton is uninterruptible

Reported by: strk Owned by: colivier
Priority: medium Milestone: PostGIS Fund Me
Component: sfcgal Version: master
Keywords: Cc:

Description

Interruption of ST_StraightSkeleton call only happens when out of sfcgal land. It would be nice to be able to timeout/interrupt those calls too as they can be very slow

Change History (5)

comment:1 by robe, 7 years ago

Milestone: PostGIS FuturePostGIS Fund Me

Milestone renamed

comment:2 by hmercier, 6 years ago

@strk I think this is not specific to St_StraightSkeleton, but is valid for all SFCGAL functions.

Do you know what to do to overcome this ? Is there some signal to catch or some special postgresql function to poll during a computation to check for user interruption ?

comment:3 by strk, 6 years ago

PostGIS module code takes care of intercepting interruption requests from user, see postgis/postgis_module.c

The handleInterrupt function currently calls a GEOS API meant to deal with interruption: GEOS_interruptRequest (and another exposed by liblwgeom…)

What we need here is one function to request interruption in SFCGAL, to be called from there.

Interruptibility API was added in GEOS from version 3.4.0, released in August 2013.

The GEOS API allows setting a flag which is checked by GEOS code at regular intervals. It may not be the best approach (polling) but it works fine, and is what PostgreSQL is also suggesting modules to use internally.

In GEOS, if you want to check it, we drop a call to a macro in loops here and there:

#define GEOS_CHECK_FOR_INTERRUPTS() geos::util::Interrupt::process()

The function checks if the flag is set or not, the API allows setting or clearing that flag.

I think the alternative would be directly handling sigint but for some reason we decided not to do that (I forgot what the reason was, maybe you can check in changeset history)

comment:4 by hmercier, 6 years ago

Thanks for your detailed explanation.

I've added a ticket on our side. https://github.com/Oslandia/SFCGAL/issues/173 I hope we can come with a enhancement soon.

I think the alternative would be directly handling sigint but for some reason we decided not to do that (I forgot what the reason was, maybe you can check in changeset history)

From what I see, the code that sets the global flag is linked to a SIGINT handler. So what do you mean by "directly handling" SIGINT ?

comment:5 by strk, 6 years ago

From what I see, the code that sets the global flag is linked to a SIGINT handler. So what do you mean by "directly handling" SIGINT ?

I meant handling SIGINT in GEOS itself. Maybe it was something that would not work on Windows…

Note: See TracTickets for help on using tickets.