Ticket #908 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

Issues deploying extensions with modwsgi / uwsgi

Reported by: rgrp Owned by: pudo
Priority: critical Milestone: ckan-v1.4-sprint-1
Component: ckan Keywords:
Cc: Repository:
Theme:

Description (last modified by rgrp) (diff)

Some extensions import pylons features (such as request) at root.

Have encountered following issues:

  1. You need to import ckanext before any ckan stuff in your wsgi script (extension stats and dataapi)
  1. Running under wsgi daemon mode (normal mode is fine!) the front page (front page only) will not work (does not occur with disqus or synchronous_search but does with stats and dataapi extensions). You get errors like this in the log:
[Mon Jan 17 09:01:19 2011] [error] Exception KeyError: KeyError(-1218594160,) in <module 'threading' from '/usr/lib/python2.6/threading.pyc'> ignored
[Mon Jan 17 09:01:20 2011] [error] Exception AttributeError: "'NoneType' object has no attribute 'clearing'" in <bound method PluginEnvironment.__del__ of  Services for Environment '<default>'

Change History

comment:1 Changed 3 years ago by rgrp

  • Description modified (diff)

comment:2 Changed 3 years ago by wwaites

see also from http://knowledgeforge.net/okfn/tasks/ticket/485

(pyenv)okfn@eu7:~/var/srvc/ckan.net$ sudo uwsgi -C -iH /home/okfn/var/srvc/ckan.net/pyenv --paste config:ckan.net.ini --uid www-data -s 10.48.162.201:9001
*** Starting uWSGI 0.9.6.6 (32bit) on [Sun Jan 30 16:00:13 2011] ***
compiled with version: 4.4.3
Python version: 2.6.5 (r265:79063, Apr 16 2010, 13:28:26)
[GCC 4.4.3]
uWSGI running as root, you can use --uid/--gid/--chroot options
setuid() to 33
 *** WARNING: you are running uWSGI without its master process manager ***
your memory page size is 4096 bytes
allocated 412 bytes (0 KB) for 1 request's buffer.
Setting PythonHome to /home/okfn/var/srvc/ckan.net/pyenv...
binding on TCP port: 9001
your server socket listen backlog is limited to 64 connections
initializing hooks...done.
Loading paste environment: config:ckan.net.ini
Traceback (most recent call last):
  File "/home/okfn/var/srvc/ckan.net/pyenv/lib/python2.6/site-packages/paste/deploy/__init__.py", line 3, in <module>
    from loadwsgi import *
  File "/home/okfn/var/srvc/ckan.net/pyenv/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 8, in <module>
    import pkg_resources
  File "/home/okfn/var/srvc/ckan.net/pyenv/lib/python2.6/site-packages/pkg_resources.py", line 2691, in <module>
    add_activation_listener(lambda dist: dist.activate())
  File "/home/okfn/var/srvc/ckan.net/pyenv/lib/python2.6/site-packages/pkg_resources.py", line 668, in subscribe
    callback(dist)
  File "/home/okfn/var/srvc/ckan.net/pyenv/lib/python2.6/site-packages/pkg_resources.py", line 2691, in <lambda>
    add_activation_listener(lambda dist: dist.activate())
  File "/home/okfn/var/srvc/ckan.net/pyenv/lib/python2.6/site-packages/pkg_resources.py", line 2195, in activate
    map(declare_namespace, self._get_metadata('namespace_packages.txt'))
  File "/home/okfn/var/srvc/ckan.net/pyenv/lib/python2.6/site-packages/pkg_resources.py", line 1790, in declare_namespace
    _handle_ns(packageName, path_item)
  File "/home/okfn/var/srvc/ckan.net/pyenv/lib/python2.6/site-packages/pkg_resources.py", line 1761, in _handle_ns
    loader.load_module(packageName); module.__path__ = path
  File "/usr/lib/python2.6/pkgutil.py", line 238, in load_module
    mod = imp.load_module(fullname, self.file, self.filename, self.etc)
  File "/home/okfn/var/srvc/ckan.net/pyenv/src/ckanext-dataapi/ckanext/dataapi/__init__.py", line 36, in <module>    from pylons import config
  File "/home/okfn/var/srvc/ckan.net/pyenv/lib/python2.6/site-packages/pylons/__init__.py", line 4, in <module>
    from pylons.config import config
  File "/home/okfn/var/srvc/ckan.net/pyenv/lib/python2.6/site-packages/pylons/config.py", line 2, in <module>
    from pylons.configuration import *
  File "/home/okfn/var/srvc/ckan.net/pyenv/lib/python2.6/site-packages/pylons/configuration.py", line 25, in <module>
    import pylons.legacy
  File "/home/okfn/var/srvc/ckan.net/pyenv/lib/python2.6/site-packages/pylons/legacy.py", line 11, in <module>
    from pylons.util import deprecated, func_move
  File "/home/okfn/var/srvc/ckan.net/pyenv/lib/python2.6/site-packages/pylons/util.py", line 18, in <module>
    from paste.script.appinstall import Installer
  File "/home/okfn/var/srvc/ckan.net/pyenv/lib/python2.6/site-packages/paste/script/appinstall.py", line 23, in <module>
    from paste.deploy import appconfig
ImportError: cannot import name appconfig

comment:3 Changed 3 years ago by pudo

  • Owner changed from rgrp to pudo

comment:4 Changed 3 years ago by pudo

  • Status changed from new to closed
  • Resolution set to fixed

comment:5 Changed 3 years ago by wwaites

  • Status changed from closed to reopened
  • Resolution fixed deleted
  • Summary changed from Issues deploying extensions with modwsgi to Issues deploying extensions with modwsgi / uwsgi

Not fixed. Try running with:

uwsgi -C -iH /path/to/your/pyenv --paste config:ckan.net.ini -s 127.0.0.1:9000

Still get giant traceback relating to a circular import centered on an arbitrary plugin

comment:6 Changed 3 years ago by pudo

  • Status changed from reopened to closed
  • Resolution set to fixed
  • Milestone changed from ckan-v1.3 to ckan-v1.4-sprint-1

I've moved the uswgi/nginx part to #952, closing this issue since the problem it describes has been fixed.

Note: See TracTickets for help on using tickets.