unit
unit copied to clipboard
Error apply configuration with use jemalloc memory allocator and glibc 2.34
Error apply configuration with use jemalloc memory allocator and glibc 2.34. Testing on Ubuntu 21.10 and NixOS Unstable.
Steps To Reproduce
- Install jemmalloc
apt install libjemalloc2
- Create file `/etc/ld.so.preload:
/usr/lib/x86_64-linux-gnu/libjemalloc.so.2
- Restart unit:
systemctl restart unit
- Write configuration
config.json
:
{
"type": "php",
"root": "/www/blogs/scripts"
}
- Apply configuration:
mkdir -p /www/blogs/scripts
curl -X PUT --data-binary @config.json --unix-socket /var/run/control.unit.sock http://localhost/config/applications/blogs
Error:
{
"error": "Failed to apply new configuration."
}
Debug log: unit-debug.log
OS: Ubuntu 21.10 Unit: 1.26.1 glibc: 2.34
This error also occurs on NixOS after updating glibc from version 2.33 to 2.34 - https://github.com/NixOS/nixpkgs/issues/167666
Thanks for reaching out. From the debug log it looks like there is a problem with a pointer in the PHP Lang module. Could you try to use Unit with a minimal configuration:
{
"listeners": {
"127.0.0.1:8080": {
"pass": "routes"
}
},
"routes": [
{
"action": {
"return": 204
}
}
]
}
This configuration will not call any application modules. That will help to locate the issue.
This config applied:
{
"success": "Reconfiguration done."
}
I also see the same thing by simply doing (on Fedora 35, jemalloc 5.2.1, php 8.0.18)
$ LD_PRELOAD=/lib64/libjemalloc.so.2 php
free(): invalid pointer
Aborted (core dumped)