Django + dbxml + Apache = 问题。有啥解决办法吗?

Posted

技术标签:

【中文标题】Django + dbxml + Apache = 问题。有啥解决办法吗?【英文标题】:Django + dbxml + Apache = problems. Any solutions?Django + dbxml + Apache = 问题。有什么解决办法吗? 【发布时间】:2009-11-03 20:24:12 【问题描述】:

我正在尝试使用 WSGI 设置 Django 应用程序。这很好用。但是,我的部分 Django 应用程序使用 BDB XML 时遇到了一些问题。我的 Apache 配置如下:

Listen 8000
WSGISocketPrefix /tmp/wsgi
<VirtualHost *:8000>
    ServerName <server name>
    DocumentRoot <path to doc root>

    LogLevel info

    WSGIScriptAlias / <path to wsgi>
    WSGIApplicationGroup %GLOBAL
    WSGIDaemonProcess debug threads=1
    WSGIProcessGroup debug
</VirtualHost>

但是,我仍然收到以下错误:

DB_ENV->repmgr_stat interface requires an environment configured for the replication subsystem
[error] child died with signal 11

我的环境打开为:

environment = DBEnv()

environment.open(
    <absolute db env path>,
    DB_CREATE|DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL,
    0
)

我正在使用:

python 2.6.2 阿帕奇 2.2 ubuntu 9.04 dbxml 2.5.13 从源代码编译(所以 libdb-4.8、bsddb3、所有爵士乐)

我看到 Apache 似乎链接到 libdb-4.6。这是个问题吗?

ldd /usr/sbin/apache2 | grep libdb
libdb-4.6.so => /usr/lib/libdb-4.6.so (0xb7c01000)

更新

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb5a48b90 (LWP 12700)]
0x00000000 in ?? ()
(gdb) thread apply all bt

