SESSION_TYPE as described here https://docs.pagure.org/pagure/configuration.html#session-type should default to None but that produces traceback as follows for us:
2018-12-02 13:56:51,797 [ERROR] flask.app: Request finalizing failed with an error while handling an error Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/flask/app.py", line 2292, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python3.7/site-packages/flask/app.py", line 1816, in full_dispatch_request return self.finalize_request(rv) File "/usr/lib/python3.7/site-packages/flask/app.py", line 1833, in finalize_request response = self.process_response(response) File "/usr/lib/python3.7/site-packages/flask/app.py", line 2114, in process_response self.session_interface.save_session(self, ctx.session, response) File "/usr/lib/python3.7/site-packages/flask/sessions.py", line 375, in save_session val = self.get_signing_serializer(app).dumps(dict(session)) File "/usr/lib/python3.7/site-packages/itsdangerous.py", line 565, in dumps payload = want_bytes(self.dump_payload(obj)) File "/usr/lib/python3.7/site-packages/itsdangerous.py", line 847, in dump_payload json = super(URLSafeSerializerMixin, self).dump_payload(obj) File "/usr/lib/python3.7/site-packages/itsdangerous.py", line 550, in dump_payload return want_bytes(self.serializer.dumps(obj)) File "/usr/lib/python3.7/site-packages/flask/json/tag.py", line 296, in dumps return dumps(self.tag(value), separators=(',', ':')) File "/usr/lib/python3.7/site-packages/flask/json/__init__.py", line 179, in dumps rv = _json.dumps(obj, **kwargs) File "/usr/lib64/python3.7/json/__init__.py", line 238, in dumps **kw).encode(obj) File "/usr/lib64/python3.7/json/encoder.py", line 199, in encode chunks = self.iterencode(o, _one_shot=True) File "/usr/lib64/python3.7/json/encoder.py", line 257, in iterencode return _iterencode(o, 0) File "/usr/lib/python3.7/site-packages/flask/json/__init__.py", line 81, in default return _json.JSONEncoder.default(self, o) File "/usr/lib64/python3.7/json/encoder.py", line 179, in default raise TypeError(f'Object of type {o.__class__.__name__} ' TypeError: Object of type frozenset is not JSON serializable During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/flask/app.py", line 1833, in finalize_request response = self.process_response(response) File "/usr/lib/python3.7/site-packages/flask/app.py", line 2114, in process_response self.session_interface.save_session(self, ctx.session, response) File "/usr/lib/python3.7/site-packages/flask/sessions.py", line 375, in save_session val = self.get_signing_serializer(app).dumps(dict(session)) File "/usr/lib/python3.7/site-packages/itsdangerous.py", line 565, in dumps payload = want_bytes(self.dump_payload(obj)) File "/usr/lib/python3.7/site-packages/itsdangerous.py", line 847, in dump_payload json = super(URLSafeSerializerMixin, self).dump_payload(obj) File "/usr/lib/python3.7/site-packages/itsdangerous.py", line 550, in dump_payload return want_bytes(self.serializer.dumps(obj)) File "/usr/lib/python3.7/site-packages/flask/json/tag.py", line 296, in dumps return dumps(self.tag(value), separators=(',', ':')) File "/usr/lib/python3.7/site-packages/flask/json/__init__.py", line 179, in dumps rv = _json.dumps(obj, **kwargs) File "/usr/lib64/python3.7/json/__init__.py", line 238, in dumps **kw).encode(obj) File "/usr/lib64/python3.7/json/encoder.py", line 199, in encode chunks = self.iterencode(o, _one_shot=True) File "/usr/lib64/python3.7/json/encoder.py", line 257, in iterencode return _iterencode(o, 0) File "/usr/lib/python3.7/site-packages/flask/json/__init__.py", line 81, in default return _json.JSONEncoder.default(self, o) File "/usr/lib64/python3.7/json/encoder.py", line 179, in default raise TypeError(f'Object of type {o.__class__.__name__} ' TypeError: Object of type frozenset is not JSON serializable
Using pagure-5.1.3-1.fc29.noarch from Fedora 29
We were able to work this around by using
SESSION_TYPE = 'redis' SESSION_USE_SIGNER = True SESSION_PERMANENT = True SESSION_REDIS = None
However please pay close attention following statement as SESSION_TYPE should be an redis object passed to Flask-Session
SESSION_REDIS = None
From Flask-Session-0.3.1-1.noarch /usr/lib/python3.7/site-packages/flask_session/sessions.py
def __init__(self, redis, key_prefix, use_signer=False, permanent=True): if redis is None: from redis import Redis redis = Redis() self.redis = redis
This expects that a Redis() instance is passed, therefore we define SESSION_REDIS as our redis instance runs on the default 127.0.0.1:6379
Please fix the documentation and the interface. We would rather like to define the address for the redis in the config.
Also please package Flask-Session for Fedora
Well, we point to the documentation for flask-session which is I think the best thing to do, the chances that our documentation gets out of sync with upstream's is really high while they should keep their documentation up to date. And said documentation: https://pythonhosted.org/Flask-Session/#configuration clearly mention that: SESSION_TYPE can be redis: RedisSessionInterface and SESSION_REDIS should be: A redis.Redis instance, default connect to 127.0.0.1:6379.
SESSION_TYPE
redis: RedisSessionInterface
SESSION_REDIS
A redis.Redis instance, default connect to 127.0.0.1:6379
I am more annoyed about the frozenset error you've faced. Which auth are you using? (if not local, using which provider?)
Thanks for your reports :)
We are using openid with ipsilon which i understand is the fas-implementation.
PAGURE_AUTH = 'openid' FAS_OPENID_ENDPOINT = 'https://ipsilon.somedomain.tld/idp/openid/'
hm, running pagure on a python 3.6.6 (f27), I'm not able to reproduce this frozenset error. Time to upgrade I guess :)
@kordex sorry it took me so long to come back to you on this, but do you still see the issue?
Hi pingou,
We have not upgraded since, so can't say. With the changes described, we don't see the isssue.
-kordex
On Mon, Apr 8, 2019 at 4:03 PM Pierre-YvesChibon pagure@pagure.io wrote:
pingou added a new comment to an issue you are following: @kordex sorry it took me so long to come back to you on this, but do you still see the issue? To reply, visit the link below or just reply to this email https://pagure.io/pagure/issue/4088
pingou added a new comment to an issue you are following: @kordex sorry it took me so long to come back to you on this, but do you still see the issue?
To reply, visit the link below or just reply to this email https://pagure.io/pagure/issue/4088