apache PyString_FromString: Assertion `str != ((void *)0)' failed. 错误处理
来源:互联网 发布:板式家具算料软件 编辑:程序博客网 时间:2024/06/05 18:20
最近遇到个奇怪的问题,我将django项目迁到到另一台服务器时,报如下错误:
: Objects/stringobject.c:115: PyString_FromString: Assertion `str != ((void *)0)' failed.
[Wed Oct 08 15:31:18 2014] [error] [client 10.19.81.48] Premature end of script headers: wsgi.py, referer:
mod_wsgi线程崩溃
$ tail -f error_log httpd: Objects/stringobject.c:105: PyString_FromString: Assertion `str != ((void *)0)' failed.[Sun Jul 26 00:48:53 2009] [notice] child pid 1145 exit signal Aborted (6)httpd: Objects/stringobject.c:105: PyString_FromString: Assertion `str != ((void *)0)' failed.[Sun Jul 26 00:48:54 2009] [notice] child pid 1146 exit signal Aborted (6)
检查error.log文件 httpd: Objects/stringobject.c:105: PyString_FromString: Assertion `str != ((void *)0)' failed.[Fri Mar 20 20:39:03 2009] [notice] child pid 8734 exit signal Aborted (6) 由此可得知mod_wsgi线程崩溃掉了,Google一下,在这里得到一些资料,看来wsgi应用在Apache下崩溃的不止是Trac,Django也是有可能的。 这是由于Apache与Python的expat库版本不匹配导致。 Apache expat版本: httpd-2.2.8/lib $ strings libexpat.so.0.1.0 | grep expat_expat_1.95.2 Python expat版本: /opt/httpd-2.2.8/lib $ pythonPython 2.4.3 (#1, May 24 2008, 13:47:28)[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> import pyexpat>>> pyexpat.EXPAT_VERSION'expat_2.0.1' 找到原因后就好办了,但是作者只提了一句下载expat 2.0.1安装,却没说如何安装到Apache,Apache的configure本身并没有with-expat参数,只有 apache_src/srclib/apr-util/configure有这个参数却不知如何关联,无奈之下另找方案。 检查httpd依赖的库: /opt/httpd-2.2.8/bin $ ldd httpdlinux-gate.so.1 => (0x002e6000)libm.so.6 => /lib/libm.so.6 (0x00cd8000)libaprutil-1.so.0 => /opt/httpd-2.2.8/lib/libaprutil-1.so.0 (0x00c1e000)libexpat.so.0 => /opt/httpd-2.2.8/lib/libexpat.so.0 (0x00925000)libapr-1.so.0 => /opt/httpd-2.2.8/lib/libapr-1.so.0 (0x003df000)libuuid.so.1 => /lib/libuuid.so.1 (0x00110000)librt.so.1 => /lib/librt.so.1 (0x00d91000)libcrypt.so.1 => /lib/libcrypt.so.1 (0x0023d000)libpthread.so.0 => /lib/libpthread.so.0 (0x00d01000)libdl.so.2 => /lib/libdl.so.2 (0x00cd2000)libc.so.6 => /lib/libc.so.6 (0x00402000)/lib/ld-linux.so.2 (0x00b6f000) 由此可知Apache使用的是/opt/httpd-2.2.8/lib/libexpat.so.0,而这个文件是一个软链接,尝试将其删除,重新指到2.0.1: /opt/httpd-2.2.8/lib $ ln -s /opt/expat-2.0.1/lib/libexpat.so.1.5.2 libexpat.so.0 重新启动Apache, 测试成功!
1、expat库简介
refer to wiki:
To use the Expat library, programs first register handler functions with Expat. When Expat parses an XML document, it calls the registered handlers as it finds relevant tokens in the input stream. These tokens and their associated handler calls are called events. Typically, programs register handler functions for XML element start or stop events and character events. Expat provides for more sophisticated event handling such as XML Namespace declarations, processing instructions and DTD events.
Expat is parsing events resemble the events defined in the Simple API for XML (SAX), but Expat is not a SAX-compliant parser. Projects incorporating the Expat library often build SAX and possibly DOM parsers on top of Expat. While Expat is mainly a stream-based (push) parser, it supports stopping and restarting parsing at arbitrary times, thus making the implementation of a pull parser relatively easy as well.
为了使用Expat库,程序首先在Expart中住一个处理器函数(handler functions) 。当Expat解析XML文档时,发现输入流中有相关的令牌会调用已经注册的处理器(handlers) ,这些令牌(tokens)和其先关的处理器(handler)被称作事件。通常情况下, 程序会为XML元素中的开始事件、停止事件、字符事件(character events)注册处理函数。Expat提供了 更多复杂事件处理,例如XML命名空间声明,处理指令和DTD事件。
(第一次翻译,翻译的不好啊~~~)
说白了 ,Expat是一个面向流的xml解析器。
2、expat库的交叉编译
expat-2.0.1.tar.gz
./configure --host=arm-none-linux-gnueabi --prefix=/root/home
make && make install
参考:http://askyyy.blog.163.com/blog/static/123457599200971802737/
http://blog.csdn.net/flyeagle022/article/details/7789098- apache PyString_FromString: Assertion `str != ((void *)0)' failed. 错误处理
- linux编译错误__new_exitfn: Assertion `l != ((void *)0)' failed
- Boost 智能指针错误shared_ptr Assertion px != 0 failed
- vfork创建进程出现「cxa_atexit.c:100: __new_exitfn: Assertion `l != ((void *)0)\' failed.」
- svn svn_uri_basename: Assertion `svn_uri_is_canonical(uri, ((void *)0))' failed.
- 错误:Debug assertion failed
- vc 错误:Debug Assertion Failed
- Debug Assertion Failed 错误定位
- Debug Assertion Failed! 错误解析
- 抛出错误Debug Assertion Failed!
- OpenCV Error: Assertion failed (s >= 0)
- GID/GDI+ 的运行时错误 Debug Assertion Failed Expression m_hDC==0
- OPENCV Assertion failed (ni > 0 && ni == ni1) in collectCalibrationData 错误
- [错误]Failed assertion in Init_IDT:g_handlerSizeNoErr == g_handlerSizeErr
- osgPhysX编译错误:Debug Assertion Failed _pFirstBlock == pHead
- C 运行错误:debug assertion failed,stream!=null
- VC6.0常见错误之::Debug Assertion Failed!
- vc6.0 中Debug assertion failed的错误解决
- iOS: Autolayout和UITableViewCell的动态高度 (2) – 多样式Cell切换
- 互联网大佬们都在焦虑什么?
- phpcms如何生成地图sitemap静态页面
- 工厂模式
- IOS网络篇2之客户端离线缓存策略(NSURLProtocol)
- apache PyString_FromString: Assertion `str != ((void *)0)' failed. 错误处理
- SourceInsight设置
- Struts2.3.16.1+Hibernate4.3.4+Spring4.0.2 框架整合
- 关于Segmentation fault (core dumped)几个简单问题
- div文字自动换行
- hibernate的几种纯sql的查询方式
- 调用API加载DLL方法打开文本文件及修改标题
- 使用Androidpn实现Android消息推送
- 解决带fusionCharts的页面多次点击后不显示的问题