Getting SIGSEGV and/or "Connection reset by peer" errors when using Blackfire on Docker? Read further to troubleshoot this issue
When using Docker, profiling might fail and produce the following error within your application container:
[pool www] child 52 exited on signal 11 (SIGSEGV) after 5.068248 seconds from start
In addition, logs from the agent displays the following error:
Error while reading graph from probe.
read tcp 192.168.176.2:8707->192.168.176.4:47052:
read: connection reset by peer
This is most likely because the Linux version of the probe is used in an Alpine container, or the opposite.
Solution: use the appropriate version of the probe
The documentation provides a snippet to add in your Docker image for your application container:
FROM php:7.2-apache
# If you use Alpine, you need to set this value to "alpine"
ENV current_os=linux
RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
&& curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/$current_os/amd64/$version \
&& mkdir -p /tmp/blackfire \
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \
&& printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > $PHP_INI_DIR/conf.d/blackfire.ini \
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
Please note the current_os variable. When using Alpine, change the value to alpine as the comment suggests.
After this change, you will need to re-build your container.
Contact our support
If the problem persists, please open a support ticket.