Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

"Error closing session", because it's deleted in many places #5159

Open
etam opened this issue Apr 10, 2020 · 1 comment
Open

"Error closing session", because it's deleted in many places #5159

etam opened this issue Apr 10, 2020 · 1 comment
Labels
bug P3 Severity-Low/Effort-hard

Comments

@etam
Copy link
Contributor

etam commented Apr 10, 2020

Description

Golem Version: 0.23.0

OS: Linux

Description of the issue:

Introduced by #4111

TaskServer:

    def disconnect(self):
        for node_id in list(self.sessions):
            try:
                task_session = self.sessions[node_id]
                if task_session is None:
                    # Pending connection
                    continue
                task_session.dropped()
                del self.sessions[node_id]
            except Exception as exc:  # pylint: disable=broad-except
                logger.error("Error closing session: %r", exc)

TaskSession:

    def dropped(self):
        """ Close connection """
        BasicSafeSession.dropped(self)
        self.task_server.remove_session_by_node_id(self.key_id)

TaskMessagesQueueMixin (which is used by TaskServer):

    def disconnect(self):
        for node_id in list(self.sessions):
            try:
                task_session = self.sessions[node_id]
                if task_session is None:
                    # Pending connection
                    continue
                task_session.dropped()
                del self.sessions[node_id]
            except Exception as exc:  # pylint: disable=broad-except
                logger.error("Error closing session: %r", exc)

In conclusion: del self.sessions[node_id] is called twice.

Actual result:

2020-04-10 13:28:30 INFO     golem.client                        Pausing ...
2020-04-10 13:28:30 DEBUG    golem.client                        Pausing p2pservice
2020-04-10 13:28:30 DEBUG    golem.client                        Pausing task_server
2020-04-10 13:28:30 ERROR    golem.task.taskserver               Error closing session: KeyError('a999f986fb67344b94abdfd9b50ce53cc64ba6d4ebfab71968b5d15b7817402c132d7cdf2627c578b309260e4df74cc4be55a437d03233026d522e149ffe9915',)
2020-04-10 13:28:30 INFO     golem.client                        Paused

Steps To Reproduce

  1. Have a node being a provider and computing something
  2. send rpc "ui.stop"

Expected behavior

No errors.

@etam etam added bug brass P3 Severity-Low/Effort-hard labels Apr 10, 2020
@etam
Copy link
Contributor Author

etam commented Apr 10, 2020

It's a bit similar to #4409 #4836

@badb badb removed the brass label Jun 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug P3 Severity-Low/Effort-hard
Projects
None yet
Development

No branches or pull requests

2 participants