Opened 7 years ago

Closed 7 years ago

#5560 closed defect (invalid)

500 internal server error on upload

Reported by: zoro Owned by:
Priority: minor Milestone:
Component: infrastructure Keywords:
Cc: Parent Tickets:

Description

Setup:
Debian 9.3 ARMv7
I have followed the documentation in installing with python3. The documentation is hard to understand since so this issue may just be a misconfiguration. No one is online on the IRC channel. I have successfully run ./gmg/dbupdate. Then tested using lazyserver all ok. But when I upload files using the apache wsgi interface based on the wiki it fails to work. The /var/lib/mediagoblin I changed to my partition of var custom. Here are what I did:

$ sudo useradd -c "GNU Mediagoblin..." -d /mnt/myvar/mediagoblin -m -r -g www-data mediagoblin
$ sugo groupadd mediagoblin && sudo usermod --append -G mediagoblin mediagoblin
$ sudo usermod --append -G myvargroup mediagoblin
$ sudo mkdir -p /srv/mediagoblin && sudo chown -hR mediagoblin:www-data /srv/mediagoblin
$ sudo su mediagoblin -s /bin/bash && cd /srv/mediagoblin
$ git clone git://git.savannah.gnu.org/mediagoblin.git -b stable
$ cd mediagoblin
$ pwd
$ /srv/mediagoblin/mediagoblin
$ git submodule init && git submodule update
$ ./bootstrap.sh
$ ./configure --with-python3
$ make
$ mkdir user_dev && chmod 750 user_dev
$ ./bin/easy_install flup
$ cp -av mediagoblin.ini mediagoblin_local.ini && cp -av paste.ini paste_local.ini

---
the file mediagoblin_local.ini here are the contents:
[DEFAULT]
data_basedir = "/mnt/myvar/mediagoblin"

[mediagoblin]
direct_remote_path = /mgoblin_static/
email_sender_address = "postmaster@…"

## Uncomment and change to your DB's appropiate setting.
## Default is a local sqlite db "mediagoblin.db".
## Don't forget to run ./bin/gmg dbupdate after having changed it.
# sql_engine = postgresql:///mediagoblin

# Set to false to enable sending notices
email_debug_mode = false

# Set to false to disable registrations
allow_registration = false

# Set to false to disable the ability for users to report offensive content
## Uncomment this to put some user-overriding templates here
# local_templates = %(data_basedir)s/templates/

## You can set your theme by specifying this (not specifying it will
## use the default theme). Run gmg assetlink to apply the change.
## The airy and sandyseventiesspeedboat theme comes with GMG; please
## see the theming docs on how to install other themes.
# theme = airy

## If you want the terms of service displayed, you can uncomment this
# show_tos = true

user_privilege_scheme = "uploader,commenter,reporter"
[storage:queuestore]
base_dir = %(data_basedir)s/media/queue

[storage:publicstore]
base_dir = %(data_basedir)s/media/public
base_url = /mgoblin_media/

[celery]
# Put celery stuff here

# Place plugins here, each in their own subsection of [plugins].
# See http://docs.mediagoblin.org/siteadmin/plugins.html for details.
[plugins]
mediagoblin.plugins.geolocation
mediagoblin.plugins.basic_auth
mediagoblin.plugins.processing_info
mediagoblin.media_types.image

---
I did not modified the paste_local.ini.
The wsgi.py:

#!/srv/mediagoblin/mediagoblin/bin/python

.

.
.

import site
# Replace the python version with the correct one in the line below (eg 2.x -> 2.7)
site.addsitedir('/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages')


from paste.deploy import loadapp

CONFIG_PATH = '/srv/mediagoblin/mediagoblin/paste.ini'

## Uncomment this to run celery in "always eager" mode... ie, you don't have
## to run a separate process, but submissions wait till processing finishes

import os
os.environCELERY_ALWAYS_EAGER = 'true'

application = loadapp('config:' + CONFIG_PATH)

---

THe apache sites-enabled/mediagoblin.conf:
<VirtualHost *:443>
...
<Directory /srv/mediagoblin/mediagoblin>
<Files wsgi.py>

Order deny,allow
Allow from all
Require all granted

</Files>
</Directory>

Alias /mgoblin_static/ /srv/mediagoblin/mediagoblin/mediagoblin/static/
Alias /mgoblin_media/ /srv/mediagoblin/mediagoblin/user_dev/media/public/

WSGIScriptAlias / /srv/mediagoblin/mediagoblin/wsgi.py
# Set user and group to whatever user you used to install mediagoblin (if you used a system account,
# it may have the group 'nogroup' assigned, in that case you can remove the group parameter)
# Remember to change python-path too!
# Replace the python version in the 'python-path' below with the correct one (eg 2.x -> 2.7) 3.5
WSGIPassAuthorization On
WSGIDaemonProcess gmg user=mediagoblin group=mediagoblin processes=2 threads=10 \

