open-telemetry / open-telemetry/opentelemetry-php

SIGSEGV when using with ionCube and Octane with RoadRunner

Open
#1,995 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
912
Forks
232
Avg merge
7d 16h
Merged PRs (30d)
4

Description

Describe your environment
Container built via a Dockerfile

FROM php:8.4-cli AS encoder

ENV DEBIAN_FRONTEND=noninteractive

RUN dpkg --add-architecture i386 \
    && apt-get update -y && apt-get install -y \
    curl \
    unzip \
    git \
    zip \
    libc6:i386 \
    libstdc++6:i386 \
    zlib1g:i386 \
    && apt-get clean && rm -rf /var/lib/apt/lists/*

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

WORKDIR /var/www

RUN git config --global --add safe.directory /var/www

COPY . .

RUN composer install --no-dev --no-interaction --optimize-autoloader --ignore-platform-reqs

RUN curl -fsSL "https://s3.us-east-1.amazonaws.com/downloads3.ioncube.com/eval_download_packages/ioncube_encoder/linux_i686/en/ioncube_encoder_evaluation.tar.gz" \
    -o /tmp/encoder.tar.gz \
    && tar -xzf /tmp/encoder.tar.gz -C /opt \
    && rm /tmp/encoder.tar.gz

RUN mv /var/www/vendor /tmp/vendor

RUN /opt/ioncube_encoder_evaluation/ioncube_encoder.sh -C -x86-64 -84 \
    --allow-reflection-all \
    --copy "*.blade.php" \
    --copy "*.json" \
    --copy "*.yaml" \
    --copy "*.yml" \
    --copy "*.xml" \
    --copy "*.txt" \
    --copy "*.md" \
    --copy "*.lock" \
    --copy "*.js" \
    --copy "*.css" \
    --copy "*.html" \
    --copy "*.env*" \
    --copy "*.pem" \
    --ignore "ioncube_encoder*" \
    #--ignore "tests/" \
    #--ignore "Tests/" \
    /var/www/ -o /tmp/encoded; \
    EXIT_CODE=$?; \
    if [ $EXIT_CODE -ne 0 ] && [ $EXIT_CODE -ne 8 ]; then exit $EXIT_CODE; fi


FROM php:8.4-cli

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update -y && apt-get install -y \
    build-essential \
    curl \
    unzip \
    git \
    zip \
    librdkafka-dev \
    pkg-config \
    libargon2-dev \
    libcurl4-openssl-dev \
    libedit-dev \
    libsodium-dev \
    libsqlite3-dev \
    libssl-dev \
    libxml2-dev \
    zlib1g-dev \
    libffi-dev \
    libxslt1-dev \
    libzip-dev \
    libpng-dev \
    libfreetype6-dev \
    libjpeg-dev \
    libonig-dev \
    && docker-php-ext-configure gd --with-freetype --with-jpeg \
    && docker-php-ext-install \
        pdo_mysql \
        mysqli \
        bcmath \
        pcntl \
        sockets \
        gd \
        zip \
        exif \
        opcache \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

RUN curl -fsSL https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz -o /tmp/ioncube.tar.gz \
    && tar -xzf /tmp/ioncube.tar.gz -C /tmp \
    && cp /tmp/ioncube/ioncube_loader_lin_8.4.so "$(php -r 'echo ini_get("extension_dir");')" \
    && echo "zend_extension=ioncube_loader_lin_8.4.so" > /usr/local/etc/php/conf.d/00-ioncube.ini \
    && rm -rf /tmp/ioncube /tmp/ioncube.tar.gz

RUN pecl install rdkafka && docker-php-ext-enable rdkafka
RUN pecl install redis && docker-php-ext-enable redis
RUN apt-get update && apt-get install -y --no-install-recommends $PHPIZE_DEPS \
    && pecl install opentelemetry && docker-php-ext-enable opentelemetry \
    && rm -rf /var/lib/apt/lists/*
RUN php -m | grep -qix opentelemetry || { echo "!!! opentelemetry extension FAILED TO LOAD"; exit 1; }

RUN echo "memory_limit=4096M" > /usr/local/etc/php/conf.d/memory.ini \
    && echo "max_execution_time=600" >> /usr/local/etc/php/conf.d/memory.ini \
    && echo "opcache.enable=1" > /usr/local/etc/php/conf.d/opcache.ini \
    && echo "opcache.memory_consumption=256" >> /usr/local/etc/php/conf.d/opcache.ini \
    && echo "opcache.max_accelerated_files=20000" >> /usr/local/etc/php/conf.d/opcache.ini

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

WORKDIR /var/www

COPY --from=encoder /tmp/encoded /var/www

COPY --from=encoder /tmp/vendor /var/www/vendor

RUN php vendor/bin/rr get-binary --location /usr/local/bin 2>/dev/null || \
    (curl -sSL https://github.com/roadrunner-server/roadrunner/releases/download/v2024.3.5/roadrunner-2024.3.5-linux-amd64.tar.gz -o /tmp/rr.tar.gz && \
     tar xzf /tmp/rr.tar.gz -C /usr/local/bin --strip-components=1 && \
     rm /tmp/rr.tar.gz) || \
    echo "RoadRunner will be downloaded at runtime"

RUN chmod -R 777 storage bootstrap/cache 2>/dev/null || true
RUN chmod 644 /var/www/public.pem /var/www/private.pem 2>/dev/null || true
RUN chmod 644 /var/www/fat-public-key.pem /var/www/fat-private-key.pem 2>/dev/null || true

EXPOSE 8000

# Start Laravel Octane with RoadRunner
CMD ["php", "artisan", "octane:start", "--server=roadrunner", "--host=0.0.0.0", "--port=8000", "--workers=4", "--max-requests=1000"]

Steps to reproduce

  • Encode a test.php(content as simple as possible e.g. <?php echo 'test';) file via ionCube (https://www.ioncube.com/ choose PHP8+)
  • Place the encoded php content as test.php next to the Dockerfile
  • Build the Dockerfile with: docker build -f Dockerfile -t otel-debug-local .
  • Run the container with docker run --rm -it --entrypoint /bin/sh otel-debug-local

What is the expected behavior?
An output which says test

What is the actual behavior?
An error which says Segmentation fault / SIGSEGV

Additional context
Environment

  • PHP 8.4.22 (NTS, non-debug, api 20240924), x86_64, Debian (official php:8.4-cli)
  • ionCube Loader 15.5.0 (zend_extension, loaded first via 00-ioncube.ini)
  • opentelemetry extension 1.2.1 (also reproduced with 1.1.0) — any ext registering a Zend observer
  • Laravel 12, using Octane served via RoadRunner as seen in the Dockerfile above.

Using these OpenTelemetry packages:

"open-telemetry/detector-container": "^1.3",
"open-telemetry/exporter-otlp": "^1.0",
"open-telemetry/gen-otlp-protobuf": "^1.0",
"open-telemetry/opentelemetry-auto-curl": "^0.2.0",
"open-telemetry/opentelemetry-auto-ext-rdkafka": "^0.0",
"open-telemetry/opentelemetry-auto-guzzle": "^1.0",
"open-telemetry/opentelemetry-auto-http-async": "^1.2",
"open-telemetry/opentelemetry-auto-io": "^0.2.0",
"open-telemetry/opentelemetry-auto-laravel": "^1.0",
"open-telemetry/opentelemetry-auto-pdo": "^0.4",
"open-telemetry/opentelemetry-auto-psr18": "^1.2",
"open-telemetry/opentelemetry-logger-monolog": "^1.2",
"open-telemetry/sdk": "^1.0",

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Dockerfile and minimal test.php described in the reproduction steps, then build and run the container to confirm the SIGSEGV. Compare the setup with ionCube, OpenTelemetry, and the RoadRunner/Octane entry point enabled as shown. Done means the crashing combination is diagnosed and the expected test output or a clearly documented limitation is established.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, laravel, php
Domain
backend, devops, observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.