View Issue Details

IDProjectCategoryView StatusLast Update
0002342XdebugTracingpublic2025-05-07 14:06
Reporterthecrypto Assigned Toderick  
PrioritynormalSeveritymajorReproducibilityalways
Status feedbackResolutionopen 
Product Version3.4.2 
Summary0002342: Segfault in PHP-FPM on Alpine when xdebug.start_with_request=yes and calling StripeClient->subscriptions->all()
Description

Running Xdebug 3.4.2 on PHP 8.4.6-fpm-alpine3.21 (Docker). As soon as xdebug.start_with_request = yes is set, any call to \Stripe\StripeClient->subscriptions->all(...) crashes the FPM worker with SIGSEGV inside Xdebug’s trace_textual.c::add_arguments. Other endpoints (e.g. customers->all()) complete normally. Changing xdebug.start_with_request to no (even with trace still enabled) eliminates the crash.

Steps To Reproduce
  1. Replace placeholder STRIPE_API_SK_TEST in .env with your Stripe test secret key
  2. docker-compose -f docker-compose.yml -p xdebug-alpine-stripe up -d --build
  3. docker exec -it xdebug-alpine-stripe-fpm sh
  4. php fetch.php
  5. Observe:
    === customers ===
    array()
    === subscriptions ===
    Segmentation fault (core dumped)
  6. In z-xdebug-override.ini, set xdebug.start_with_request = no and repeat -> no segfault
Additional Information

• Only subscriptions->all() triggers the crash
• Core dump (/tmp/core.php-fpm.<pid>) shows SIGSEGV in add_arguments() of trace_textual.c
• strace confirms a SIGSEGV right after a buffer/write syscall
• Stripe-PHP SDK is 100% PHP; the bug lives in Xdebug’s tracing logic on musl/Alpine
• Workarounds:
Use xdebug.start_with_request = trigger or no
Switch to a glibc-based PHP image (e.g. php:8.4.6-fpm-bullseye or php:8.4.6-fpm-bookworm)

Tagsalpine, bug, php-fpm, segfault, stripe-php, tracing, xdebug
Operating SystemAlpine 3.21 (Docker)
PHP Version8.4-dev

Activities

thecrypto

2025-04-27 22:14

reporter   ~0007263

Apologies, please disregard previous zip as it was missing php.ini and an empty vendor folder required for the docker compose file.

Please use this instead to easily reproduce the segmentation fault.

derick

2025-05-02 10:36

administrator   ~0007272

docker compose up was still running after 1000 seconds. I aborted it. Can you come up with something smaller?

thecrypto

2025-05-02 12:09

reporter   ~0007279

Hi Derick,

Would you be kind enough to share more information of the issue? I ran this docker-compose command on WSL with Docker Desktop on Windows when I compiled it and now I've just the zip content on MacOS on an M3 with Docker Desktop for Mac, and that docker-compose commands worked on both, it took about 30-40 seconds to build and then ran fine.

derick

2025-05-07 13:58

administrator   ~0007282

I don't have more information. It just took a really long time — and it was too long for me to wait for it. I now ran it again, and it was done in 81 seconds. \_o-/

derick

2025-05-07 14:01

administrator   ~0007283

In any case, it doesn't crash anything here:

/app # php fetch.php 
start_with_request = yes

