mozilla-services / syncserver

Run-Your-Own Firefox Sync Server
Mozilla Public License 2.0
1.87k stars 145 forks source link

Python component errors when running under apache 2.2 #46

Closed nroach44 closed 10 years ago

nroach44 commented 10 years ago
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62] mod_wsgi (pid=10690): Target WSGI script '/haven/data/htdocs/ffsync/syncserver.wsgi' cannot be loaded as Python module.
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62] mod_wsgi (pid=10690): Exception occurred processing WSGI script '/haven/data/htdocs/ffsync/syncserver.wsgi'.
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62] Traceback (most recent call last):
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]   File "/haven/data/htdocs/ffsync/syncserver.wsgi", line 40, in <module>
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]     application = loadapp('config:%s'% ini_file)
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]   File "/haven/data/htdocs/ffsync/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]     return loadobj(APP, uri, name=name, **kw)
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]   File "/haven/data/htdocs/ffsync/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 271, in loadobj
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]     global_conf=global_conf)
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]   File "/haven/data/htdocs/ffsync/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 296, in loadcontext
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]     global_conf=global_conf)
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]   File "/haven/data/htdocs/ffsync/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 320, in _loadconfig
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]     return loader.get_context(object_type, name, global_conf)
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]   File "/haven/data/htdocs/ffsync/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 454, in get_context
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]     section)
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]   File "/haven/data/htdocs/ffsync/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 476, in _context_from_use
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]     object_type, name=use, global_conf=global_conf)
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]   File "/haven/data/htdocs/ffsync/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 406, in get_context
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]     global_conf=global_conf)
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]   File "/haven/data/htdocs/ffsync/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 296, in loadcontext
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]     global_conf=global_conf)
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]   File "/haven/data/htdocs/ffsync/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 328, in _loadegg
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]     return loader.get_context(object_type, name, global_conf)
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]   File "/haven/data/htdocs/ffsync/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 620, in get_context
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]     object_type, name=name)
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]   File "/haven/data/htdocs/ffsync/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 646, in find_egg_entry_point
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]     possible.append((entry.load(), protocol, entry.name))
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]   File "/haven/data/htdocs/ffsync/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 1989, in load
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]     entry = __import__(self.module_name, globals(),globals(), ['__name__'])
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]   File "/haven/data/htdocs/ffsync/syncserver/__init__.py", line 9, in <module>
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]     from pyramid.response import Response
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]   File "/usr/lib/python2.7/dist-packages/pyramid/__init__.py", line 1, in <module>
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]     from pyramid.request import Request
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]   File "/usr/lib/python2.7/dist-packages/pyramid/request.py", line 17, in <module>
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]     from pyramid.url import URLMethodsMixin
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]   File "/usr/lib/python2.7/dist-packages/pyramid/url.py", line 13, in <module>
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]     from pyramid.threadlocal import get_current_registry
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]   File "/usr/lib/python2.7/dist-packages/pyramid/threadlocal.py", line 3, in <module>
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]     from pyramid.registry import global_registry
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]   File "/usr/lib/python2.7/dist-packages/pyramid/registry.py", line 1, in <module>
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62]     from zope.component.registry import Components
[Tue Nov 11 19:50:47 2014] [error] [client 192.168.0.62] ImportError: No module named component.registry

Running on Debian Wheezy x64 with python-zope.component 3.10 installed.

rfk commented 10 years ago

This may indicate that mod_wsgi is using the system python rather than the virtualenv built at ./local. Is your WSGIDaemonProcess option using the correct python-path?

nroach44 commented 10 years ago

I believe so (assuing this is the python-path you mean)

WSGIDaemonProcess sync user=ffsync group=ffsync processes=2 threads=25 python-path=/haven/data/htdocs/ffsync/local/lib/python2.7/site-packages/

That folder does exist and it does seem to contain the correct things. It doesn't contain zope.component, but it does have zope.interface and .deprecation. I'm not familiar with python so this may be fine.

rfk commented 10 years ago

Does the server start correctly if you run make serve?

rfk commented 10 years ago

You could also try ./local/bin/pip install zope.component to install it into the local virtualenv; if that helps I'll just stick it in the install script by default

nroach44 commented 10 years ago

It works when I browse to the URL and shows the "it works" but sync fails with the client side error

1415760933428   Sync.BrowserIDManager   ERROR   Non-authentication error in _fetchTokenForUser: Client error.
1415760933432   Sync.BrowserIDManager   ERROR   Background fetch for key bundle failed: TokenServerClientNetworkError({"error":{}})
1415760933433   Sync.BrowserIDManager   ERROR   Could not authenticate: TokenServerClientNetworkError({"error":{}})

And the only output on the server's console is

Starting server in PID 636.
serving on 0.0.0.0:5000 view at http://127.0.0.1:5000
INFO:mozsvc.metrics:{"code": 200, "request_time": 0.0031418800354003906, "remoteAddressChain": ["192.168.0.62"], "agent": "Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.2.0", "path": "http://ffsync.haven:5000/", "method": "GET"}
INFO:mozsvc.metrics:{"code": 404, "request_time": 0.003993988037109375, "remoteAddressChain": ["192.168.0.62"], "agent": "Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.2.0", "path": "http://ffsync.haven:5000/favicon.ico", "method": "GET"}
INFO:mozsvc.metrics:{"code": 404, "request_time": 0.0010960102081298828, "remoteAddressChain": ["192.168.0.62"], "agent": "Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.2.0", "path": "http://ffsync.haven:5000/favicon.ico", "method": "GET"}

As I can't see the python error log, this seems to be the same errors as through wsgi.

I'll check what you just wrote in a minute.

nroach44 commented 10 years ago

./local/bin/pip install zope.component

Definitely seemed to do the trick. I'll test with wsgi in a minute.

nroach44 commented 10 years ago

Whoops, didn't mean to close the issue, but I does work in wsgi now, so it's all good.

rfk commented 9 years ago

I finally revisited this and pushed the zope.component change in https://github.com/mozilla-services/syncserver/commit/5d44e8152fa9e53f7357b166addb6322803e10d1. Thanks again for the report.