Skip to content
This repository was archived by the owner on Oct 26, 2019. It is now read-only.
This repository was archived by the owner on Oct 26, 2019. It is now read-only.

A TimeoutException is thrown while trying to listen to docker system events using DockerAsync #312

Description

@guillemcanal

Hi,

I tried to use DockerAsync client to listen to docker system events like so :

<?php
// filename : ./examples/listen-to-docker-events.php
require dirname(__DIR__) . '/vendor/autoload.php';

use Amp\Loop;
use Docker\DockerAsync;
use Docker\Stream\EventStream;

Loop::run(function () {
    $docker = DockerAsync::create();
    /** @var EventStream $events */
    $events = yield $docker->systemEvents();
    $events->onFrame(function ($event) {
       var_dump($event);
    });
    $events->wait();
});

After 15 seconds, Amp\Artax\TimeoutException is thrown :

Fatal error: Uncaught Amp\Artax\TimeoutException: Allowed transfer timeout exceeded: 15000 ms in /app/vendor/amphp/artax/lib/DefaultClient.php on line 402

Amp\Artax\TimeoutException: Allowed transfer timeout exceeded: 15000 ms in /app/vendor/amphp/artax/lib/DefaultClient.php on line 402

Call Stack:
    0.0001     390472   1. {main}() /app/examples/server.php:0
    0.0105    1637376   2. Amp\Loop::run() /app/examples/server.php:16
    0.0107    1648320   3. Amp\Loop\NativeDriver->run() /app/vendor/amphp/amp/lib/Loop.php:76
   15.0209    6772248   4. Amp\Loop\NativeDriver->tick() /app/vendor/amphp/amp/lib/Loop/Driver.php:70
   15.0210    6769168   5. Amp\Loop\NativeDriver->error() /app/vendor/amphp/amp/lib/Loop/Driver.php:126

I'm running the code using the official PHP 7.2.5 docker image with the docker socket mounted as a volume --volume /var/run/docker.sock:/var/run/docker.sock:ro and the following extensions :

[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
ftp
hash
iconv
intl
json
libxml
mbstring
mysqlnd
openssl
pcntl
pcre
PDO
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
sodium
SPL
sqlite3
standard
tokenizer
xdebug
xml
xmlreader
xmlwriter
zlib

[Zend Modules]
Xdebug

It must be noted that every docker commands that don't use an EventStream are working as expected.

I tried to debug the call using xdebug, but I haven't found anything suspicious in your client.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions