chrome-devtools-protocol icon indicating copy to clipboard operation
chrome-devtools-protocol copied to clipboard

Context::background() does not work

Open jakubkulhan opened this issue 7 years ago • 1 comments

This always fails:

$ctx = Context::background();
$instance->createSession($ctx);

Context::background() has deadline null - it sets stream_set_timeout() to 0. Seems that http://php.net/manual/en/function.stream-set-timeout.php does not clear timeout, when setting to zero, but instead times out socket immediately.

jakubkulhan avatar Feb 19 '18 22:02 jakubkulhan

This is probably the cause of the error I'm getting:

Fatal error: Uncaught GuzzleHttp\Exception\ConnectException: cURL error 28: Connection timed out after 1315 milliseconds (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) in C:\xampp\htdocs\chrome\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:200 Stack trace: #0 C:\xampp\htdocs\chrome\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(155): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array) #1 C:\xampp\htdocs\chrome\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(105): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory)) #2 C:\xampp\htdocs\chrome\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory)) #3 C:\xampp\htdocs\chrome\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php(28): GuzzleHttp\Handl in C:\xampp\htdocs\chrome\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 200

My Code:

// context creates deadline for operations $ctx = Context::withTimeout(Context::background(), 60 /* seconds */);

// launcher starts chrome process ($instance) $launcher = new Launcher(); $launcher->setExecutable('C:\Program Files (x86)\Google\Chrome\Application'); $instance = $launcher->launch($ctx);

Any workaround?

pauloacosta avatar Sep 19 '20 02:09 pauloacosta