Allow to stop a running process
Description
Environment
Attachments
- 02 Feb 2019, 12:34 PM
- 02 Feb 2019, 12:34 PM
- 17 Sep 2015, 08:57 AM
Activity
Since there’s no reliable way to stop/interrupt a Java thread/process, this needs to be implemented in a cooperative way. We need to add a set of new process control interface (ProcessCall, SvrProcess or perhaps a new interface) and process that can be stop/interrupt needs to implement the new interfaces. A new UI and/or server monitor method mechanism should be build for processes that implements the new control interface.
Revisiting this:
Uploaded
which adds a long delay in Recalculate Cube for testing purposes.
Uploaded patch adapted to 6.2
In this patch I'm exploring the possibility to interrupt the SQL running query in postgresql.
However, it works when the class is interrupted in the sleep, but it's not working when the class is interrupted in the PreparedStatement
The interrupt on the WProcessCtl/AbstractProcessCtl thread is not propagating to the query running.
Regards,
Carlos Ruiz
today IRC
druiz
15:27
norbertbede3, the problem with stopping a slow process is that you can stop the thread but the query in the DB keeps running until it finishes
15:27
norbertbede2 left the room (quit: Ping timeout: 240 seconds).
15:28
norbertbede3
i see
any idea how to resolve this ?
15:29
possy
can't one kill db processes as well
15:34
druiz
I know it is possible to kill a db process, but I'm not sure if the db process is associated with the java process in iDempiere right now. If you know which db process to stop, it is possible.
15:36
norbertbede3
any epochal idea here ? any others ?
15:38
CarlosRuiz
15:38
thinking in draft
could be something like
when running the JDBC query we associate it to AbstractProcessCtl
and when interrupting the AbstractProcessCtl thread - check first if there are associated JDBC and send a cancel query to the backend
in postgresql there is a function pg_cancel_backend - requires the PID of the process running the query
in oracle I don't know
15:42
now - on JDBC there is a Statement.cancel() - I haven't tested that to see if is inline with our request
both topics are similar.
There is no way to stop a running process. That can be changed if we change code of the processes but that is not easy to do everywhere. Up to now we have no interface and no user interface for that