Я установил miniforge3. Я выполнил установку mod_wsgi в базовой среде для установки mod_wsgi 5.0.0. У меня есть два виртуальных хоста в Apache; Я создаю виртуальную среду для каждого виртуального хоста с помощью mamba create -n . Префикс sys.prefix следующий:
Код: Выделить всё
/opt/miniforge3
Код: Выделить всё
['', '/opt/miniforge3/lib/python312.zip', '/opt/miniforge3/lib/python3.12', '/opt/miniforge3/lib/python3.12/lib-dynload', '/opt/miniforge3/lib/python3.12/site-packages']
Код: Выделить всё
/opt/miniforge3/bin:/opt/miniforge3/condabin:/root/.nvm/versions/node/v20.5.0/bin:/root/.local/bin:/root/bin:/opt/miniforge3/bin:/sbin:/bin:/usr/sbin:/usr/bin:/var/cfengine/bin
Код: Выделить всё
LoadModule wsgi_module /opt/miniforge3/lib/python3.12/site-packages/mod_wsgi/server/mod_wsgi-py312.cpython-312-x86_64-linux-gnu.so
Мой файл .conf виртуальных хостов выглядит следующим образом (отредактированный до соответствующие части):
Код: Выделить всё
ServerName domainNameOne.com
## Vhost docroot
DocumentRoot "/var/www/vhosts/domainNameOne"
## Logging
ErrorLog "/var/log/httpd/domainNameOne-error.log"
LogLevel info
ServerSignature Off
CustomLog "/var/log/httpd/domainNameOne-access.log" combined
## WSGI configuration
WSGIApplicationGroup %{GLOBAL}
WSGIDaemonProcess domainNameOne display-name=%{GROUP} home=/var/www/vhosts/domainNameOne python-home=/opt/miniforge3/envs/app1 threads=1 user=hydro
WSGIProcessGroup domainNameOne
WSGIScriptAlias / "/var/www/vhosts/domainNameOne/wsgi.py"
## Anything start with dot
Require all denied
Require all denied
Require all granted
ServerName domainNameTwo.com
## Vhost docroot
DocumentRoot "/var/www/vhosts/domainNameTwo"
## Logging
ErrorLog "/var/log/httpd/domainNameTwo-error.log"
LogLevel info
ServerSignature Off
CustomLog "/var/log/httpd/domainNameTwo-access.log" combined
## WSGI configuration
WSGIApplicationGroup %{GLOBAL}
WSGIDaemonProcess domainNameTwo display-name=%{GROUP} home=/var/www/vhosts/domainNameTwo python-home=/opt/miniforge3/envs/app2 threads=1 user=hydro
WSGIProcessGroup domainNameTwo
WSGIScriptAlias / "/var/www/vhosts/domainNameTwo/wsgi.py"
## Anything start with dot
Require all denied
Require all denied
Require all granted
Код: Выделить всё
ErrorLog "/var/log/httpd/error_log"
LogLevel info
Код: Выделить всё
import sys
from api import create_app
from os import getcwd
sys.path.insert(0, getcwd() + "/api")
sys.path.append(getcwd() + "/api/models")
application = create_app()
Код: Выделить всё
[Tue Oct 15 11:24:04.098111 2024] [wsgi:info] [pid 280203:tid 280203] mod_wsgi (pid=280203): Starting process 'domainNameOne' with uid=36143, gid=48 and threads=1.
[Tue Oct 15 11:24:04.099092 2024] [wsgi:info] [pid 280204:tid 280204] mod_wsgi (pid=280204): Starting process 'domainNameTwo' with uid=36143, gid=48 and threads=1.
[Tue Oct 15 11:24:04.101579 2024] [wsgi:info] [pid 280203:tid 280203] mod_wsgi (pid=280203): Python home /opt/miniforge3/envs/app1.
[Tue Oct 15 11:24:04.101656 2024] [wsgi:info] [pid 280203:tid 280203] mod_wsgi (pid=280203): Initializing Python.
[Tue Oct 15 11:24:04.101982 2024] [wsgi:info] [pid 280204:tid 280204] mod_wsgi (pid=280204): Python home /opt/miniforge3/envs/app2.
[Tue Oct 15 11:24:04.102046 2024] [wsgi:info] [pid 280204:tid 280204] mod_wsgi (pid=280204): Initializing Python.
[Tue Oct 15 11:24:04.102127 2024] [mpm_event:notice] [pid 280200:tid 280200] AH00489: Apache/2.4.57 (Red Hat Enterprise Linux) OpenSSL/3.0.7 mod_wsgi/5.0.0 Python/3.12 configured -- resuming normal operations
[Tue Oct 15 11:24:04.102145 2024] [mpm_event:info] [pid 280200:tid 280200] AH00490: Server built: Aug 5 2024 00:00:00
[Tue Oct 15 11:24:04.102163 2024] [core:notice] [pid 280200:tid 280200] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Tue Oct 15 11:24:04.106853 2024] [http2:info] [pid 280205:tid 280205] h2_workers: created with min=25 max=37 idle_ms=600000
[Tue Oct 15 11:24:04.107965 2024] [wsgi:info] [pid 280205:tid 280205] mod_wsgi (pid=280205): Initializing Python.
[Tue Oct 15 11:24:04.109002 2024] [http2:info] [pid 280207:tid 280207] h2_workers: created with min=25 max=37 idle_ms=600000
[Tue Oct 15 11:24:04.110156 2024] [wsgi:info] [pid 280207:tid 280207] mod_wsgi (pid=280207): Initializing Python.
[Tue Oct 15 11:24:04.120330 2024] [http2:info] [pid 280206:tid 280206] h2_workers: created with min=25 max=37 idle_ms=600000
[Tue Oct 15 11:24:04.121614 2024] [wsgi:info] [pid 280206:tid 280206] mod_wsgi (pid=280206): Initializing Python.
[Tue Oct 15 11:24:04.123846 2024] [wsgi:info] [pid 280207:tid 280207] mod_wsgi (pid=280207): Attach interpreter ''.
[Tue Oct 15 11:24:04.138679 2024] [wsgi:info] [pid 280206:tid 280206] mod_wsgi (pid=280206): Attach interpreter ''.
[Tue Oct 15 11:24:04.142589 2024] [wsgi:info] [pid 280205:tid 280205] mod_wsgi (pid=280205): Attach interpreter ''.
[Tue Oct 15 11:24:04.143744 2024] [wsgi:info] [pid 280207:tid 280207] mod_wsgi (pid=280207): Imported 'mod_wsgi'.
[Tue Oct 15 11:24:04.161980 2024] [wsgi:info] [pid 280205:tid 280205] mod_wsgi (pid=280205): Imported 'mod_wsgi'.
[Tue Oct 15 11:24:04.163719 2024] [wsgi:info] [pid 280206:tid 280206] mod_wsgi (pid=280206): Imported 'mod_wsgi'.
[Tue Oct 15 11:50:45.699499 2024] [core:notice] [pid 280200:tid 280200] AH00051: child pid 280204 exit signal Segmentation fault (11), possible coredump in /etc/httpd
[Tue Oct 15 11:50:45.699649 2024] [wsgi:info] [pid 280200:tid 280200] mod_wsgi (pid=280204): Process 'domainNameTwo' has died, deregister and restart it.
[Tue Oct 15 11:50:45.699668 2024] [wsgi:info] [pid 280200:tid 280200] mod_wsgi (pid=280204): Process 'domainNameTwo' terminated by signal 11
[Tue Oct 15 11:50:45.699690 2024] [wsgi:info] [pid 280200:tid 280200] mod_wsgi (pid=280204): Process 'domainNameTwo' has been deregistered and will no longer be monitored.
[Tue Oct 15 11:50:45.701459 2024] [wsgi:info] [pid 286088:tid 286088] mod_wsgi (pid=286088): Starting process 'domainNameTwo' with uid=36143, gid=48 and threads=1.
[Tue Oct 15 11:50:45.704146 2024] [wsgi:info] [pid 286088:tid 286088] mod_wsgi (pid=286088): Python home /opt/miniforge3/envs/app2.
[Tue Oct 15 11:50:45.704212 2024] [wsgi:info] [pid 286088:tid 286088] mod_wsgi (pid=286088): Initializing Python.
[Tue Oct 15 11:50:46.702656 2024] [core:notice] [pid 280200:tid 280200] AH00051: child pid 286088 exit signal Segmentation fault (11), possible coredump in /etc/httpd
[Tue Oct 15 11:50:46.702719 2024] [wsgi:info] [pid 280200:tid 280200] mod_wsgi (pid=286088): Process 'domainNameTwo' has died, deregister and restart it.
[Tue Oct 15 11:50:46.702728 2024] [wsgi:info] [pid 280200:tid 280200] mod_wsgi (pid=286088): Process 'domainNameTwo' terminated by signal 11
[Tue Oct 15 11:50:46.702735 2024] [wsgi:info] [pid 280200:tid 280200] mod_wsgi (pid=286088): Process 'domainNameTwo' has been deregistered and will no longer be monitored.
[Tue Oct 15 11:50:46.704057 2024] [wsgi:info] [pid 286103:tid 286103] mod_wsgi (pid=286103): Starting process 'domainNameTwo' with uid=36143, gid=48 and threads=1.
[Tue Oct 15 11:50:46.706740 2024] [wsgi:info] [pid 286103:tid 286103] mod_wsgi (pid=286103): Python home /opt/miniforge3/envs/app2.
[Tue Oct 15 11:50:46.706800 2024] [wsgi:info] [pid 286103:tid 286103] mod_wsgi (pid=286103): Initializing Python.
Код: Выделить всё
[Tue Oct 15 11:24:04.129726 2024] [wsgi:info] [pid 280204:tid 280204] mod_wsgi (pid=280204): Attach interpreter ''.
[Tue Oct 15 11:50:45.275309 2024] [wsgi:info] [pid 280204:tid 280304] [remote 10.159.64.61:53297] mod_wsgi (pid=280204, process='domainNameTwo', application=''): Loading Python script file '/var/www/vhosts/domainNameTwo/wsgi.py'.
[Tue Oct 15 11:50:45.667099 2024] [wsgi:error] [pid 280205:tid 280336] [client 10.159.64.61:53297] Truncated or oversized response headers received from daemon process 'domainNameTwo': /var/www/vhosts/domainNameTwo/wsgi.py
[Tue Oct 15 11:50:45.715999 2024] [wsgi:info] [pid 286088:tid 286088] mod_wsgi (pid=286088): Attach interpreter ''.
[Tue Oct 15 11:50:46.145008 2024] [wsgi:info] [pid 286088:tid 286091] [remote 10.159.64.61:53298] mod_wsgi (pid=286088, process='domainNameTwo', application=''): Loading Python script file '/var/www/vhosts/domainNameTwo/wsgi.py'.
[Tue Oct 15 11:50:46.509611 2024] [wsgi:error] [pid 280206:tid 280359] [client 10.159.64.61:53298] Truncated or oversized response headers received from daemon process 'domainNameTwo': /var/www/vhosts/domainNameTwo/wsgi.py, referer: https://domainNameTwo.com/
[Tue Oct 15 11:50:46.718194 2024] [wsgi:info] [pid 286103:tid 286103] mod_wsgi (pid=286103): Attach interpreter ''.
Я использую RedHat, и по какой-то причине дамп ядра кажется невозможным. Как пользователь root, я установил ulimit -c неограниченный и попытался изменить proc/sys/kernel/core_pattern на множество разных вещей, чтобы заставить его выгружаться, но безуспешно (сейчас он установлен обратно на значение по умолчанию — |/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h). Когда я использую список coredumpctl, все показывает «нет», хотя в файле coredump.conf используются значения по умолчанию:
Код: Выделить всё
[Coredump]
#Storage=external
#Compress=yes
#ProcessSizeMax=2G
#ExternalSizeMax=2G
#JournalSizeMax=767M
#MaxUse=
#KeepFree=
Код: Выделить всё
coredumpctl info
Код: Выделить всё
PID: 292401 (httpd)
UID: 36143 (hydro)
GID: 48 (apache)
Signal: 11 (SEGV)
Timestamp: Tue 2024-10-15 12:34:47 EDT (3min 56s ago)
Command Line: $'(wsgi:domainNameT' -DFOREGROUND
Executable: /usr/sbin/httpd
Control Group: /system.slice/httpd.service
Unit: httpd.service
Slice: system.slice
Boot ID: 98404b4ba09d4a7bbde55d9149e95df7
Machine ID: 1788bfff64a44078829e9e7872ced29f
Hostname: myHostName
Storage: none
Message: Process 292401 (httpd) of user 36143 dumped core.
Код: Выделить всё
gdb /usr/sbin/httpd
Код: Выделить всё
GNU gdb (GDB) Red Hat Enterprise Linux 10.2-13.el9
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/sbin/httpd...
Reading symbols from .gnu_debugdata for /usr/sbin/httpd...
(No debugging symbols found in .gnu_debugdata for /usr/sbin/httpd)
Attaching to program: /usr/sbin/httpd, process 292401
[New LWP 292583]
[New LWP 292584]
[New LWP 292585]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
0x00007f2de1f019ff in poll () from target:/lib64/libc.so.6
Missing separate debuginfos, use: dnf debuginfo-install httpd-core-2.4.57-11.el9_4.1.x86_64
(gdb) thread apply all bt
Thread 4 (Thread 0x7f2ddf466640 (LWP 292585) "httpd"):
#0 0x00007f2de1f0e21e in epoll_wait () from target:/lib64/libc.so.6
#1 0x00007f2de21dd310 in impl_pollset_poll.lto_priv () from target:/lib64/libapr-1.so.0
#2 0x00007f2de10b4322 in wsgi_daemon_worker (thread=, p=) at src/server/mod_wsgi.c:9019
#3 wsgi_daemon_thread (thd=, data=) at src/server/mod_wsgi.c:9188
#4 0x00007f2de1e89c02 in start_thread () from target:/lib64/libc.so.6
#5 0x00007f2de1f0ec40 in clone3 () from target:/lib64/libc.so.6
Thread 3 (Thread 0x7f2ddfc67640 (LWP 292584) "httpd"):
#0 0x00007f2de1f0422d in select () from target:/lib64/libc.so.6
#1 0x00007f2de21df849 in apr_sleep () from target:/lib64/libapr-1.so.0
#2 0x00007f2de10a49d3 in wsgi_deadlock_thread (thd=, data=) at src/server/mod_wsgi.c:9228
#3 0x00007f2de1e89c02 in start_thread () from target:/lib64/libc.so.6
#4 0x00007f2de1f0ec40 in clone3 () from target:/lib64/libc.so.6
Thread 2 (Thread 0x7f2de0468640 (LWP 292583) "httpd"):
#0 0x00007f2de1f0422d in select () from target:/lib64/libc.so.6
#1 0x00007f2de21df849 in apr_sleep () from target:/lib64/libapr-1.so.0
#2 0x00007f2de10a25cd in wsgi_monitor_thread (thd=, data=0x5601865bfca8) at src/server/mod_wsgi.c:9510
#3 0x00007f2de1e89c02 in start_thread () from target:/lib64/libc.so.6
#4 0x00007f2de1f0ec40 in clone3 () from target:/lib64/libc.so.6
Thread 1 (Thread 0x7f2de202e540 (LWP 292401) "httpd"):
#0 0x00007f2de1f019ff in poll () from target:/lib64/libc.so.6
#1 0x00007f2de21d7de1 in apr_poll () from target:/lib64/libapr-1.so.0
#2 0x00007f2de10b7821 in wsgi_daemon_main (daemon=0x5601865bfca8, p=0x5601863bec28) at src/server/mod_wsgi.c:9811
#3 wsgi_start_process (p=p@entry=0x5601863bec28, daemon=0x5601865bfca8) at src/server/mod_wsgi.c:10542
#4 0x00007f2de10b8d95 in wsgi_start_daemons (p=0x5601863bec28) at src/server/mod_wsgi.c:10780
#5 0x0000560185e8bced in ap_run_pre_mpm ()
#6 0x00007f2de1ad4695 in event_run () from target:/etc/httpd/modules/mod_mpm_event.so
#7 0x0000560185e816d8 in ap_run_mpm ()
#8 0x0000560185e6f64f in main ()
Может ли кто-нибудь помочь мне определить, что не так в моей конфигурации mod_wsgi, которая вызывает сбои segfaults, или помочь мне выяснить, как получить отладку httpd-процессов или ядра свалки на работу? Я в полной растерянности, потратив на это много часов.
Подробнее здесь: https://stackoverflow.com/questions/790 ... vironments
Мобильная версия