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

log wiever not wirking in 2.0.0 #29

Open
devopstales opened this issue Jun 7, 2023 · 2 comments
Open

log wiever not wirking in 2.0.0 #29

devopstales opened this issue Jun 7, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@devopstales
Copy link
Owner

devopstales commented Jun 7, 2023

[2023-06-07 09:38:11,233] kubedash        ERROR Exception on /pods/logs [POST]
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask_login/utils.py", line 290, in decorated_view
    return current_app.ensure_sync(func)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/kubedash/functions/routes.py", line 1132, in pods_logs
    po_name=session['po_name'],
           ~~~~~~~^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/sessions.py", line 79, in __getitem__
    return super().__getitem__(key)
           ^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'po_name'
[2023-06-07 09:53:45 +0200] [34] [ERROR] Error handling request /socket.io/?EIO=4&transport=websocket&sid=HgeztAtqvJOF9LniAAAM
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/gthread.py", line 271, in handle
    keepalive = self.handle_request(req, conn)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/gthread.py", line 323, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 2213, in __call__
    return self.wsgi_app(environ, start_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask_socketio/__init__.py", line 43, in __call__
    return super(_SocketIOMiddleware, self).__call__(environ,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/engineio/middleware.py", line 63, in __call__
    return self.engineio_app.handle_request(environ, start_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/socketio/server.py", line 607, in handle_request
    return self.eio.handle_request(environ, start_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/engineio/server.py", line 408, in handle_request
    socket = self._get_socket(sid)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/engineio/server.py", line 637, in _get_socket
    raise KeyError('Session is disconnected')
KeyError: 'Session is disconnected'
[2023-06-07 09:57:10 +0200] [25] [ERROR] Socket error processing request.
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/gthread.py", line 271, in handle
    keepalive = self.handle_request(req, conn)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/gthread.py", line 343, in handle_request
    util.reraise(*sys.exc_info())
  File "/usr/local/lib/python3.11/site-packages/gunicorn/util.py", line 626, in reraise
    raise value
  File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/gthread.py", line 329, in handle_request
    resp.write(item)
  File "/usr/local/lib/python3.11/site-packages/gunicorn/http/wsgi.py", line 326, in write
    self.send_headers()
  File "/usr/local/lib/python3.11/site-packages/gunicorn/http/wsgi.py", line 322, in send_headers
    util.write(self.sock, util.to_bytestring(header_str, "latin-1"))
  File "/usr/local/lib/python3.11/site-packages/gunicorn/util.py", line 287, in write
    sock.sendall(data)
OSError: [Errno 9] Bad file descriptor
@devopstales devopstales added the bug Something isn't working label Jun 7, 2023
@devopstales
Copy link
Owner Author

After upgrade the ingress for the websocket with this:

metadata:
 annotations:
  kubernetes.io/ingress.class: nginx
  nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
  nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
  nginx.ingress.kubernetes.io/server-snippets: |
    location / {
      proxy_set_header Upgrade $http_upgrade;
      proxy_http_version 1.1;
      proxy_set_header X-Forwarded-Host $http_host;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header X-Forwarded-For $remote_addr;
      proxy_set_header Host $host;
      proxy_set_header Connection "upgrade";
      proxy_cache_bypass $http_upgrade;
    }

I get the fallowing error in SSO user:

Exception in thread Thread-15 (k8sPodLogsStream):
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.11/threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "/code/kubedash/functions/k8s.py", line 1422, in k8sPodLogsStream
    k8sClientConfigGet(username_role, user_token)
  File "/code/kubedash/functions/k8s.py", line 225, in k8sClientConfigGet
    k8sConfig = k8sServerConfigGet()
                ^^^^^^^^^^^^^^^^^^^^
  File "/code/kubedash/functions/k8s.py", line 46, in k8sServerConfigGet
    k8s_config_list = k8sConfig.query.get(1)
                      ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask_sqlalchemy/model.py", line 31, in __get__
    cls, session=cls.__fsa__.session()  # type: ignore[arg-type]
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/orm/scoping.py", line 218, in __call__
    sess = self.registry()
           ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/util/_collections.py", line 640, in __call__
    key = self.scopefunc()
          ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask_sqlalchemy/session.py", line 102, in _app_ctx_id
    return id(app_ctx._get_current_object())  # type: ignore[attr-defined]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/werkzeug/local.py", line 508, in _get_current_object
    raise RuntimeError(unbound_message) from None
RuntimeError: Working outside of application context.

This typically means that you attempted to use functionality that needed
the current application. To solve this, set up an application context
with app.app_context(). See the documentation for more information.

@devopstales
Copy link
Owner Author

Same problem as in #28. The main cause of this is the usage of gunicorn and a bug in gunicprn that has been fixed in benoitc/gunicorn#2828 and benoitc/gunicorn#2581 but not yet been release.

devopstales added a commit that referenced this issue Jun 17, 2023
Signed-off-by: devopstales <42894256+devopstales@users.noreply.github.com>
devopstales added a commit that referenced this issue Jun 17, 2023
Signed-off-by: devopstales <42894256+devopstales@users.noreply.github.com>
devopstales added a commit that referenced this issue Jul 2, 2023
@devopstales devopstales reopened this Feb 24, 2024
devopstales added a commit that referenced this issue Apr 25, 2024
Signed-off-by: devopstales <42894256+devopstales@users.noreply.github.com>
devopstales added a commit that referenced this issue Apr 25, 2024
Signed-off-by: devopstales <42894256+devopstales@users.noreply.github.com>
devopstales added a commit that referenced this issue Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant