vaas icon indicating copy to clipboard operation
vaas copied to clipboard

PHP SDK: Timeout cancellation exceptions not thrown correctly

Open lennartdohmann opened this issue 5 months ago • 0 comments

Steps to reproduce

  1. Set up an environment to scan files with PHP SDK
  2. Set timeout in VaaS options very low:
$options = new VaasOptions(
    useHashLookup: true,
    useCache: true,
    vaasUrl: getenv("VAAS_URL"),
    timeout: 1
);
  1. Scan a file that is a few megabytes big
  2. Wait for the exception that should be thrown

Expected

  1. Set a timeout
  2. A file scan takes too long
  3. 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.

lennartdohmann avatar Aug 27 '25 11:08 lennartdohmann