-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possibility to cancel / abort validation #119
Comments
In addition to my post above: the reason why we are having this issue is because we have users that submit very large xml files for validation that can take up very long. Some files are >200MB (uncompressed) and can contain up to 100k of items (e.g. product catalogue items) that need to be validated with 10+ rules. |
Hi @Michiel-s I added a quick test (see the previous commit) and my output looks like this, which seems to be okay:
What Schematron implementation are you using??? |
I haven't run your test yet, but what we see is that the thread from the pool is not aborted. The main tread indeed reports that it executed the We use |
Ah okay. You are saying because I quit my application, the other thread is stopped by accident, but when I would be waiting in the main thread I would see, that the other thread still runs. Is that what you're saying? |
I think so yes. |
Okay yes, I can confirm that:
|
Effectively that would mean, that more or less all the APIs would need to declare What do you think about an |
I pushed a
|
We'll do that. I'll let you know |
@Michiel-s so how does it look like with your tests? If it is to your needs, I will release 6.2.4 asap |
Hi @phax, my colleague implemented and tested the snapshot last Friday and reported back to me that our unit tests indicate that the timeout works. Not sure if that includes the thread killig. He just went on a 2 week holiday break so I can't verify at this moment. But based on his comments, and also on your own observations, I would say let's release. If that is ok with you. Thx very much for the fix. We really appreciate it. Please let me know if we can return any favor. |
@Michiel-s Thanks for the swift response - I will just build a 6.2.4 release build, and if you need interruptions on additional places - let me know. There will be a 6.2.5 or 6.3.0 anyway ;-) |
Hi @phax,
Is there a way to cancel or abort a validation? We've created a wrapper application around ph-schematron that can receive validation requests via a REST API.
To run the actual validation steps we execute a Callable task by a CachedThreadPool ExecutorService. We then try to get the response and wait for max 30 sec before returning a server timeout exception. However the task doesn't seem to act upon a Interruption signal. Is this something you could add to the ph-schematron code, to check for
Thread.currentThread().isInterrupted()
at regular intervals? Or do you see any other solution that we could implement?We're currently using v5.6.0 and are preparing to move to v6.x
Relevant parts of our code:
The
future.cancel(true);
in the finally block sends the interrupt signal.I've found this article probably explaining why executed task is not stopped:
https://codeahoy.com/java/Cancel-Tasks-In-Executors-Threads/
Kind regards,
Michiel
The text was updated successfully, but these errors were encountered: