[mod_python] Help about apache mod_python Segmentation fault

Graham Dumpleton graham.dumpleton at gmail.com
Mon Mar 3 23:54:38 EST 2008


On 04/03/2008, auther_bin <auther_bin at 21cn.com> wrote:
> Hi, Graham Dumpleton!
>
>  For I am in an embeded system with chroot. And I don't know clearly why python looking for the libs in /bin/lib ( find in strace, it first looking into /bin/lib/python2.5 ) so I placed it there. Let me try if I move it into /usr/local/lib ....

You can't just blindly move things around like that. Python finds its
library directories by looking relative to where the 'python'
executable is and shifting it like that will most likely break things.

Suggest that when you configure and build Python in the first place
that you use the option:

  --prefix=/usr/local

to the 'configure' script so that when it is built it knows properly
where it is being installed and so installation goes to the correct
desired place.

When you do the 'make install', the  'python' executable should then end up at:

  /usr/local/bin/python

The headers files as:

  /usr/local/include/python2.5

and the library directory at:

  /usr/local/lib/python2.5

That it looked, according to strace in /bin/lib/python2.5 doesn't mean
that that is where it should be installed, it is probably just part of
its attempts to find where the lib directory is in relation to the
'python' executable. It definitely isn't the standard location.

Graham

>  ======= 2008-03-04 wrote =======
>
>
>  >On 04/03/2008, auther_bin <auther_bin at 21cn.com> wrote:
>  >> Hi, Graham Dumpleton!
>  >>
>  >>  Thanks for your help first, but the problem is still there. here is my testing steps:
>  >>
>  >>  I read carefully of the URL you give me: http://code.google.com/p/modwsgi/wiki/InstallationIssues
>  >>  and re-compiling the python2.5 --enable-shared, and get python libpython2.5.so install, when I testing python like:
>  >>
>  >>  =====================================================================
>  >>  # python
>  >>  Python 2.5 (r25:51908, Mar  4 2008, 08:56:31)
>  >>  [GCC 3.4.4] on linux2
>  >>  Type "help", "copyright", "credits" or "license" for more information.
>  >>  >>> testi=1
>  >>  >>> if testi==1:
>  >>  ...  print "hello test"
>  >>  ...
>  >>  hello test
>  >>  >>> <ctl-d>
>  >>  # ldd python
>  >>                 libpython2.5.so.1.0 => not found
>  >
>  >Where is your libpython2.5.so installed? Not your sylimk, but what the
>  >symlink points at.
>  >
>  >>         libpthread.so.0 => /lib/libpthread.so.0 (0x40023000)
>  >>         libdl.so.0 => not found
>  >>         libutil.so.0 => not found
>  >>         libm.so.0 => not found
>  >>         libc.so.0 => not found
>  >
>  >Your operating system installation is severely crippled or broken if
>  >these standard libraries cannot be found. Are you stuck with using
>  >uClibc or can you use something else?
>  >
>  >>         libc.so.6 => /lib/libc.so.6 (0x40076000)
>  >>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
>  >>  # ## for the libs is installed in an embeded path so some of them could not be found
>  >>  # ls -F /bin/lib/python2.5/config
>  >
>  >Why is this under /bin/lib? That isn't the standard location for this
>  >sort off stuff and if libpython2.5.so is in /bin/lib it will not be
>  >found.
>  >
>  >Graham
>  >
>  >>  Makefile         config.c         libpython2.5.a   python.o
>  >>  Setup            config.c.in      libpython2.5.so@
>  >>  Setup.local      install-sh*      makesetup*
>  >>  =====================================================================
>  >>
>  >>  when I run "httpd -X" it's still gives an Segmentation fault :(
>  >>  anything else could be found about this crash?
>  >>  or I give you an ssh login to my host :)
>  >>
>  >>  ======= 2008-03-03 wrote =======
>  >>
>  >>
>  >>  >In gdb, instead of 'where', try:
>  >>  >
>  >>  >  thread apply all bt
>  >>  >
>  >>  >in case gdb isn't throwing you into the correct thread context.
>  >>  >
>  >>  >BTW, does the Python on the environment that crashes provide a shared
>  >>  >library? For what I am talking about see:
>  >>  >
>  >>  >  http://code.google.com/p/modwsgi/wiki/InstallationIssues
>  >>  >
>  >>  >This is documentation from mod_wsgi but same problems apply to mod_python.
>  >>  >
>  >>  >Graham
>  >>  >
>  >>  >On 03/03/2008, auther_bin <auther_bin at 21cn.com> wrote:
>  >>  >>
>  >>  >>
>  >>  >> Hi Graham Dumpleton,
>  >>  >>
>  >>  >> And, when I debug in RedHat9 and my embeded
>  >>  >> envirenment, the main process goes
>  >>  >> different!?
>  >>  >>
>  >>  >> in Redhat9, run like:
>  >>  >>
>  >>  >>
>  >>  >> (gdb) b main
>  >>  >> Breakpoint 1 at 0x8067a40: file main.c, line 438.
>  >>  >> (gdb) run -X
>  >>  >> Starting program: /usr/local/apache2/bin/httpd -X
>  >>  >> [New Thread 1076592288 (LWP 1049)]
>  >>  >> [Switching to Thread 1076592288 (LWP 1049)]
>  >>  >>
>  >>  >> Breakpoint 1, main (argc=134642240, argv=0x2) at main.c:438
>  >>  >> 438     {
>  >>  >> (gdb) n
>  >>  >> 272         stat = apr_app_initialize(argc, argv, NULL);
>  >>  >>
>  >>  >> and in my embeded system runs like:
>  >>  >>
>  >>  >>
>  >>  >>
>  >>  >> Breakpoint 1, main (argc=2, argv=0xbffff294)
>  >>  >>     at
>  >>  >> /usr/src/build/snapgear/user/apache/server/main.c:441
>  >>  >> 441         int configtestonly = 0;
>  >>  >> (gdb) n
>  >>  >> 442         const char *confname = SERVER_CONFIG_FILE;
>  >>  >>
>  >>  >>
>  >>  >>
>  >>  >> it seems that, the hosting system doing something for init before the main
>  >>  >> function run, but embeded system do not?
>  >>  >>
>  >>  >> I thinks is here somthing wrong? or there should be some compiling
>  >>  >> parameters I missed?
>  >>  >>
>  >>  >> ======= 2008-02-27 wrote: =======
>  >>  >>
>  >>  >>
>  >>  >> >On 27/02/2008, auther_bin  <auther_bin at 21cn.com > wrote:
>  >>  >> > > Dear friends,
>  >>  >> > >
>  >>  >> > >         When I compiling the apache python mod_python
>  >>  >> and install it into my uClibc
>  >>  >> envirentment,
>  >>  >> but when I
>  >>  >> > >  runing httpd -X, send a very little request with
>  >>  >> index.html it crashed. after some debuging work,
>  >>  >> I find there should be something wrong in mod_python.c
>  >>  >> line(about 1561) which looks like:
>  >>  >> > >  --------------------------------- with my debug
>  >>  >> printing :) ------------------------
>  >>  >> > >  printf("JJJJJJJJ %s - > python_handler\n", phase);
>  >>  >> > >  printf("JJJJJJJJ %x[%d]\n", &req- >per_dir_config,
>  >>  >> (&python_module)- >module_index);
>  >>  >> > >     /* get configuration */
>  >>  >> > >     conf = (py_config *) ap_get_module_config(req-
>  >>  >> >per_dir_config,
>  >>  >> > >
>  >>  >> &python_module);
>  >>  >> > >  printf("JJJJJJJJ a %s conf=%x - > python_handler\n",
>  >>  >> phase,conf);
>  >>  >> > >  .............
>  >>  >> > >  ------------------------------ end source
>  >>  >> --------------------------------------
>  >>  >> > >
>  >>  >> > >  I guess that, there should be a regester error in
>  >>  >> it. with some debug message I print:
>  >>  >> > >  ------------- printing -------------------------------
>  >>  >> > >  JJJJJJJJJ PythonPostReadRequestHandler
>  >>  >> > >  JJJJJJJJ PythonInitHandler - > python_handler
>  >>  >> > >  JJJJJJJJ 820a544[29]
>  >>  >> > >  Segmentation fault
>  >>  >> > >  ------------- end printing ---------------------------
>  >>  >> > >
>  >>  >> > >  any advices pls?
>  >>  >> >
>  >>  >> >Unfortunately that doesn't help much.
>  >>  >> >
>  >>  >> >You need a stack trace to show the true location
>  >>  >> in code.
>  >>  >> >
>  >>  >> >Use procedure documented in section 'Debugging
>  >>  >> Crashes With GDB' of:
>  >>  >> >
>  >>  >> >
>  >>  >> http://code.google.com/p/modwsgi/wiki/DebuggingTechniques
>  >>  >> >
>  >>  >> >to run up httpd inside of gdb and get a stack trace
>  >>  >> of where crash is occurring.
>  >>  >> >
>  >>  >> >This documentation is for mod_wgsi, but same procedure
>  >>  >> used for mod_python.
>  >>  >> >
>  >>  >> >There is a similar procedure documented on Apache
>  >>  >> site, but can't
>  >>  >> >remember where.
>  >>  >> >
>  >>  >> >Graham
>  >>  >> >
>  >>  >> >
>  >>  >> >__________ NOD32 2906 (20080227) Information
>  >>  >> __________
>  >>  >> >
>  >>  >> >This message was checked by NOD32 antivirus system.
>  >>  >> >http://www.nod32cn.com
>  >>  >> >
>  >>  >> >
>  >>  >>
>  >>  >> = = = = = = = = = = = = = = = = = = = =
>  >>  >>
>  >>  >>
>  >>  >>                     ÖÂ
>  >>  >> Àñ£¡
>  >>  >> 2008-03-03
>  >>  >>
>  >>  >> _______________________________________________
>  >>  >> Mod_python mailing list
>  >>  >> Mod_python at modpython.org
>  >>  >> http://mailman.modpython.org/mailman/listinfo/mod_python
>  >>  >>
>  >>  >>
>  >>  >> __________ NOD32 2915 (20080303) Information __________
>  >>  >>
>  >>  >> This message was checked by NOD32 antivirus system.
>  >>  >> http://www.nod32cn.com
>  >>  >>
>  >>  >>
>  >>  >> _______________________________________________
>  >>  >>  Mod_python mailing list
>  >>  >>  Mod_python at modpython.org
>  >>  >>  http://mailman.modpython.org/mailman/listinfo/mod_python
>  >>  >>
>  >>  >>
>  >>
>  >>
>  >> = = = = = = = = = = = = = = = = = = = =
>  >>
>  >>
>  >>                     ÖÂ
>  >>  Àñ£¡
>  >>                 2008-03-04
>  >>
>  >>
>  >>  _______________________________________________
>  >>  Mod_python mailing list
>  >>  Mod_python at modpython.org
>  >>  http://mailman.modpython.org/mailman/listinfo/mod_python
>  >>
>
>  = = = = = = = = = = = = = = = = = = = =
>
>
>                     ÖÂ
>  Àñ£¡
>                 2008-03-04
>
>  _______________________________________________
>  Mod_python mailing list
>  Mod_python at modpython.org
>  http://mailman.modpython.org/mailman/listinfo/mod_python
>



More information about the Mod_python mailing list