amphp / cluster

Building multi-core network applications with PHP.
MIT License
60 stars 9 forks source link

Error in cluster #8

Closed prolic closed 4 years ago

prolic commented 4 years ago

I see this in my logs regularly:

api_1             | [2020-05-31T22:02:33.704741-04:00] worker-17.DEBUG: Accept 10.121.1.2:41080 on 10.121.1.3:1337 #413 [] []
api_1             | [2020-05-31T22:02:33.708023-04:00] worker-17.DEBUG: GET http://local.pl.com:1337/secret/ HTTP/1.1 @ 10.121.1.2:41080 [] []
api_1             | [2020-05-31T22:02:34.612730-04:00] cluster-6.ERROR: STDERR from PID 17: src/unix/core.c:877: uv__io_stop: Assertion `loop->watchers[w->fd] == w' failed.

I'm using lib-uv in docker from php:7.4-cli image. When I disable the uv-extension the problem is gone.

For reference, here is my Dockerfile:

FROM php:7.4-cli

RUN apt-get update \
    && apt-get install libuv1-dev libpq-dev -y \
    && pecl install uv-beta raphf \
    && docker-php-ext-enable uv raphf \
    # we need to install pq in extra step, because raphf needs to be there already
    && pecl install pq \
    && docker-php-ext-enable pq

RUN echo date.timezone = "America/New_York" >  /usr/local/etc/php/conf.d/timezone.ini \
    && echo expose_php = Off > /usr/local/etc/php/conf.d/expose_php.ini

ADD . /var/www

WORKDIR /var/www

ENTRYPOINT ./vendor/bin/cluster ./bin/server.php -- --port 1337
kelunik commented 4 years ago

Does it only happen with cluster or also without it?

prolic commented 4 years ago

I encountered this issue yesterday, didn't change anything in the code and cannot reproduce it anymore right now. So I can't tell, sorry.

prolic commented 4 years ago

I can tell now, this problem also happens when using the server without the cluster. But it only happens on first start of the docker container. When I restart the container, everything works fine. It seems to be this way pretty consistent.

prolic commented 4 years ago

@kelunik any idea why I need to restart the docker containers before it works?

kelunik commented 4 years ago

@prolic This seems to be a duplicate of https://github.com/amphp/amp/issues/292 actually, so I'm closing this.