missing __init__.py = segfault

Bug #175239 reported by Carl Karsten
2
Affects Status Importance Assigned to Milestone
libapache2-mod-python (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: libapache2-mod-python

It is probably more like "raise EnvironmentError" causes segfault, but I'm note expert enough.

I found this testing https://launchpad.net/bugs/175230 "__init__.py missing"

These 2 are not dependent on each other -
if 175230 isn't fixed, then the rm __init__.py steps below don't need to be done.

Steps:

Install Ubuntu-Server (only openssh-server)

sudo apt-get install libapache2-mod-python python-django
sudo rm /usr/share/doc/python-django/examples/__init__.py

sudo vim /etc/apache2/sites-available/django-example

<Location "/">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    PythonDebug On
    PythonPath "['/usr/share/doc/python-django'] + sys.path"
    SetEnv DJANGO_SETTINGS_MODULE examples.settings
</Location>

sudo a2dissite default
sudo a2ensite django-example
sudo /etc/init.d/apache2 reload

hit box with browser

juser@cp333:~$ tail -f /var/log/apache2/error.log
[Sun Dec 09 23:30:33 2007] [notice] child pid 5414 exit signal Segmentation fault (11)
[Sun Dec 09 23:30:33 2007] [notice] child pid 5415 exit signal Segmentation fault (11)
[Sun Dec 09 23:30:33 2007] [notice] child pid 5416 exit signal Segmentation fault (11)
[Sun Dec 09 23:30:33 2007] [notice] child pid 5417 exit signal Segmentation fault (11)
[Sun Dec 09 23:30:33 2007] [notice] child pid 5420 exit signal Segmentation fault (11)
[Sun Dec 09 23:30:33 2007] [notice] child pid 5421 exit signal Segmentation fault (11)
[Sun Dec 09 23:30:34 2007] [error] [client 192.168.1.48] mod_python (pid=5423, interpreter='cp333.personnelware.com', phase='PythonHandler', handler='django.core.handlers.modpython'): Application error
[Sun Dec 09 23:30:34 2007] [error] [client 192.168.1.48] ServerName: 'cp333.personnelware.com'
[Sun Dec 09 23:30:34 2007] [error] [client 192.168.1.48] DocumentRoot: '/htdocs'
[Sun Dec 09 23:30:34 2007] [error] [client 192.168.1.48] URI: '/'
[Sun Dec 09 23:30:34 2007] [error] [client 192.168.1.48] Location: '/'
[Sun Dec 09 23:30:34 2007] [error] [client 192.168.1.48] Directory: None
[Sun Dec 09 23:30:34 2007] [error] [client 192.168.1.48] Filename: '/htdocs'
[Sun Dec 09 23:30:34 2007] [error] [client 192.168.1.48] PathInfo: '/'
[Sun Dec 09 23:30:34 2007] [error] [client 192.168.1.48] Traceback (most recent call last):
[Sun Dec 09 23:30:34 2007] [error] [client 192.168.1.48] File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch\n default=default_handler, arg=req, silent=hlist.silent)
[Sun Dec 09 23:30:34 2007] [error] [client 192.168.1.48] File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1229, in _process_target\n result = _execute_target(config, req, object, arg)
[Sun Dec 09 23:30:34 2007] [error] [client 192.168.1.48] File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1128, in _execute_target\n result = object(arg)
[Sun Dec 09 23:30:34 2007] [error] [client 192.168.1.48] File "/var/lib/python-support/python2.5/django/core/handlers/modpython.py", line 177, in handler\n return ModPythonHandler()(req)
[Sun Dec 09 23:30:34 2007] [error] [client 192.168.1.48] File "/var/lib/python-support/python2.5/django/core/handlers/modpython.py", line 145, in __call__\n self.load_middleware()
[Sun Dec 09 23:30:34 2007] [error] [client 192.168.1.48] File "/var/lib/python-support/python2.5/django/core/handlers/base.py", line 22, in load_middleware\n for middleware_path in settings.MIDDLEWARE_CLASSES:
[Sun Dec 09 23:30:34 2007] [error] [client 192.168.1.48] File "/var/lib/python-support/python2.5/django/conf/__init__.py", line 28, in __getattr__\n self._import_settings()
[Sun Dec 09 23:30:34 2007] [error] [client 192.168.1.48] File "/var/lib/python-support/python2.5/django/conf/__init__.py", line 55, in _import_settings\n self._target = Settings(settings_module)
[Sun Dec 09 23:30:34 2007] [error] [client 192.168.1.48] File "/var/lib/python-support/python2.5/django/conf/__init__.py", line 83, in __init__\n raise EnvironmentError, "Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)
[Sun Dec 09 23:30:34 2007] [error] [client 192.168.1.48] EnvironmentError: Could not import settings 'examples.settings' (Is it on sys.path? Does it have syntax errors?): No module named examples.settings

Revision history for this message
Carl Karsten (carlfk) wrote :

bug vanished for no reason.

I think all I did was create/remove the file:

sudo touch /usr/share/doc/python-django/examples/__init__.py
sudo rm /usr/share/doc/python-django/examples/__init__.pyc

but now when I hit with browser, I get an error page and no segfault.

MOD_PYTHON ERROR

ProcessId: 4059
Interpreter: 'cp333.personnelware.com'

ServerName: 'cp333.personnelware.com'
DocumentRoot: '/htdocs'

URI: '/'
Location: '/'
Directory: None
Filename: '/htdocs'
PathInfo: '/'

Phase: 'PythonHandler'
Handler: 'django.core.handlers.modpython'

Traceback (most recent call last):

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch
    default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1229, in _process_target
    result = _execute_target(config, req, object, arg)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1128, in _execute_target
    result = object(arg)

  File "/var/lib/python-support/python2.5/django/core/handlers/modpython.py", line 177, in handler
    return ModPythonHandler()(req)

  File "/var/lib/python-support/python2.5/django/core/handlers/modpython.py", line 145, in __call__
    self.load_middleware()

  File "/var/lib/python-support/python2.5/django/core/handlers/base.py", line 22, in load_middleware
    for middleware_path in settings.MIDDLEWARE_CLASSES:

  File "/var/lib/python-support/python2.5/django/conf/__init__.py", line 28, in __getattr__
    self._import_settings()

  File "/var/lib/python-support/python2.5/django/conf/__init__.py", line 55, in _import_settings
    self._target = Settings(settings_module)

  File "/var/lib/python-support/python2.5/django/conf/__init__.py", line 83, in __init__
    raise EnvironmentError, "Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)

EnvironmentError: Could not import settings 'examples.settings' (Is it on sys.path? Does it have syntax errors?): No module named examples.settings

Revision history for this message
Daniel T Chen (crimsun) wrote :

Please reopen if reproducible in 8.10 or 9.04.

Changed in libapache2-mod-python:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.