Skip to content

ext-http hangs during shutdown #141

@Wouter0100

Description

@Wouter0100

I'm creating this issue because of a finding when running ext-http with FrankenPHP, a PHP runtime build for Caddy. Recently they introduced a way to graceful shutdown FrankenPHP threads, which uncovered a problem with ext-http. I initially thought it was exclusively a FrankenPHP issue and thus opened php/frankenphp#1296, but according to a response it might actually also be ext-http.

See the comment here from @AlliBalliBaba for more info:

From the looks of it, there is some sort of memory corruption happening right after threads are released and the process then hangs at php_module_shutdown. I'm not too familiar with ext-http, but it might not be fully thread-safe. This probably would need fixing in the extension itself.

The errors we see from time to time when shutting down FrankenPHP with ext-http loaded (not always though):

free(): invalid pointer
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
double free or corruption (fasttop)
malloc_consolidate(): invalid chunk size

A very easy way to reproduce this is by starting a Dockerfile:

FROM dunglas/frankenphp:1.3.4-php8.3.14-bookworm

RUN install-php-extensions http

I must admit, I'm not all to familiar with PHP extensions/C. Sorry for any misunderstandings. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions