Dns_get_record results in php-fpm crash

What issue or error are you experiencing?

The issue is a plain error page

Service Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

This is not the colorized Unavailable page when a site is not started.

After much much much debugging, I managed to get PHP-FPM to reveal the error;

[31-Jan-2025 13:17:18] WARNING: [pool www] child 78201 said into stderr: "php-fpm(78201,0x2043b8240) malloc: *** error for object 0x1ffffffff: pointer being freed was not allocated"
[31-Jan-2025 13:17:18] WARNING: [pool www] child 78201 said into stderr: "php-fpm(78201,0x2043b8240) malloc: *** set a breakpoint in malloc_error_break to debug"
[31-Jan-2025 13:17:18] WARNING: [pool www] child 78201 exited on signal 6 (SIGABRT) after 42.227657 seconds from start
[31-Jan-2025 13:17:18] NOTICE: [pool www] child 78238 started

This happens when using dns_get_record or checkdnsrr.

While one might think this is a DNS resolver issue;

  • problem seems not to apply with the wp-cli / php cli shell.
  • gethostbyname works just fine.

What steps can be taken to replicate the issue? Feel free to include screenshots, videos, etc

<?php dns_get_record('acato.nl', DNS_A);

call test.php via the webbrowser


System Details

Local version: Version 9.1.1+6738
OS: macOS Sequoia 15.2


Local Logs

There is nothing in the logs that is useful here. It is spammed with

{"class":"Process","level":"warn","message":"nginx: [warn] the \"listen ... http2\" directive is deprecated, use the \"http2\" directive instead in %%router.runPath%%/nginx/conf/server-block-ssl.conf:1","process":"nginx","thread":"main","timestamp":"2025-01-30T15:07:13.016Z"}

and that should be resolved, but is completely unrelated and out of scope for this issue.

The log needed is the php-fpm log and I did not find that anywhere on the system

By finding the process (ps -A | grep SITEID), killing it and replacing it with a console non-daemonized instance

kill PROCESSID ; /Users/username/Library/Application\ Support/Local/lightning-services/php-8.1.29+0/bin/darwin-arm64/sbin/php-fpm -F -R -p /Users/username/Library/Application\ Support/Local/run/SITEID/conf/php/ -y /Users/username/Library/Application\ Support/Local/run/SITEID/conf/php/php-fpm.conf

I managed to get the error as listed above.

It is a hassle to get all this, but I can list that the following PHP-FPM versions ALL crash;

  • 8.0.30
  • 8.1.29
  • 8.2.23

And now LocalWP won’t finish the “Starting up Site Services” so I want to do a system reboot, and therefore I have to cut this investigation short.


After a reboot;

  • 5.6.39
  • 7.4.30
  • 8.3.11
    All crash the same.

And for all versions listed; the CLI version does NOT crash, works perfectly.


Additional information discovered; when disabling IPv6 on my WiFi – setting it to link local only – The problem goes away, even if the site still runs on ::1 and I haven’t restarted the site …

All site logs should be written to the site folder like so:

~/Local Sites/<site-name>/logs:
  mailpit
  mysql
  nginx
  php

~/Local Sites/<site-name>/logs/nginx:
  error.log

~/Local Sites/<site-name>/logs/php:
  error.log
  php-fpm.log

Does your site not have that php-fpm.log file?

In terms of replicating the issue, I’m on Sequoia 15.3 and using the same version of Local I’m not getting any errors. Saving the details of dns_get_record() and var_dump’in it shows something the seems correct:

Since it’s related to DNS, I wonder if there’s an issue with how a server is responding to your machine?

I’m in Portland, OR where things work. I also hopped on a VPN out of Australia and that worked as well.

Are you managing or monitoring that domain? It doesn’t look like it’s fully propagated:

Hi.
Thanks for your response.

“The log needed is the php-fpm log and I did not find that anywhere on the system”

To clarify; I was looking for a global log, als I had expected there to be one management process, but apparently there is no such thing.

I do have the log files of the individual sites, but no error shows up there, at least not relating to DNS. Sometimes messages like;

[pool www] child 3912 exited on signal 6 (SIGABRT) after 1.633046 seconds from start

which coincides with the ones I got on the terminal, but not the messages I managed to see using the technique above

