我正在运行ReviewBoard 2.0.15,在某些评论中,我收到以下错误:
Django Version: 1.6.11
Python Version: 2.6.6
Installed Applications:
[u'django.contrib.admin',
u'django.contrib.auth',
u'django.contrib.contenttypes',
u'django.contrib.sites',
u'django.contrib.sessions',
u'django.contrib.staticfiles',
u'djblets',
u'djblets.configforms',
u'djblets.datagrid',
u'djblets.extensions',
u'djblets.feedview',
u'djblets.gravatars',
u'djblets.log',
u'djblets.pipeline',
u'djblets.siteconfig',
u'djblets.util',
u'djblets.webapi',
u'haystack',
u'pipeline',
u'reviewboard',
u'reviewboard.accounts',
u'reviewboard.admin',
u'reviewboard.attachments',
u'reviewboard.changedescs',
u'reviewboard.datagrids',
u'reviewboard.diffviewer',
u'reviewboard.extensions',
u'reviewboard.hostingsvcs',
u'reviewboard.notifications',
u'reviewboard.reviews',
u'reviewboard.reviews.ui',
u'reviewboard.scmtools',
u'reviewboard.site',
u'reviewboard.ssh',
u'reviewboard.webapi',
u'django_evolution']
Installed Middleware:
[u'django.middleware.gzip.GZipMiddleware',
u'reviewboard.admin.middleware.InitReviewBoardMiddleware',
u'django.middleware.clickjacking.XFrameOptionsMiddleware',
u'django.middleware.common.CommonMiddleware',
u'django.middleware.doc.XViewMiddleware',
u'django.middleware.http.ConditionalGetMiddleware',
u'django.middleware.locale.LocaleMiddleware',
u'django.contrib.sessions.middleware.SessionMiddleware',
u'django.contrib.auth.middleware.AuthenticationMiddleware',
u'django.contrib.messages.middleware.MessageMiddleware',
u'djblets.siteconfig.middleware.SettingsMiddleware',
u'reviewboard.admin.middleware.LoadSettingsMiddleware',
u'djblets.extensions.middleware.ExtensionsMiddleware',
u'djblets.log.middleware.LoggingMiddleware',
u'reviewboard.accounts.middleware.TimezoneMiddleware',
u'reviewboard.admin.middleware.CheckUpdatesRequiredMiddleware',
u'reviewboard.admin.middleware.X509AuthMiddleware',
u'reviewboard.site.middleware.LocalSiteMiddleware',
u'djblets.extensions.middleware.ExtensionsMiddlewareRunner',
u'reviewboard.admin.middleware.ExtraExceptionInfoMiddleware']
Traceback:
File "/opt/local/revboard/python/virtualenv/lib/python2.6/site-packages/Django-1.6.11-py2.6.egg/django/core/handlers/base.py" in get_response
112. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/local/revboard/python/virtualenv/lib/python2.6/site-packages/ReviewBoard-2.0.15-py2.6.egg/reviewboard/accounts/decorators.py" in _check
23. return view_func(*args, **kwargs)
File "/opt/local/revboard/python/virtualenv/lib/python2.6/site-packages/ReviewBoard-2.0.15-py2.6.egg/reviewboard/site/decorators.py" in _check
35. return view_func(request, local_site=local_site, *args, **kwargs)
File "/opt/local/revboard/python/virtualenv/lib/python2.6/site-packages/ReviewBoard-2.0.15-py2.6.egg/reviewboard/reviews/views.py" in review_detail
665. changedesc.fields_changed[field_id])
File "/opt/local/revboard/python/virtualenv/lib/python2.6/site-packages/ReviewBoard-2.0.15-py2.6.egg/reviewboard/reviews/fields.py" in get_change_entry_sections_html
200. 'rendered_html': mark_safe(self.render_change_entry_html(info)),
File "/opt/local/revboard/python/virtualenv/lib/python2.6/site-packages/ReviewBoard-2.0.15-py2.6.egg/reviewboard/reviews/fields.py" in render_change_entry_html
590. old_lines = list(iter_markdown_lines(old_value))
File "/opt/local/revboard/python/virtualenv/lib/python2.6/site-packages/ReviewBoard-2.0.15-py2.6.egg/reviewboard/reviews/markdown_utils.py" in iter_markdown_lines
212. nodes = get_markdown_element_tree(markdown_html)
File "/opt/local/revboard/python/virtualenv/lib/python2.6/site-packages/ReviewBoard-2.0.15-py2.6.egg/reviewboard/reviews/markdown_utils.py" in get_markdown_element_tree
274. doc = parseString(b'<html>%s</html>' % markdown_html)
File "/usr/lib64/python2.6/xml/dom/minidom.py" in parseString
1927. from xml.dom import expatbuilder
File "/usr/lib64/python2.6/xml/dom/expatbuilder.py" in <module>
32. from xml.parsers import expat
File "/usr/lib64/python2.6/xml/parsers/expat.py" in <module>
4. from pyexpat import *
Exception Type: ImportError at /reviews/r/24291/
Exception Value: /usr/lib64/python2.6/lib-dynload/pyexpat.so: symbol XML_SetHashSalt, version EXPAT_2_0_1_RH not defined in file libexpat.so.1 with link time reference
如果我手动使用相同的虚拟环境运行python,它可以正常工作:
bin]$ python
Python 2.6.6 (r266:84292, Jan 22 2014, 01:49:05)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyexpat import *
>>>
我已经验证了apache和python确实使用了完全相同的expat版本,所以这也不是问题所在。我真的很困惑为什么只会在几百个评论中发生这种情况。
编辑:我跑了一些测试,我注意到了一些东西。我注意到了一件事。 apache的libexpat.so使用指向/usr/local/lib/libexpat.so的指针,如果我在该文件上运行以下命令,则得不到任何结果:
(virtualenv)[user@rbdev301 lib]$ strings libexpat.so.1.5.2 | grep XML_SetHashSalt
(virtualenv)[user@rbdev301 lib]$ strings libexpat.so.1.5.2 | grep EXPAT_2_0_1_RH
然而,当我检查Python正在使用哪个expat时,我得到了这个:
(virtualenv)[user@rbdev301 lib-dynload]$ ldd pyexpat.so
linux-vdso.so.1 => (0x00007ffff252a000)
libexpat.so.1 => /lib64/libexpat.so.1 (0x00007f52afbae000)
libpython2.6.so.1.0 => /usr/lib64/libpython2.6.so.1.0 (0x00007f52af802000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f52af5e4000)
libc.so.6 => /lib64/libc.so.6 (0x00007f52af250000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f52af04c000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007f52aee48000)
libm.so.6 => /lib64/libm.so.6 (0x00007f52aebc4000)
/lib64/ld-linux-x86-64.so.2 (0x00007f52affe3000)
所以,python正在使用/ lib64中的那个。如果我在那个上运行相同的命令,我会得到结果。
(virtualenv)[user@rbdev301 lib64]$ strings libexpat.so.1.5.2 | grep XML_SetHashSalt
XML_SetHashSalt
(virtualenv)[user@rbdev301 lib64]$ strings libexpat.so.1.5.2 | grep EXPAT_2_0_1_RH
EXPAT_2_0_1_RH
Apache正在使用的那个是从与python正在使用的源相同的源编译的,并且它们都是相同的版本。似乎Python使用的是64位而Apache不是?也许我在这里疯狂追逐。
答案 0 :(得分:1)
我能够解决这个问题。我不确定这是不是&#34;对&#34;方式,但它对我有用。因为我注意到我的apache lib目录中的libexpat.so.0符号链接指向了/ usr / local / lib中的一个,并且实际上没有包含错误所抱怨的字符串,所以删除了符号链接和创建了一个新的,指向/lib64/libexpat.so.1.5.2,如下所示:
sudo ln -s /lib64/libexpat.so.1.5.2 libexpat.so.0
然后我重新启动机器,一切都按预期工作。
只是想我发布了什么解决了它,以防万一其他人遇到这个奇怪的错误。