Skip to content

Fatal Python error: Could not allocate TLS entry immediately after graceful restart #936

@newmin2

Description

@newmin2

Environment & Config Summary

  • OS: Ubuntu
  • Apache: 2.4.29
  • mod_wsgi: 4.5.17
  • Python: 3.6
  • Mode:
    WSGIDaemonProcess test python-path=/opt/check/tool user=www-data
    WSGIProcessGroup test
    WSGIScriptAlias / /opt/check/tool/test/wsgi.py
    WSGIPassAuthorization On

Problem Description & Sequence of Events

The server runs normally for a period. The problem is triggered specifically by an Apache graceful restart by logrotate.
The server has two logrotate trigger about apache2,
Job 1 (Daily Trigger): A log file is rotated daily, and its postrotate script runs invoke-rc.d apache2 reload.
Job 2 (Size Trigger): Another log file is rotated when it hits a size limit (which happens about once per day), and its postrotate script runs systemctl reload apache2.
(apache2 service - ExecReload=/usr/sbin/apachectl graceful)

I have experienced this issue twice. On both occasions, the problem was preceded by two separate logrotate jobs triggering an Apache reload at almost the same time. While this double-reload appears to be the trigger, we've observed the same event happening frequently in the past without leading to this failure. So I haven't isolated the root cause yet, but this part looks highly suspicious.

log

   [Tue Jul 29 00:17:01.555656 2025] [mpm_prefork:notice] [pid 1770] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1 mod_wsgi/4.5.17    Python/3.6 configured -- resuming normal operations
   [Tue Jul 29 00:17:01.555676 2025] [core:notice] [pid 1770] AH00094: Command line: '/usr/sbin/apache2 -f /etc/opt/httpd_console.conf
   [Tue Jul 29 00:17:06.299733 2025] [mpm_prefork:notice] [pid 1770] AH00171: Graceful restart requested, doing restart... (PHP and SSL warnings omitted for brevity) ...
   [Tue Jul 29 00:17:09.344299 2025] [mpm_prefork:notice] [pid 1770] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1 mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations 
   [Tue Jul 29 00:17:09.344313 2025] [core:notice] [pid 1770] AH00094: Command line: '/usr/sbin/apache2 -f /etc/opt/httpd_console.conf
   Fatal Python error: Could not allocate TLS entry
   Fatal Python error: Could not allocate TLS entry
   Fatal Python error: Could not allocate TLS entry
   Fatal Python error: Could not allocate TLS entry
   [Tue Jul 29 00:17:10.348963 2025] [core:notice] [pid 1770] AH00052: child pid 8056 exit signal Aborted (6)
   Fatal Python error: Could not allocate TLS entry
   [Tue Jul 29 00:17:10.349738 2025] [core:notice] [pid 1770] AH00052: child pid 8117 exit signal Aborted (6)
   [Tue Jul 29 00:17:10.349751 2025] [core:error] [pid 1770] AH00546: no record of generation 1015 of exiting child 8117
   [Tue Jul 29 00:17:10.349759 2025] [core:notice] [pid 1770] AH00052: child pid 8118 exit signal Aborted (6)

Any insight or further debugging steps you could suggest would be greatly appreciated.

Thank you.

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