[31-Jan-2025 13:17:18] WARNING: [pool www] child 78201 said into stderr: "php-fpm(78201,0x2043b8240) malloc: *** error for object 0x1ffffffff: pointer being freed was not allocated"
[31-Jan-2025 13:17:18] WARNING: [pool www] child 78201 said into stderr: "php-fpm(78201,0x2043b8240) malloc: *** set a breakpoint in malloc_error_break to debug"

These errors appear ONLY in the terminal after (see above)

If it were a regular DNS problem, I would expect PHP to return an error, in the error.log, of which “dns_get_record(): A temporary server error occurred.” would be the most likely, but no such log entries appear.

Regarding DNS server; I’ve tried many

  • My ISP default
  • Google DNS (v4 and v6)
  • Cloudflare DNS 4 aand 6
  • Cloudflare DNS with Malware protection 1.1.1.2 and the v6 variant
  • I’m currently running my own DNS server (cloudflared) that uses CloudFlare DoH

And as it seems to be IPv6 related, I could be that the ISP is interfering somehow, but again, why would that make the PHP FPM process crash, yet not the PHP CLI…

Again thanks for your response and for checking, but I think the mystery is still here.

By the way, I bypass the problem now with a DoH implementation in PHP that replaces the dns_get_record function, after setting that to disable_functions in php.ini.

This is the odd part in my mind. I retried to replicate and the function is working on my machine for the various PHP versions.

The fact that the problem exists when WiFi has IPv6 enabled makes me wonder if something in the wifi router (or any host along the DNS resolution path) is mangling the records on the way back.

It’s also possible that the underlying lib that does the resolution isn’t up to date. I’m not quite sure what that specific lib would be, but probably libresolve:

★   bin/darwin-arm64 % otool -L ./sbin/php-fpm
./sbin/php-fpm:
        @loader_path/../dylibs/libtidy.58.dylib (compatibility version 58.0.0, current version 5.8.0)
        /usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0)
        @loader_path/../dylibs/libreadline.8.dylib (compatibility version 8.2.0, current version 8.2.0)
        /usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
        @loader_path/../dylibs/libiconv.2.dylib (compatibility version 9.0.0, current version 9.1.0)
        @loader_path/../dylibs/libintl.8.dylib (compatibility version 13.0.0, current version 13.0.0)
        /usr/lib/libnetwork.dylib (compatibility version 1.0.0, current version 1.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
        /usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
        @loader_path/../dylibs/libssl.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
        @loader_path/../dylibs/libcrypto.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
        @loader_path/../dylibs/libpcre2-8.0.dylib (compatibility version 13.0.0, current version 13.0.0)
        /usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 346.0.0)
        /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
        /usr/lib/libcurl.4.dylib (compatibility version 7.0.0, current version 9.0.0)
        /usr/lib/libffi.dylib (compatibility version 1.0.0, current version 30.0.0)
        @loader_path/../dylibs/libpng16.16.dylib (compatibility version 60.0.0, current version 60.0.0)
        @loader_path/../dylibs/libavif.16.dylib (compatibility version 16.0.0, current version 16.0.4)
        @loader_path/../dylibs/libwebp.7.dylib (compatibility version 9.0.0, current version 9.9.0)
        @loader_path/../dylibs/libjpeg.9.dylib (compatibility version 16.0.0, current version 16.0.0)
        @loader_path/../dylibs/libfreetype.6.dylib (compatibility version 27.0.0, current version 27.1.0)
        @loader_path/../dylibs/libicuio.74.dylib (compatibility version 74.0.0, current version 74.2.0)
        @loader_path/../dylibs/libicui18n.74.dylib (compatibility version 74.0.0, current version 74.2.0)
        @loader_path/../dylibs/libicuuc.74.dylib (compatibility version 74.0.0, current version 74.2.0)
        @loader_path/../dylibs/libicudata.74.dylib (compatibility version 74.0.0, current version 74.2.0)
        @loader_path/../dylibs/libonig.5.dylib (compatibility version 10.0.0, current version 10.0.0)
        @loader_path/../dylibs/libsodium.26.dylib (compatibility version 28.0.0, current version 28.0.0)
        /usr/lib/libxslt.1.dylib (compatibility version 3.0.0, current version 3.26.0)
        /usr/lib/libexslt.0.dylib (compatibility version 9.0.0, current version 9.15.0)
        @loader_path/../dylibs/libzip.5.dylib (compatibility version 5.0.0, current version 5.5.0)