Incorrect stop of the schedulers
Description
Environment
Attachments
- 10 May 2020, 07:16 AM
- 04 Apr 2018, 08:05 AM
relates to
Activity
Martin Schönbeck May 9, 2020 at 8:16 PM(edited)
triaged by @Martin Schönbeck as reproducible in 7.1z. When starting the process manually even with several reloads and after waiting of the ten minutes scheduler interval of the process the process kept stopped. The process took about 25 seconds. After starting the process and then clicking “stop all” it took several seconds until control output appeared (so the process was running when “stop all” was clicked) but it never got reactivated without clicking start.
Second test was to wait until the process was started automatically by the scheduler. Then it was reproducible as described in the abovementioned thread.
Priority changed to minor because as workaround the process can be stopped separately after finishing it’s current run.
For information I have added the relevant parts of the log.
Heng Sin Low May 9, 2020 at 12:15 PM(edited)
Patch suggested in the google group discussion above:
In methods AdempiereServerMgr.stop() and AdempiereServerMgr.stopAll() need change parameter in command.
server.scheduleFuture.cancel(false);
This will ended the process without errors and stop the thread
You must add validation in method AdempiereServerMgr.ServerWrapper.run() for validation "InterruptedException"
@Override public void run() { server.run(); if (!isInterrupted()) scheduleFuture = Adempiere.getThreadPoolExecutor().schedule(this, server.getSleepMS(), TimeUnit.MILLISECONDS); }
This will not allowed run planning next start this scheduler.
Issue based on discussion https://groups.google.com/forum/#!topic/idempiere/nGDi6gYAVoE
Best regards
Palich.ru Development Team