umask=0007 inactivity-timeout=900 maximum-requests=1000 \
python-path=/srv/mediagoblin/mediagoblin/:/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/

WSGIProcessGroup gmg
WSGIApplicationGroup %{GLOBAL}

<Directory /srv/mediagoblin/mediagoblin/mediagoblin/static>

Order allow,deny

Allow from all

Require all granted

</Directory>
<Directory /srv/mediagoblin/mediagoblin/user_dev/media/public>

Order allow,deny
Allow from all
Require all granted

</Directory>

</VirtualHost>

---

$ ./bin/gmg dbupdate
$ ./lazyserver.sh --server-name=broadcast
$ Ctrl+c, exit
Enable apache2 site. a2ensite, and allow port 443
Visit the site then login and upload somethins and it shows 500 Internal server error. The error log is below:

Apache2 error log:

[Sat Feb 10 14:52:11.462655 2018] [:warn] [pid 5436] mod_qos(009): mod_unique_id not available (mod_qos generates simple request id if required)
[Sat Feb 10 14:52:11.651504 2018] [mpm_prefork:notice] [pid 5436] AH00163: Apache/2.4.25 (Raspbian) mod_fastcgi/mod_fastcgi-SNAP-0910052141 mod_fcgid/2.3.9 OpenSSL/1.0.2l mod_qos/11.36 mod_wsgi/4.5.11 Python/3.5 mod_gnutls/0.8.2 GnuTLS/3.5.8 configured -- resuming normal operations
[Sat Feb 10 14:52:11.651880 2018] [core:notice] [pid 5436] AH00094: Command line: '/usr/sbin/apache2'
[Sat Feb 10 14:54:23.953544 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] mod_wsgi (pid=24134): Exception occurred processing WSGI script '/srv/mediagoblin/mediagoblin/wsgi.py'.
[Sat Feb 10 14:54:24.104184 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] Traceback (most recent call last):
[Sat Feb 10 14:54:24.106037 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/formparser.py", line 110, in wrapper
[Sat Feb 10 14:54:24.106241 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] return f(self, stream, *args, kwargs)
[Sat Feb 10 14:54:24.106581 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/formparser.py", line 222, in _parse_multipart
[Sat Feb 10 14:54:24.106703 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] form, files = parser.parse(stream, boundary, content_length)
[Sat Feb 10 14:54:24.106917 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/formparser.py", line 531, in parse
[Sat Feb 10 14:54:24.107046 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] return self.cls(form), self.cls(files)
[Sat Feb 10 14:54:24.107260 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/datastructures.py", line 409, in init
[Sat Feb 10 14:54:24.107592 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] for key, value in mapping or ():
[Sat Feb 10 14:54:24.107805 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/formparser.py", line 529, in <genexpr>
[Sat Feb 10 14:54:24.107903 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] form = (p[1] for p in formstream if p[0] == 'form')
[Sat Feb 10 14:54:24.108088 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/formparser.py", line 488, in parse_parts
[Sat Feb 10 14:54:24.108314 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] for ellt, ell in self.parse_lines(file, boundary, content_length):
[Sat Feb 10 14:54:24.108751 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/formparser.py", line 400, in parse_lines
[Sat Feb 10 14:54:24.108907 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] terminator = self._find_terminator(iterator)
[Sat Feb 10 14:54:24.109126 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/formparser.py", line 328, in _find_terminator
[Sat Feb 10 14:54:24.109240 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] for line in iterator:
[Sat Feb 10 14:54:24.109481 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/wsgi.py", line 1086, in make_line_iter
[Sat Feb 10 14:54:24.109804 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] first_item = next(_iter, )
[Sat Feb 10 14:54:24.109985 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/wsgi.py", line 1045, in _make_chunk_iter
[Sat Feb 10 14:54:24.110051 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] item = _read(buffer_size)
[Sat Feb 10 14:54:24.110174 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/wsgi.py", line 1307, in read
[Sat Feb 10 14:54:24.110240 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] return self.on_disconnect()
[Sat Feb 10 14:54:24.110391 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/wsgi.py", line 1275, in on_disconnect
[Sat Feb 10 14:54:24.110457 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] raise ClientDisconnected()
[Sat Feb 10 14:54:24.110817 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] werkzeug.exceptions.ClientDisconnected: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.
[Sat Feb 10 14:54:24.111038 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802]
[Sat Feb 10 14:54:24.111104 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] During handling of the above exception, another exception occurred:
[Sat Feb 10 14:54:24.111150 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802]
[Sat Feb 10 14:54:24.111266 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] Traceback (most recent call last):
[Sat Feb 10 14:54:24.112589 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/mediagoblin/app.py", line 342, in call
[Sat Feb 10 14:54:24.112740 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] return self.call_backend(environ, start_response)
[Sat Feb 10 14:54:24.112899 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/wsgi.py", line 766, in call
[Sat Feb 10 14:54:24.112977 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] return self.app(environ, start_response)
[Sat Feb 10 14:54:24.113104 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/mediagoblin/app.py", line 275, in call_backend
[Sat Feb 10 14:54:24.113169 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] with self.gen_context(request) as request:
[Sat Feb 10 14:54:24.113285 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/usr/lib/python3.5/contextlib.py", line 59, in enter
[Sat Feb 10 14:54:24.113473 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] return next(self.gen)
[Sat Feb 10 14:54:24.113849 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/mediagoblin/app.py", line 189, in gen_context
[Sat Feb 10 14:54:24.113941 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] yield self._gen_context(self.db, ctx)
[Sat Feb 10 14:54:24.114074 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/mediagoblin/app.py", line 213, in _gen_context
[Sat Feb 10 14:54:24.114141 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] ctx = self._request_only_gen_context(ctx)
[Sat Feb 10 14:54:24.114306 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/mediagoblin/app.py", line 225, in _request_only_gen_context
[Sat Feb 10 14:54:24.114419 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] request.locale = translate.get_locale_from_request(request)
[Sat Feb 10 14:54:24.114631 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/mediagoblin/tools/translate.py", line 97, in get_locale_from_request
[Sat Feb 10 14:54:24.114711 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] request_args = (request.args, request.form)[request.method=='POST']
[Sat Feb 10 14:54:24.114831 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/utils.py", line 73, in get
[Sat Feb 10 14:54:24.114890 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] value = self.func(obj)
[Sat Feb 10 14:54:24.115003 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/wrappers.py", line 537, in form
[Sat Feb 10 14:54:24.115063 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] self._load_form_data()
[Sat Feb 10 14:54:24.115174 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/wrappers.py", line 385, in _load_form_data
[Sat Feb 10 14:54:24.115234 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] mimetype, content_length, options)
[Sat Feb 10 14:54:24.115520 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/formparser.py", line 205, in parse
[Sat Feb 10 14:54:24.115600 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] content_length, options)
[Sat Feb 10 14:54:24.115731 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/formparser.py", line 114, in wrapper
[Sat Feb 10 14:54:24.115797 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] exhaust()
[Sat Feb 10 14:54:24.115917 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/wsgi.py", line 1289, in exhaust
[Sat Feb 10 14:54:24.115975 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] self.read(chunk)
[Sat Feb 10 14:54:24.116082 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/wsgi.py", line 1307, in read
[Sat Feb 10 14:54:24.116141 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] return self.on_disconnect()
[Sat Feb 10 14:54:24.116247 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] File "/srv/mediagoblin/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/wsgi.py", line 1275, in on_disconnect
[Sat Feb 10 14:54:24.116309 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] raise ClientDisconnected()
[Sat Feb 10 14:54:24.116745 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58802] werkzeug.exceptions.ClientDisconnected: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.
[Sat Feb 10 14:56:07.836569 2018] [wsgi:error] [pid 24134] [remote XXX.XXX.X:58850] WARNING:mediagoblin.auth.tools:Wrong password for 'username'

Change History (5)

comment:1 by ayleph, 7 years ago

Resolution: wontfix
Status: newclosed

Python3 doesn't work with the flup package. If you want to use fastcgi and flup, then please re-create your MediaGoblin installation using python2. If you want to use python3, then you should use (u)wsgi instead of fastcgi/flup.

comment:2 by ayleph, 7 years ago

Resolution: wontfix
Status: closedaccepted

I'm sorry, I made a mistake. I confused this ticket with some errors that I saw in IRC. It looks like you are using wsgi in your current configuration.

I don't have enough information from the stack trace above to see what's wrong though. I can't replicate the issue, so you may have to test configuring it differently to see if you can make it go away.

comment:3 by zoro, 7 years ago

yes I used wsgi as per in the wiki but it still does not work. this is with python3 and I will retry to reinstall using python2 again later

comment:4 by zoro, 7 years ago

you may close this issue since I have migrated to nginx: https://issues.mediagoblin.org/ticket/5561
and has new errors

comment:5 by ayleph, 7 years ago

Resolution: invalid
Status: acceptedclosed

Closing at submitter's request.

Note: See TracTickets for help on using tickets.