Project

General

Profile

Support #5516

Cannot log into RhodeCode

Added by Thierry Wynsdau 7 months ago. Updated 6 months ago.

Status:
New
Priority:
High
Category:
-
Target version:
Start date:
26.11.2018
Due date:
% Done:

0%

Estimated time:
Sorting:
Commit Number:
Affected Version:

Description

When trying to connect with his admin account the user receive the following error message :
00 Internal Server Error | The server has either erred or is incapable of performing the requested operation.

Only this user is impacted. No other user reported any trouble.

From the log on the machine (/home/rcserver/.rccontrol/enterprise-1/enterprise.log), I can see this stacktrace:
Code:

2018-11-26 10:45:30.039 ERROR [rhodecode.config.middleware] error occurred handling this request for path: /
Traceback (most recent call last):
File "/opt/rhodecode/store/044m67rkz9sqqc4w8v45i97lxls99qgm-python2.7-pyramid-1.9.1/lib/python2.7/site-packages/pyramid/tweens.py", line 39, in excview_tween
response = handler(request)
File "/opt/rhodecode/store/044m67rkz9sqqc4w8v45i97lxls99qgm-python2.7-pyramid-1.9.1/lib/python2.7/site-packages/pyramid/router.py", line 156, in handle_request
view_name
File "/opt/rhodecode/store/044m67rkz9sqqc4w8v45i97lxls99qgm-python2.7-pyramid-1.9.1/lib/python2.7/site-packages/pyramid/view.py", line 642, in call_view
response = view_callable(context, request)
File "/opt/rhodecode/store/044m67rkz9sqqc4w8v45i97lxls99qgm-python2.7-pyramid-1.9.1/lib/python2.7/site-packages/pyramid/viewderivers.py", line 390, in attr_view
return view(context, request)
File "/opt/rhodecode/store/044m67rkz9sqqc4w8v45i97lxls99qgm-python2.7-pyramid-1.9.1/lib/python2.7/site-packages/pyramid/viewderivers.py", line 368, in predicate_wrapper
return view(context, request)
File "/opt/rhodecode/store/044m67rkz9sqqc4w8v45i97lxls99qgm-python2.7-pyramid-1.9.1/lib/python2.7/site-packages/pyramid/viewderivers.py", line 462, in rendered_view
request, result, view_inst, context)
File "/opt/rhodecode/store/044m67rkz9sqqc4w8v45i97lxls99qgm-python2.7-pyramid-1.9.1/lib/python2.7/site-packages/pyramid/renderers.py", line 435, in render_view
return self.render_to_response(response, system, request=request)
File "/opt/rhodecode/store/044m67rkz9sqqc4w8v45i97lxls99qgm-python2.7-pyramid-1.9.1/lib/python2.7/site-packages/pyramid/renderers.py", line 458, in render_to_response
result = self.render(value, system_values, request=request)
File "/opt/rhodecode/store/044m67rkz9sqqc4w8v45i97lxls99qgm-python2.7-pyramid-1.9.1/lib/python2.7/site-packages/pyramid/renderers.py", line 454, in render
result = renderer(value, system_values)
File "/opt/rhodecode/store/q714q7bvxr69znv06pv1x0li3hjacpvk-python2.7-pyramid-mako-1.0.2/lib/python2.7/site-packages/pyramid_mako/
init.py", line 156, in __call_
reraise(MakoRenderingException(errtext), None, exc_info[2])
File "/opt/rhodecode/store/q714q7bvxr69znv06pv1x0li3hjacpvk-python2.7-pyramid-mako-1.0.2/lib/python2.7/site-packages/pyramid_mako/init.py", line 148, in call
result = template.render_unicode(*system)
File "/opt/rhodecode/store/bgrkjwf42qjkc1f7b56qsr2ab4ikgwjg-python2.7-Mako-1.0.7/lib/python2.7/site-packages/mako/template.py", line 471, in render_unicode
as_unicode=True)
File "/opt/rhodecode/store/bgrkjwf42qjkc1f7b56qsr2ab4ikgwjg-python2.7-Mako-1.0.7/lib/python2.7/site-packages/mako/runtime.py", line 838, in _render
*
kwargs_for_callable(callable, data))
File "/opt/rhodecode/store/bgrkjwf42qjkc1f7b56qsr2ab4ikgwjg-python2.7-Mako-1.0.7/lib/python2.7/site-packages/mako/runtime.py", line 873, in render_context
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
File "/opt/rhodecode/store/bgrkjwf42qjkc1f7b56qsr2ab4ikgwjg-python2.7-Mako-1.0.7/lib/python2.7/site-packages/mako/runtime.py", line 899, in _exec_template
callable
(context, *args, **kwargs)
File "_base_root_mako", line 96, in render_body
File "_base_base_mako", line 50, in render_body
File "rhodecode_templates_index_mako", line 47, in render_menu_bar_nav
File "_base_base_mako", line 246, in render_menu_items
File "_base_base_mako", line 158, in usermenu
File "_base_base_mako", line 654, in render_usermenu
File "/opt/rhodecode/store/z6rzdjhgcsqvbvv2vzdy5hnq5ppj81yy-python2.7-rhodecode-enterprise-ce-4.11.1/lib/python2.7/site-packages/rhodecode/lib/auth.py", line 1219, in personal_repo_group
return RepoGroup.get_user_personal_repo_group(self.user_id)
File "/opt/rhodecode/store/z6rzdjhgcsqvbvv2vzdy5hnq5ppj81yy-python2.7-rhodecode-enterprise-ce-4.11.1/lib/python2.7/site-packages/rhodecode/model/db.py", line 2408, in get_user_personal_repo_group
.filter(cls.user == user).scalar()
File "/opt/rhodecode/store/knphb4bx7g4ps5qnnb68cnsflphqb488-python2.7-SQLAlchemy-1.1.15/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2843, in scalar
ret = self.one()
File "/opt/rhodecode/store/knphb4bx7g4ps5qnnb68cnsflphqb488-python2.7-SQLAlchemy-1.1.15/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2817, in one
"Multiple rows were found for one()")
MakoRenderingException:

Traceback (most recent call last):
File "/opt/rhodecode/store/q714q7bvxr69znv06pv1x0li3hjacpvk-python2.7-pyramid-mako-1.0.2/lib/python2.7/site-packages/pyramid_mako/init.py", line 148, in call
result = template.render_unicode(*system)
File "/opt/rhodecode/store/bgrkjwf42qjkc1f7b56qsr2ab4ikgwjg-python2.7-Mako-1.0.7/lib/python2.7/site-packages/mako/template.py", line 471, in render_unicode
as_unicode=True)
File "/opt/rhodecode/store/bgrkjwf42qjkc1f7b56qsr2ab4ikgwjg-python2.7-Mako-1.0.7/lib/python2.7/site-packages/mako/runtime.py", line 838, in _render
*
kwargs_for_callable(callable, data))
File "/opt/rhodecode/store/bgrkjwf42qjkc1f7b56qsr2ab4ikgwjg-python2.7-Mako-1.0.7/lib/python2.7/site-packages/mako/runtime.py", line 873, in render_context
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
File "/opt/rhodecode/store/bgrkjwf42qjkc1f7b56qsr2ab4ikgwjg-python2.7-Mako-1.0.7/lib/python2.7/site-packages/mako/runtime.py", line 899, in _exec_template
callable
(context, *args, **kwargs)
File "/opt/rhodecode/store/z6rzdjhgcsqvbvv2vzdy5hnq5ppj81yy-python2.7-rhodecode-enterprise-ce-4.11.1/lib/python2.7/site-packages/rhodecode/templates/base/root.mako", line 179, in render_body
${next.body()}
File "/opt/rhodecode/store/z6rzdjhgcsqvbvv2vzdy5hnq5ppj81yy-python2.7-rhodecode-enterprise-ce-4.11.1/lib/python2.7/site-packages/rhodecode/templates/base/base.mako", line 19, in render_body
${self.menu_bar_nav()}
File "/opt/rhodecode/store/z6rzdjhgcsqvbvv2vzdy5hnq5ppj81yy-python2.7-rhodecode-enterprise-ce-4.11.1/lib/python2.7/site-packages/rhodecode/templates/index.mako", line 14, in render_menu_bar_nav
${self.menu_items(active='repositories')}
File "/opt/rhodecode/store/z6rzdjhgcsqvbvv2vzdy5hnq5ppj81yy-python2.7-rhodecode-enterprise-ce-4.11.1/lib/python2.7/site-packages/rhodecode/templates/index.mako", line 441, in render_menu_items
${usermenu(active=(active=='my_account'))}
File "/opt/rhodecode/store/z6rzdjhgcsqvbvv2vzdy5hnq5ppj81yy-python2.7-rhodecode-enterprise-ce-4.11.1/lib/python2.7/site-packages/rhodecode/templates/index.mako", line 379, in usermenu
<%def name="menu_items(active=None)">
File "/opt/rhodecode/store/z6rzdjhgcsqvbvv2vzdy5hnq5ppj81yy-python2.7-rhodecode-enterprise-ce-4.11.1/lib/python2.7/site-packages/rhodecode/templates/index.mako", line 358, in render_usermenu
% if c.rhodecode_user.personal_repo_group:
File "/opt/rhodecode/store/z6rzdjhgcsqvbvv2vzdy5hnq5ppj81yy-python2.7-rhodecode-enterprise-ce-4.11.1/lib/python2.7/site-packages/rhodecode/lib/auth.py", line 1219, in personal_repo_group
return RepoGroup.get_user_personal_repo_group(self.user_id)
File "/opt/rhodecode/store/z6rzdjhgcsqvbvv2vzdy5hnq5ppj81yy-python2.7-rhodecode-enterprise-ce-4.11.1/lib/python2.7/site-packages/rhodecode/model/db.py", line 2408, in get_user_personal_repo_group
.filter(cls.user == user).scalar()
File "/opt/rhodecode/store/knphb4bx7g4ps5qnnb68cnsflphqb488-python2.7-SQLAlchemy-1.1.15/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2843, in scalar
ret = self.one()
File "/opt/rhodecode/store/knphb4bx7g4ps5qnnb68cnsflphqb488-python2.7-SQLAlchemy-1.1.15/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2817, in one
"Multiple rows were found for one()")
MultipleResultsFound: Multiple rows were found for one()

