Apache pystring_fromstring:assertion ' str!= ((void *) 0) ' failed. Error handling

Source: Internet
Author: User
Tags xml parser

I recently encountered a strange problem, when I moved the Django project to another server, I reported the following error:

[Wed Oct 08 15:31:04 2014] [ERROR] [Client 10.19.81.48] Premature end of script headers:wsgi.py, Referer:
: 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:
Google a few, just start to see premature end of the script headers thought is the line endings of the scripting problem, but the confirmation is UNIX format
So decisively shifted direction, there may be a system of problems, so find the following article, finally solved my problem:
Mod_wsgi Thread Crashes

 $ tail-f error_log httpd:objects/stringobject.c:105:pystring_fromstring:assertion ' str!= ((void *) 0) ' failed. [ Sun June 00:48:53 2009] [notice] child PID 1145 exit signal aborted (6) Httpd:objects/stringobject.c:105:pystring_from
String:assertion ' str!= ((void *) 0) ' failed. [Sun June 26 00:48:54 2009] [Notice] child PID 1146 exit signal aborted (6) 
Check the Error.log file 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) from this can be learned that the MOD_WSGI thread crashes, Google, here to get some information, it seems that the WSGI application in Apache under the collapse of more than Trac,
 
Django is possible, too.
 
This is because Apache does not match the Python version of the Expat library. Apache Expat version: Httpd-2.2.8/lib $ strings libexpat.so.0.1.0 | grep expat_ expat_1.95.2 python expat version:/opt/httpd-2.2.8/lib $ python python 2.4.3 (#1, May 2008, 13:47:28) [GCC 4
.1.2 20070626 (Red Hat 4.1.2-14)] on linux2 Type ' help ', ' copyright ', ' credits ' or ' license ' for the more information. >>> import Pyexpat >>> pyexpat. Expat_version ' expat_2.0.1 ' found a reason to do it, but the author only mentioned a download EXPAT 2.0.1 installation, but did not say how to install to the Apache,apache configure itself did not with-expat parameters,
 
Only apache_src/srclib/apr-util/configure have this parameter but do not know how to relate, but under another find scheme. Check httpd dependent libraries:/opt/httpd-2.2.8/bin $ ldd httpd linux-gate.so.1 => (0x002e6000) libm.so.6 =>/lib/libm.so.6 (0x00cd 8000) 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) 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) so that Apache is using/opt/httpd-2.2.8/lib/ libexpat.so.0, and this file is a soft link, trying to delete it, re pointing to 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 restart Apache and the test was successful.

Note that the reboot here is first stop and then start, instead of Restart,restart it doesn't seem to work.
Expat-2.0.1.tar.gz
This is the source file, need to compile, see the following tutorial

About Expat Library

1, Expat library Introduction

Refer to Wiki:

    to use the Expat library, programs a handler functions with Expat. When Expat parses a XML document, it calls the registered handlers as it finds relevant in the input stream. These tokens and their associated handler calls are 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 E Vents.
     Expat is parsing events resemble the events defined in the simple APIs for XML (SAX), but EXP At are not a sax-compliant parser. Projects incorporating the Expat library often build SAX and possibly DOM parsers to top of Expat. While Expat are mainly a stream-based (push) parser, it supports stopping and restarting parsing at the arbitrary times, thus M Aking the implementation of a pull parser relatively easy as.

In order to use the expat Library, the program first Expart a processor function (handler functions). When expat parses an XML document, it is found that there are related tokens in the input stream that call the registered processor (handlers), and that the processors (handler) of these tokens (tokens) and first are called events. Typically, the program registers the handler functions for the start, stop, character events (character events) in the XML element.      Expat provides more complex event handling, such as XML namespace declarations, processing directives, and DTD events. Expat is a resolution event or similar event defined in Sax. But it is not a strict parser that obeys sax. Expat is a primarily flow-based parser (push), which supports parsers that stop and restart at any time, making it easy to implement related pull-type parsers (pull parser).
(the first translation, translation of the Bad AH ~ ~ ~ ~)

to be blunt, expat is a stream-oriented XML parser.

2, Expat Library of the cross-compilation

expat-2.0.1.tar.gz

./configure--host=arm-none-linux-gnueabi--prefix=/root/home

Make && make install


Reference: http://askyyy.blog.163.com/blog/static/123457599200971802737/http://blog.csdn.net/flyeagle022/article/details/7789098

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.