Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jumpserver登录返回 500 error #3096

Open
xymsayly opened this issue Aug 8, 2019 · 2 comments

Comments

@xymsayly
Copy link

commented Aug 8, 2019

[简述你的问题]
在按照jumpsever升级文档将jumpserevr从1.3.2升级到了1.5.2之后,点击登录后会返回500错误
在升级到1.4.4的时候测试过,没有任何问题

使用版本

[1.5.2]

问题复现步骤
  1. 升级jumpserver版本到1.4.4
  2. 登录验证测试,一切正常
    3、升级1.5.2,所有组件启动正常
    4、浏览器访问80,可以正常打开登录页面,输入用户名密码,点击登录后,提示“Server error occur, contact administrator”
    5、刷新浏览器也无法再打开登录页面,只是返回“Server error occur, contact administrator”
    6、重启jms服务,可以正常打开登录页面,但登录依旧会返回“Server error occur, contact administrator”
具体表现[截图可能会更好些,最好能截全]

image

其他

jumserver错误信息
2019-08-08 20:24:56 [log ERROR] Internal Server Error: /
Traceback (most recent call last):
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 829, in _resolve_lookup
current = current[bit]
File "/opt/py3/lib/python3.6/site-packages/django/utils/functional.py", line 214, in inner
return func(self._wrapped, *args)
TypeError: 'User' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/py3/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/opt/py3/lib/python3.6/site-packages/django/core/handlers/base.py", line 156, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/opt/py3/lib/python3.6/site-packages/django/core/handlers/base.py", line 154, in _get_response
response = response.render()
File "/opt/py3/lib/python3.6/site-packages/django/template/response.py", line 106, in render
self.content = self.rendered_content
File "/opt/py3/lib/python3.6/site-packages/django/template/response.py", line 83, in rendered_content
content = template.render(context, self._request)
File "/opt/py3/lib/python3.6/site-packages/django/template/backends/django.py", line 61, in render
return self.template.render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 171, in render
return self._render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
return self.nodelist.render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 937, in render
bit = node.render_annotated(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
return self.render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
return compiled_parent._render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
return self.nodelist.render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 937, in render
bit = node.render_annotated(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
return self.render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/loader_tags.py", line 188, in render
return template.render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 173, in render
return self._render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
return self.nodelist.render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 937, in render
bit = node.render_annotated(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
return self.render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/loader_tags.py", line 53, in render
result = self.nodelist.render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 937, in render
bit = node.render_annotated(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
return self.render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/defaulttags.py", line 302, in render
match = condition.eval(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/defaulttags.py", line 875, in eval
return self.value.resolve(context, ignore_failures=True)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 671, in resolve
obj = self.var.resolve(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 796, in resolve
value = self._resolve_lookup(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 837, in _resolve_lookup
current = getattr(current, bit)
File "/opt/py3/lib/python3.6/site-packages/django/utils/functional.py", line 214, in inner
return func(self._wrapped, *args)
File "/opt/jumpserver/apps/users/models/user.py", line 412, in will_expired
if 0 <= self.expired_remain_days < 5:
File "/opt/jumpserver/apps/users/models/user.py", line 407, in expired_remain_days
date_remain = self.date_expired - timezone.now()
TypeError: unsupported operand type(s) for -: 'NoneType' and 'datetime.datetime'
127.0.0.1 [08/Aug/2019:20:24:56 +0800] "GET / HTTP/1.0" 500 180
Connected to redis://127.0.0.1:6379/3
mingle: searching for neighbors
mingle: all alone
Received task: ops.tasks.create_or_update_registered_periodic_tasks[eb040c58-daef-4ffe-a642-dc87c335a286]
Received task: users.tasks.check_password_expired_periodic[d54fd436-6319-4f32-a7f3-4946d790bd2c]
Received task: users.tasks.check_user_expired_periodic[0d8ac982-7b50-4e87-84d4-cc0ac16be8a2]
Received task: terminal.tasks.delete_terminal_status_period[cd3ff41f-5b7a-420f-9c24-543d0b3bbb9a]
Received task: terminal.tasks.clean_orphan_session[6021dc98-78b2-46e1-8a4b-dd46be9f6250]
Scaling up 1 processes.
Received task: terminal.tasks.clean_expired_session_period[6057b8ae-8b60-4cd7-897a-099f707fceac]
Scaling up 1 processes.
Start clean expired session record, commands and replay
Task terminal.tasks.delete_terminal_status_period[cd3ff41f-5b7a-420f-9c24-543d0b3bbb9a] succeeded in 0.33999830599987035s: None
Task users.tasks.check_user_expired_periodic[0d8ac982-7b50-4e87-84d4-cc0ac16be8a2] succeeded in 0.36213389500017s: None
Task users.tasks.check_password_expired_periodic[d54fd436-6319-4f32-a7f3-4946d790bd2c] succeeded in 0.36553026900037366s: None
Task terminal.tasks.clean_orphan_session[6021dc98-78b2-46e1-8a4b-dd46be9f6250] succeeded in 0.1093141490000562s: None
Task terminal.tasks.clean_expired_session_period[6057b8ae-8b60-4cd7-897a-099f707fceac] succeeded in 0.09090278699977716s: None
Task ops.tasks.create_or_update_registered_periodic_tasks[eb040c58-daef-4ffe-a642-dc87c335a286] succeeded in 0.43001964299992324s: None
127.0.0.1 [08/Aug/2019:20:25:00 +0800] "POST /api/terminal/v1/terminal/status/ HTTP/1.1" 201 2
127.0.0.1 [08/Aug/2019:20:25:00 +0800] "GET /api/terminal/v1/terminal/config/ HTTP/1.1" 200 2115
127.0.0.1 [08/Aug/2019:20:25:09 +0800] "POST /api/terminal/v1/terminal/status/ HTTP/1.1" 201 2
2019-08-08 20:25:12 [log ERROR] Internal Server Error: /
Traceback (most recent call last):
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 829, in _resolve_lookup
current = current[bit]
File "/opt/py3/lib/python3.6/site-packages/django/utils/functional.py", line 214, in inner
return func(self._wrapped, *args)
TypeError: 'User' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/py3/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/opt/py3/lib/python3.6/site-packages/django/core/handlers/base.py", line 156, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/opt/py3/lib/python3.6/site-packages/django/core/handlers/base.py", line 154, in _get_response
response = response.render()
File "/opt/py3/lib/python3.6/site-packages/django/template/response.py", line 106, in render
self.content = self.rendered_content
File "/opt/py3/lib/python3.6/site-packages/django/template/response.py", line 83, in rendered_content
content = template.render(context, self._request)
File "/opt/py3/lib/python3.6/site-packages/django/template/backends/django.py", line 61, in render
return self.template.render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 171, in render
return self._render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
return self.nodelist.render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 937, in render
bit = node.render_annotated(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
return self.render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
return compiled_parent._render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
return self.nodelist.render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 937, in render
bit = node.render_annotated(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
return self.render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/loader_tags.py", line 188, in render
return template.render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 173, in render
return self._render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
return self.nodelist.render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 937, in render
bit = node.render_annotated(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
return self.render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/loader_tags.py", line 53, in render
result = self.nodelist.render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 937, in render
bit = node.render_annotated(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
return self.render(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/defaulttags.py", line 302, in render
match = condition.eval(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/defaulttags.py", line 875, in eval
return self.value.resolve(context, ignore_failures=True)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 671, in resolve
obj = self.var.resolve(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 796, in resolve
value = self._resolve_lookup(context)
File "/opt/py3/lib/python3.6/site-packages/django/template/base.py", line 837, in _resolve_lookup
current = getattr(current, bit)
File "/opt/py3/lib/python3.6/site-packages/django/utils/functional.py", line 214, in inner
return func(self._wrapped, *args)
File "/opt/jumpserver/apps/users/models/user.py", line 412, in will_expired
if 0 <= self.expired_remain_days < 5:
File "/opt/jumpserver/apps/users/models/user.py", line 407, in expired_remain_days
date_remain = self.date_expired - timezone.now()
TypeError: unsupported operand type(s) for -: 'NoneType' and 'datetime.datetime'

[注:] 完成后请关闭 issue

@BaiJiangJie

This comment has been minimized.

Copy link
Member

commented Aug 9, 2019

所有用户都登录失败还是只有某个用户?

@xymsayly

This comment has been minimized.

Copy link
Author

commented Aug 10, 2019

多谢你的这个思路,我尝试新建了一个管理员,然后可以成功登录,原admin登录会报“server error”,w我尝试修改了原admin的密码,但登录还是报错,能否告知造成这个问题的原因以及解决办法@BaiJiangJie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.