=== customers ===
/app/fetch.php:13:
class Stripe\Collection#16 (4) {
  public $object =>
  string(4) "list"
  public $data =>
  array(1) {
    [0] =>
    class Stripe\Customer#21 (22) {
      public $id =>
      string(18) "cus_XXXXXXXXXXXX"
      public $object =>
      string(8) "customer"
      public $address =>
      class Stripe\StripeObject#26 (6) {
        ...
      }
      public $balance =>
      int(0)
      public $created =>
      int(1600000477)
      public $currency =>
      NULL
      public $default_source =>
      NULL
      public $delinquent =>
      bool(false)
      public $description =>
      NULL
      public $discount =>
      NULL
      public $email =>
      string(23) "xxxxxxx@xxxxxxxxxxxxx.xxnl"
      public $invoice_prefix =>
      string(8) "FFFFFFFF"
      public $invoice_settings =>
      class Stripe\StripeObject#27 (4) {
        ...
      }
      public $livemode =>
      bool(false)
      public $metadata =>
      class Stripe\StripeObject#31 (0) {
      }
      public $name =>
      string(14) "Derick Rethans"
      public $next_invoice_sequence =>
      int(1)
      public $phone =>
      NULL
      public $preferred_locales =>
      array(1) {
        ...
      }
      public $shipping =>
      NULL
      public $tax_exempt =>
      string(4) "none"
      public $test_clock =>
      NULL
    }
  }
  public $has_more =>
  bool(true)
  public $url =>
  string(13) "/v1/customers"
}

=== subscriptions ===
/app/fetch.php:17:
class Stripe\Collection#11 (4) {
  public $object =>
  string(4) "list"
  public $data =>
  array(0) {
  }
  public $has_more =>
  bool(false)
  public $url =>
  string(17) "/v1/subscriptions"
}

derick

2025-05-07 14:06

administrator   ~0007284

I tried adding valgrind to the Dockerfile, and now when I run --build, it fails again — with an error I don't understand (I did remove the image first too though)

Recreating 10bda78bf21e_xdebug-alpine-stripe-fpm ... 

ERROR: for 10bda78bf21e_xdebug-alpine-stripe-fpm  'ContainerConfig'

ERROR: for xdebug-alpine-stripe-fpm  'ContainerConfig'
Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  File "compose/cli/main.py", line 81, in main
  File "compose/cli/main.py", line 203, in perform_command
  File "compose/metrics/decorator.py", line 18, in wrapper
  File "compose/cli/main.py", line 1186, in up
  File "compose/cli/main.py", line 1182, in up
  File "compose/project.py", line 702, in up
  File "compose/parallel.py", line 108, in parallel_execute
  File "compose/parallel.py", line 206, in producer
  File "compose/project.py", line 688, in do
  File "compose/service.py", line 581, in execute_convergence_plan
  File "compose/service.py", line 503, in _execute_convergence_recreate
  File "compose/parallel.py", line 108, in parallel_execute
  File "compose/parallel.py", line 206, in producer
  File "compose/service.py", line 496, in recreate
  File "compose/service.py", line 615, in recreate_container
  File "compose/service.py", line 334, in create_container
  File "compose/service.py", line 922, in _get_container_create_options
  File "compose/service.py", line 962, in _build_container_volume_options
  File "compose/service.py", line 1549, in merge_volume_bindings
  File "compose/service.py", line 1579, in get_container_data_volumes
KeyError: 'ContainerConfig'
[3591205] Failed to execute script docker-compose

Issue History

Date Modified Username Field Change
2025-04-27 08:30 thecrypto New Issue
2025-04-27 08:30 thecrypto Tag Attached: alpine
2025-04-27 08:30 thecrypto Tag Attached: bug
2025-04-27 08:30 thecrypto Tag Attached: php-fpm
2025-04-27 08:30 thecrypto Tag Attached: segfault
2025-04-27 08:30 thecrypto Tag Attached: stripe-php
2025-04-27 08:30 thecrypto Tag Attached: tracing
2025-04-27 08:30 thecrypto Tag Attached: xdebug
2025-04-27 22:14 thecrypto Note Added: 0007263
2025-04-27 22:14 thecrypto File Added: docker-sample-250428.zip
2025-05-02 10:36 derick Assigned To => derick
2025-05-02 10:36 derick Status new => feedback
2025-05-02 10:36 derick Note Added: 0007272
2025-05-02 12:09 thecrypto Note Added: 0007279
2025-05-02 12:09 thecrypto Status feedback => assigned
2025-05-07 13:58 derick Note Added: 0007282
2025-05-07 14:01 derick Note Added: 0007283
2025-05-07 14:06 derick Note Added: 0007284
2025-05-07 14:06 derick Status assigned => feedback