2018-11-26 10:45:30.064 INFO [rhodecode.lib.middleware.request_wrapper] IP: 192.168.12.189 Request to / time: 2.375s [Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299]
2018-11-26 10:45:30.758 INFO [rhodecode.lib.auth] user authenticating with:AUTH_TOKEN_AUTH IS authenticated on func RepoSummaryView:repo_refs_data
2018-11-26 10:45:31.699 INFO [rhodecode.lib.middleware.request_wrapper] IP: 192.168.14.116 Request to /infrastructure/hgutils/refs-data time: 2.825s [Python-urllib/2.7]
2018-11-26 10:45:31.890 INFO [rhodecode.lib.middleware.request_wrapper] IP: 43.22.110.32 Request to /infrastructure/hgutils/refs-data time: 2.063s [Python-urllib/2.7]
C
rcadmin@SK-SCM:/home/rcserver/.rccontrol/enterprise-1$

History

#1 Updated by Daniel D 7 months ago

Hi Thierry,

This is a known problem in RhodeCode pre 4.13 releases. It's an artifact of single user having more than 1 personal repository group. There was a broken mechanism in older releases that when a user was removed his personal repository groups were connected to first super admin, because of ownership transfer. Because the error was to retain personal flag this could cause that one user had more than 1 personal repository group.

This can be easily fixed by Turning off the personal flag on affected users repository groups. We recommend using ishell interface for this:

example:

rccontrol ishell enterprise-1
# show which groups are personal for an user

In [1]:RepoGroup.query().filter(RepoGroup.user==User.get_by_username('some_username')).filter(RepoGroup.personal==True).all()

# Disconnect personal flag for choosen group, 3 is repo group id visible from the first query
In [2]: repo_group = RepoGroup.get(3)

In [6]: repo_group.personal= False

In [7]: Session().add(repo_group);Session().commit()

That should fix this problem.

#2 Updated by Daniel D 7 months ago

Hi,

Probably rccontrol isn't linked via your shell, normally installer does, not sure why that isn't the case here, but you can run the binary manually via:

~/.rccontrol-profile/bin/rccontrol

Unless you used different installation path, this should be located in the home directory of user who was used to install RhodeCode.

Best,

#3 Updated by Daniel D 7 months ago

Please try to find the rccontrol-profile inside you machine that runs rhodecode.

You can use this command:

find / -type l -name '.rccontrol-profile'

Once that is known you can run .rccontrol-profile/bin/rccontrol binary.

#4 Updated by Daniel D 7 months ago

Hi Thierry,

the in [1] returns a list of all connected repository groups. You have to repeat the operation 2,6,7 for each group in that list, changing the 3 to the id of group you want to mark as non-personal.

To make it faster you can do this:

for group_id in [ID1, ID2]:
    repo_group = RepoGroup.get(group_id)
    repo_group.personal= False
    Session().add(repo_group);Session().commit()

the ID1, ID2 etc should be id of the groups you think was wrongly set. Ideally, a single repository group should be left for this user.

Means if the in [1] command gave you 5 results, you should disconnect 4 groups.
Probably you could figure out which was should be left from it's name (the one that should stay most probably will contain user username).

Hope that is clear now.

#5 Updated by Marcin Kuzminski [staff] 6 months ago

Can we close this ticket ?

Also available in: Atom PDF