ging / fiware-idm-deprecated

DEPRECATED - Identity Manager - Keyrock
Apache License 2.0
18 stars 25 forks source link

Error 500 on deleting applications / organizations #35

Closed DerJayDee closed 8 years ago

DerJayDee commented 8 years ago

Upon trying to delete an organization or application I receive Error: An unexpected error prevented the server from fulfilling your request. (HTTP 500) in the webfrontend. The server log from horizon only shows this:

[Mon Jan 18 09:32:00.780732 2016] [wsgi:error] [pid 1400:tid 140235117197056] DEBUG:idm_logger:
[Mon Jan 18 09:32:00.964110 2016] [wsgi:error] [pid 1400:tid 140235117197056] Recoverable error: An unexpected error prevented the server from fulfilling your request. (HTTP 500)
[Mon Jan 18 10:32:01.048462 2016] [deflate:debug] [pid 1402:tid 140235125589760] mod_deflate.c(855): [client 172.30.20.5:53643] AH01384: Zlib: Compressed 17420 to 4423 : URL /idm/myApplications/20cdba76ee974f3c86f058bd2492fac6/edit/cancel/, referer: http://<horizon root url>/idm/myApplications/20cdba76ee974f3c86f058bd2492fac6/edit/

The keystone log shows this:

2016-01-18 10:32:00.799 1052 ERROR keystone.common.wsgi [-] 'ascii' codec can't decode byte 0xc3 in position 46: ordinal not in range(128)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi Traceback (most recent call last):
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/keystone/common/wsgi.py", line 224, in __call__
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     result = method(context, **params)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/keystone/common/controller.py", line 157, in inner
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     return f(self, context, *args, **kwargs)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/keystone/contrib/oauth2/controllers.py", line 77, in delete_consumer
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     self.oauth2_api.delete_consumer(consumer_id)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/keystone/notifications.py", line 112, in wrapper
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     result = f(*args, **kwargs)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/keystone/contrib/oauth2/core.py", line 135, in delete_consumer
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     ret_val = self.driver.delete_consumer(consumer_id)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/keystone/contrib/oauth2/backends/sql.py", line 153, in delete_consumer
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     self._delete_consumer(session, consumer_id)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 483, in __exit__
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     self.rollback()
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/.venv/local/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     compat.reraise(exc_type, exc_value, exc_tb)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 480, in __exit__
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     self.commit()
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 385, in commit
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     self._prepare_impl()
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 365, in _prepare_impl
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     self.session.flush()
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 1986, in flush
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     self._flush(objects)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2104, in _flush
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     transaction.rollback(_capture_exception=True)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/.venv/local/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     compat.reraise(exc_type, exc_value, exc_tb)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2068, in _flush
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     flush_context.execute()
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 372, in execute
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     rec.execute(self)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 555, in execute
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     uow
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 118, in delete_obj
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     cached_connections, mapper, table, delete)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 695, in _emit_delete_statements
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     c = connection.execute(statement, del_objects)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/.venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 841, in execute
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     return meth(self, multiparams, params)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/.venv/local/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 322, in _execute_on_connection
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     return connection._execute_clauseelement(self, multiparams, params)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/.venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 938, in _execute_clauseelement
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     compiled_sql, distilled_params
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/.venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1070, in _execute_context
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     context)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/.venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1267, in _handle_dbapi_exception
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     util.raise_from_cause(newraise, exc_info)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/.venv/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     reraise(type(exception), exception, tb=exc_tb)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/.venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1063, in _execute_context
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     context)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi   File "/opt/keystone/.venv/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 442, in do_execute
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi     cursor.execute(statement, parameters)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 46: ordinal not in range(128)
2016-01-18 10:32:00.799 1052 TRACE keystone.common.wsgi 
2016-01-18 10:32:00.964 1052 INFO eventlet.wsgi.server [-] 192.168.149.9 - - [18/Jan/2016 10:32:00] "DELETE /v3/OS-OAUTH2/consumers/20cdba76ee974f3c86f058bd2492fac6 HTTP/1.1" 500 315 0.174516

I believe it comes from the "OS-AUTH2" in the DELETE URL but I don't know where to change this and to what it should get changed.

Looking forward to your help!

garcianavalon commented 8 years ago

@DerJayDee Which database are you using? What is the encoding?

DerJayDee commented 8 years ago

@garcianavalon I am using PostgreSQL 9.4 with UTF8 encoding.

garcianavalon commented 8 years ago

@DerJayDee I've never tried the IdM with Postgre, let me set up a database and make some tests

federicofdez commented 8 years ago

@DerJayDee Looks like your issue might be caused by some migrations not being compatible with PostgreSQL. This has just been fixed in ging/keystone@7da815bb3f7f3ba3b4aff85f83638fbfa05e38e0 and will be merged within the next weeks. You can cherry-pick this commit in the meantime.

You will also have to apply the new migrations, by running the following commands:

sudo tools/with_venv.sh bin/keystone-manage db_sync --extension=oauth2
sudo tools/with_venv.sh bin/keystone-manage db_sync --extension=roles

Hope this solves your issue! If not, feel free to reopen it again.