Thread 4 (Thread 0xb6a67b90 (LWP 12698)):
#0  0xb7f11422 in __kernel_vsyscall ()
#1  0xb7de07b1 in select () from /lib/tls/i686/cmov/libc.so.6
#2  0xb7ea5bcf in apr_sleep () from /usr/lib/libapr-1.so.0
#3  0xb6d7afee in ?? () from /usr/lib/apache2/modules/mod_wsgi.so
#4  0xb7ea38ec in ?? () from /usr/lib/libapr-1.so.0
#5  0xb7e6d4ff in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#6  0xb7de849e in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 3 (Thread 0xb6249b90 (LWP 12699)):
#0  0xb7f11422 in __kernel_vsyscall ()
#1  0xb7de07b1 in select () from /lib/tls/i686/cmov/libc.so.6
#2  0xb7ea5bcf in apr_sleep () from /usr/lib/libapr-1.so.0
#3  0xb6d7ab39 in ?? () from /usr/lib/apache2/modules/mod_wsgi.so
#4  0xb7ea38ec in ?? () from /usr/lib/libapr-1.so.0
#5  0xb7e6d4ff in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#6  0xb7de849e in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 2 (Thread 0xb5a48b90 (LWP 12700)):
#0  0x00000000 in ?? ()
#1  0xb4f03b5e in DbXml::XmlManager::XmlManager () from /home/jason/dbxml-2.5.13/install/lib/libdbxml-2.5.so
#2  0xb501b29b in _wrap_new_XmlManager (self=0x0, args=0xac66fcc) at dbxml_python_wrap.cpp:5183
#3  0xb6b77aed in PyCFunction_Call () from /usr/lib/libpython2.6.so.1.0
#4  0xb6b3198c in PyObject_Call () from /usr/lib/libpython2.6.so.1.0
#5  0xb6bd70b5 in PyEval_EvalFrameEx () from /usr/lib/libpython2.6.so.1.0
#6  0xb6bdb910 in PyEval_EvalCodeEx () from /usr/lib/libpython2.6.so.1.0
#7  0xb6b6187a in ?? () from /usr/lib/libpython2.6.so.1.0
#8  0xb6b3198c in PyObject_Call () from /usr/lib/libpython2.6.so.1.0
#9  0xb6b427a8 in ?? () from /usr/lib/libpython2.6.so.1.0
#10 0xb6b3198c in PyObject_Call () from /usr/lib/libpython2.6.so.1.0
#11 0xb6b9ae03 in ?? () from /usr/lib/libpython2.6.so.1.0
#12 0xb6b90f55 in ?? () from /usr/lib/libpython2.6.so.1.0
#13 0xb6b3198c in PyObject_Call () from /usr/lib/libpython2.6.so.1.0
#14 0xb6bd7618 in PyEval_EvalFrameEx () from /usr/lib/libpython2.6.so.1.0
#15 0xb6bdb910 in PyEval_EvalCodeEx () from /usr/lib/libpython2.6.so.1.0
#16 0xb6b6187a in ?? () from /usr/lib/libpython2.6.so.1.0
#17 0xb6b3198c in PyObject_Call () from /usr/lib/libpython2.6.so.1.0
#18 0xb6b427a8 in ?? () from /usr/lib/libpython2.6.so.1.0
#19 0xb6b3198c in PyObject_Call () from /usr/lib/libpython2.6.so.1.0
#20 0xb6bd3a34 in PyEval_CallObjectWithKeywords () from /usr/lib/libpython2.6.so.1.0
#21 0xb6b44a7d in PyInstance_New () from /usr/lib/libpython2.6.so.1.0
#22 0xb6b3198c in PyObject_Call () from /usr/lib/libpython2.6.so.1.0
#23 0xb6bd7618 in PyEval_EvalFrameEx () from /usr/lib/libpython2.6.so.1.0
#24 0xb6bdb910 in PyEval_EvalCodeEx () from /usr/lib/libpython2.6.so.1.0
#25 0xb6b61969 in ?? () from /usr/lib/libpython2.6.so.1.0
#26 0xb6b3198c in PyObject_Call () from /usr/lib/libpython2.6.so.1.0
#27 0xb6bd70b5 in PyEval_EvalFrameEx () from /usr/lib/libpython2.6.so.1.0
#28 0xb6bdb910 in PyEval_EvalCodeEx () from /usr/lib/libpython2.6.so.1.0
#29 0xb6b61969 in ?? () from /usr/lib/libpython2.6.so.1.0
#30 0xb6b3198c in PyObject_Call () from /usr/lib/libpython2.6.so.1.0
#31 0xb6b427a8 in ?? () from /usr/lib/libpython2.6.so.1.0
#32 0xb6b3198c in PyObject_Call () from /usr/lib/libpython2.6.so.1.0
#33 0xb6b9b483 in ?? () from /usr/lib/libpython2.6.so.1.0
#34 0xb6b3198c in PyObject_Call () from /usr/lib/libpython2.6.so.1.0
#35 0xb6bd70b5 in PyEval_EvalFrameEx () from /usr/lib/libpython2.6.so.1.0
#36 0xb6bdab4f in PyEval_EvalFrameEx () from /usr/lib/libpython2.6.so.1.0
#37 0xb6bdb910 in PyEval_EvalCodeEx () from /usr/lib/libpython2.6.so.1.0
#38 0xb6b6187a in ?? () from /usr/lib/libpython2.6.so.1.0
#39 0xb6b3198c in PyObject_Call () from /usr/lib/libpython2.6.so.1.0
#40 0xb6b427a8 in ?? () from /usr/lib/libpython2.6.so.1.0
#41 0xb6b3198c in PyObject_Call () from /usr/lib/libpython2.6.so.1.0
#42 0xb6b9b483 in ?? () from /usr/lib/libpython2.6.so.1.0
#43 0xb6b3198c in PyObject_Call () from /usr/lib/libpython2.6.so.1.0
#44 0xb6bd3a34 in PyEval_CallObjectWithKeywords () from /usr/lib/libpython2.6.so.1.0
#45 0xb6d7172d in ?? () from /usr/lib/apache2/modules/mod_wsgi.so
#46 0xb6d7539f in ?? () from /usr/lib/apache2/modules/mod_wsgi.so
#47 0xb6d7e1d8 in ?? () from /usr/lib/apache2/modules/mod_wsgi.so
#48 0xb6d7a42c in ?? () from /usr/lib/apache2/modules/mod_wsgi.so
#49 0xb6d7a8bd in ?? () from /usr/lib/apache2/modules/mod_wsgi.so
#50 0xb6d7a9c5 in ?? () from /usr/lib/apache2/modules/mod_wsgi.so
#51 0xb7ea38ec in ?? () from /usr/lib/libapr-1.so.0
#52 0xb7e6d4ff in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#53 0xb7de849e in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 1 (Thread 0xb7460b00 (LWP 12697)):
#0  0xb7f11422 in __kernel_vsyscall ()
#1  0xb7e75300 in sigwait () from /lib/tls/i686/cmov/libpthread.so.0
#2  0xb7ea3f3b in apr_signal_thread () from /usr/lib/libapr-1.so.0
#3  0xb6d7b48d in ?? () from /usr/lib/apache2/modules/mod_wsgi.so
#4  0xb6d7bc98 in ?? () from /usr/lib/apache2/modules/mod_wsgi.so
#5  0xb6d79632 in ?? () from /usr/lib/apache2/modules/mod_wsgi.so
#6  0xb7e9a2c9 in apr_proc_other_child_alert () from /usr/lib/libapr-1.so.0
#7  0x08092202 in ap_mpm_run ()
#8  0x080673c8 in main ()
#0  0x00000000 in ?? ()

【问题讨论】:

【参考方案1】:

第一步要设置:

LogLevel info

并查看错误日志以验证它实际上是在主解释器中运行的。为此,记录的应用程序组在加载 WSGI 脚本的消息中应该是空字符串。

唯一要做的就是以守护程序模式运行并附加 gdb 并尝试捕获堆栈跟踪以帮助调试。见:

http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Debugging_Crashes_With_GDB

【讨论】:

感谢您的回复。我验证了应用程序组是空字符串。如果有帮助,我已经添加了 gdb 的回溯。 您是在单线程还是多线程配置中运行?即,您是在使用 preform 或 worker MPM 的嵌入式模式下运行,还是在守护程序模式下运行,如果是,WSGIDaemonProcess 的参数是什么。 我添加了完整的 apache 配置。这有帮助吗?

以上是关于Django + dbxml + Apache = 问题。有啥解决办法吗?的主要内容,如果未能解决你的问题,请参考以下文章

Berkeley XMLDB 容器是不是可移植?

apache部署django出现403Forbidden错误怎么解决

如何将多个文档放入 Berkeley-DB XML 容器?

网站部署 Django+Apache

[django]django 在apache2上部署静态文件如何加载

Django - Apache2 - Postgresql:_psycopg 出错