Apache,导入带有互斥和ladon的python模块,脚本挂起

Apache,导入带有互斥和ladon的python模块,脚本挂起,python,mod-wsgi,ladon,Python,Mod Wsgi,Ladon,我有一个奇怪的行为,一个python脚本在Apache/mod_wsgi/Ladon中运行,当从python shell运行它时,一切都很好,在一台机器上一切都很好,但在另一台机器上相同的脚本挂起,它似乎在无限期地做或等待某件事情:从192.168.xxx.xxx/ws/永不结束打开页面(浏览器正在一次又一次地加载,旋转,即说)。我找不到发生了什么,在apache日志中记录的东西没有显示任何内容,因为导入的脚本在通过apache/ladon使用时似乎永远不会结束。(由于这两台机器的配置方式相同,

我有一个奇怪的行为,一个python脚本在Apache/mod_wsgi/Ladon中运行,当从python shell运行它时,一切都很好,在一台机器上一切都很好,但在另一台机器上相同的脚本挂起,它似乎在无限期地做或等待某件事情:从192.168.xxx.xxx/ws/永不结束打开页面(浏览器正在一次又一次地加载,旋转,即说)。我找不到发生了什么,在apache日志中记录的东西没有显示任何内容,因为导入的脚本在通过apache/ladon使用时似乎永远不会结束。(由于这两台机器的配置方式相同,我对此非常头疼:/)

当脚本从文件系统和数据库加载一些数据时,是否会无限期地锁定这些资源而导致挂起

我是否可以将悬挂在下面几行中的模块包装起来,以确保没有任何锁定?事实上,我已经尝试过这样做,但它没有任何改变,但这是我的第一个问题,这样写是否正确(因为我有点困惑,但互斥进程不同)

是否存在这样的情况:当从apache提供页面服务时,可能会以无限长的超时结束?即python mod_wsgi/ladon脚本被apache或ladon杀死,而某些东西仍在等待被杀死者的答复?例如,当关闭服务器时,我得到一些:

[Tue Jul 09 16:07:47 2013] [warn] child process 1676 still did not exit, sending a SIGTERM
[Tue Jul 09 16:07:49 2013] [warn] child process 1676 still did not exit, sending a SIGTERM
[Tue Jul 09 16:07:51 2013] [warn] child process 1676 still did not exit, sending a SIGTERM
[Tue Jul 09 16:07:53 2013] [error] child process 1676 still did not exit, sending a SIGKILL
[Tue Jul 09 16:07:54 2013] [notice] caught SIGTERM, shutting down
(通过搜索pid,通过mod_状态,它实际上是处于W模式的处理脚本)

编辑:关于wsgi,我在wsgi.conf中没有任何内容,所有内容都有注释#实际上,我是从默认的Debian安装中安装的。有什么我应该看的吗?或者我显然错过了什么

另一方面,它也是默认的Debian(实际上在配置文件中没有任何更改,但专门安装apache2 mpm worker):

关于wsgi的mod(不将
WSGIApplicationGroup%{GLOBAL}
添加到
wsgi.conf
):

如果有帮助,下面是使用Web服务进行会话的日志部分,可能会比较慢: (实际上,我希望每个人都共享
externalDataLoader.py加载的:0:00:00.394606(加载了21941个条目),然后只出现一个。我还停用了所有其他python处理的项目……这是不是两个:Attach解释器“”`然后可以使用一些Resources并在没有任何响应的情况下不间断地等待,从而使整个服务器和其他WS-query以“子进程不退出”结束


请参阅并尝试中描述的解决方案:

您可能使用的扩展模块在子解释器中不起作用

简而言之,在Apache配置中添加:


嗯,是的,它允许脚本在以前没有的机器上工作。顺便说一句,现在一切都非常慢,这有什么原因吗?而且我仍然不明白为什么它在没有这个指令的情况下在另一台机器上工作-相同的脚本,相同的所需模块?一般的缓慢可能是由于许多原因。这可能是因为Apache配置错误,或者可能是您的应用程序代码。您首先需要提供Apache MPM设置和mod_wsgi配置的详细信息。对于后者,您应该查看性能监视工具来解决。您好,请编辑以添加缺少的信息。向您致意并感谢您的帮助:)Linux系统通常不会默认为worker MPM,因此我不确定您的MPM设置是否一定正确。您也没有说明如何配置mod_wsgi,特别是您是否正在使用守护程序模式。关于如何计算MPM,请看我对WSGI没有做任何工作。wsgi.conf文件只包含注释内容。我已经编辑输出数据根据您提供的链接。所以我认为我处于嵌入式模式,即使我并不真正理解它可能意味着什么。编辑:我写这篇文章是因为由于工作缓慢,我已恢复不使用
WSGIApplicationGroup%{GLOBAL}
。我应该在再次添加后发布相同的内容吗?
[Tue Jul 09 16:07:47 2013] [warn] child process 1676 still did not exit, sending a SIGTERM
[Tue Jul 09 16:07:49 2013] [warn] child process 1676 still did not exit, sending a SIGTERM
[Tue Jul 09 16:07:51 2013] [warn] child process 1676 still did not exit, sending a SIGTERM
[Tue Jul 09 16:07:53 2013] [error] child process 1676 still did not exit, sending a SIGKILL
[Tue Jul 09 16:07:54 2013] [notice] caught SIGTERM, shutting down
# worker MPM
<IfModule mpm_worker_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>
Compiled in modules:
  core.c
  mod_log_config.c
  mod_logio.c
  worker.c
  http_core.c
  mod_so.c
<pre>
mod_wsgi.process_group = ['']
mod_wsgi.application_group = ['myserver|/mycfg'] # mycfg is actually the name of the python script while i have replaced the server name for posting here
wsgi.multithread = [True]
</pre>
<pre>
mod_wsgi.process_group = ['']
mod_wsgi.application_group = ['']
wsgi.multithread = [True]
</pre>
[Wed Jul 24 10:49:20 2013] [notice] caught SIGTERM, shutting down
[Wed Jul 24 10:49:21 2013] [info] mod_wsgi (pid=11199): Initializing Python.
[Wed Jul 24 10:49:21 2013] [notice] Apache/2.2.16 (Debian) mod_wsgi/3.3 Python/2.6.6 configured -- resuming normal operations
[Wed Jul 24 10:49:21 2013] [info] Server built: Mar  3 2013 11:36:06
[Wed Jul 24 10:49:21 2013] [info] mod_wsgi (pid=11203): Initializing Python.
[Wed Jul 24 10:49:21 2013] [info] mod_wsgi (pid=11199): Attach interpreter ''.
[Wed Jul 24 10:49:21 2013] [info] mod_wsgi (pid=11203): Attach interpreter ''.
[Wed Jul 24 10:49:39 2013] [info] [client 192.168.1.130] mod_wsgi (pid=11199, process='', application=''): Loading WSGI script '/var/www/mywebserver/ws/wshandler.py'., referer: http://192.168.1.5/demo/search.html
[Wed Jul 24 10:49:40 2013] [error] externalDataLoader.py loaded: 0:00:00.394606 (21941 entries loaded)
[Wed Jul 24 10:49:42 2013] [error] WSforSearchInsideExternalData. loaded: 0:00:00.000032.
[Wed Jul 24 10:49:42 2013] [error] searched [test] in [External1]: 0:00:00.026233
[Wed Jul 24 10:49:42 2013] [error] searched [test] in [External2]: 0:00:00.067869
[Wed Jul 24 10:49:43 2013] [error] searched [test] in [External3]: 0:00:00.104222
[Wed Jul 24 10:49:43 2013] [error] searching done for [test]: 0:00:00.104222
[Wed Jul 24 10:49:59 2013] [info] [client 192.168.1.130] mod_wsgi (pid=11203, process='', application=''): Loading WSGI script '/var/www/mywebserver/ws/wshandler.py'., referer: http://192.168.1.5/demo/search.html
[Wed Jul 24 10:50:00 2013] [error] externalDataLoader.py loaded: 0:00:00.384349 (21941 entries loaded)
[Wed Jul 24 10:50:02 2013] [error] WSforSearchInsideExternalData. loaded: 0:00:00.000033.
[Wed Jul 24 10:50:02 2013] [error] searched [abjg] in [External1]: 0:00:00.026000
[Wed Jul 24 10:50:02 2013] [error] searched [abjg] in [External2]: 0:00:00.066215
[Wed Jul 24 10:50:02 2013] [error] searched [abjg] in [External3]: 0:00:00.100293
[Wed Jul 24 10:50:02 2013] [error] searching done for [abjg]: 0:00:00.100293
[Wed Jul 24 10:50:40 2013] [error] searched [abjg] in [External1]: 0:00:00.001513
[Wed Jul 24 10:50:40 2013] [error] searched [abjg] in [External2]: 0:00:00.080266
[Wed Jul 24 10:50:40 2013] [error] searched [abjg] in [External3]: 0:00:00.119280
[Wed Jul 24 10:50:40 2013] [error] searching done for [abjg]: 0:00:00.119280
[Wed Jul 24 10:50:48 2013] [error] searched [abje] in [External1]: 0:00:00.001491
[Wed Jul 24 10:50:48 2013] [error] searched [abje] in [External2]: 0:00:00.079586
[Wed Jul 24 10:50:48 2013] [error] searched [abje] in [External3]: 0:00:00.123212
[Wed Jul 24 10:50:48 2013] [error] searching done for [abje]: 0:00:00.123212
WSGIApplicationGroup %{GLOBAL}