GDATASoftwareAG / GDATASoftwareAG/vaas
PHP SDK: Timeout cancellation exceptions not thrown correctly
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 38
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
Steps to reproduce
- Set up an environment to scan files with PHP SDK
- Set timeout in VaaS options very low:
$options = new VaasOptions(
useHashLookup: true,
useCache: true,
vaasUrl: getenv("VAAS_URL"),
timeout: 1
);
- Scan a file that is a few megabytes big
- Wait for the exception that should be thrown
Expected
- Set a timeout
- A file scan takes too long
- A proper exception is thrown telling me that it was canceled due to a timeout
Actual
PHP Fatal error: Uncaught Amp\CancelledException: The operation was cancelled in /home/lennart/Projects/github.com/vaas/php/examples/VaasExample/vendor/amphp/amp/src/Internal/Cancellable.php:56
Next Amp\Future\UnhandledFutureError: Unhandled future: Amp\CancelledException: "The operation was cancelled"; Await the Future with Future::await() before the future is destroyed or use Future::ignore() to suppress this exception. Enable assertions and set AMP_DEBUG=true in the process environment to track its origin. in /home/lennart/Projects/github.com/vaas/php/examples/VaasExample/vendor/amphp/amp/src/Internal/FutureState.php:53
Next Revolt\EventLoop\UncaughtThrowable: Uncaught Amp\Future\UnhandledFutureError thrown in event loop callback Amp\Internal\FutureState::{closure:Amp\Internal\FutureState::__destruct():54} defined in /home/lennart/Projects/github.com/vaas/php/examples/VaasExample/vendor/amphp/amp/src/Internal/FutureState.php:54; use Revolt\EventLoop::setErrorHandler() to gracefully handle such exceptions: Unhandled future: Amp\CancelledException: "The operation was cancelled"; Await the Future with Future::await() before the future is destroyed or use Future::ignore() to suppress this exception. Enable assertions and set AMP_DEBUG=true in the process environment to track its origin. in /home/lennart/Projects/github.com/vaas/php/examples/VaasExample/vendor/revolt/event-loop/src/EventLoop/UncaughtThrowable.php:13
PHP Fatal error: Uncaught FiberError: Cannot suspend in a force-closed fiber in /home/lennart/Projects/github.com/vaas/php/examples/VaasExample/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php:625
Nextcloud App
This is very easy to see in the G Data Antivirus app for Nextcloud. Simply pull up an instance or start the devcontainer, set the timeout to 1s in the app settings, and upload a file that is approx. >5MB. At this point, I would expect to see an error as a user, but nothing happens and the file is blocked because it is being “processed” by the scan process like forever.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the PHP SDK scan with VaasOptions timeout set to 1 second and a file larger than 5 MB, then trace how the timeout cancellation is handled. Verify the scan reports a proper timeout exception to the caller without an unhandled future, fatal fiber error, or indefinitely blocked scan.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100