)]}'
{"releasenotes/notes/fix-to-close-session-on-dealloc-c3687d4dcb1441b8.yaml":[{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"81cf843ffaa4591dc025f13bf5434914d4fc48be","unresolved":false,"context_lines":[{"line_number":1,"context_line":"---"},{"line_number":2,"context_line":"fixes:"},{"line_number":3,"context_line":"  - |"},{"line_number":4,"context_line":"    Try to terminate authenticated Redfish session at BMC Session Service on"},{"line_number":5,"context_line":"    the event of ``Sushy`` object deallocation. This should reduce the chance"},{"line_number":6,"context_line":"    of authenticated sessions pool exhaustion at some BMCs."}],"source_content_type":"text/x-yaml","patch_set":1,"id":"3f79a3b5_f708642e","line":4,"updated":"2018-11-12 11:21:50.000000000","message":"s/Try/Tries/","commit_id":"824f691415927b059ee7ed365b2c1c819285cc54"},{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"be314bce33179f04c9d2c0f21bb8932a6ec1a2d8","unresolved":false,"context_lines":[{"line_number":1,"context_line":"---"},{"line_number":2,"context_line":"fixes:"},{"line_number":3,"context_line":"  - |"},{"line_number":4,"context_line":"    Try to terminate authenticated Redfish session at BMC Session Service on"},{"line_number":5,"context_line":"    the event of ``Sushy`` object deallocation. This should reduce the chance"},{"line_number":6,"context_line":"    of authenticated sessions pool exhaustion at some BMCs."}],"source_content_type":"text/x-yaml","patch_set":1,"id":"3f79a3b5_1f6736ee","line":4,"in_reply_to":"3f79a3b5_f708642e","updated":"2018-11-12 13:10:35.000000000","message":"Done","commit_id":"824f691415927b059ee7ed365b2c1c819285cc54"}],"sushy/main.py":[{"author":{"_account_id":16635,"name":"deray","email":"debayan.ray@gmail.com","username":"deray"},"change_message_id":"7671e3f5834724b4651a1c8f70745665616c3152","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        self._auth.set_context(self, self._conn)"},{"line_number":115,"context_line":"        self._auth.authenticate()"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    def __del__(self):"},{"line_number":118,"context_line":"        if self._auth:"},{"line_number":119,"context_line":"            self._auth.close()"},{"line_number":120,"context_line":"            self._auth \u003d None"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_ebdd95de","line":117,"range":{"start_line":117,"start_character":4,"end_line":117,"end_character":22},"updated":"2018-11-02 07:19:33.000000000","message":"If I am not wrong, this will get triggered when Sushy object is gc\u0027ed. When do you think that this may happen? I doubt at the end of this block [1] as this Sushy instance is referred in Auth [2] and Auth object has a cyclic reference to Connector object and this Connector object is never out of scope. Let me know what I am missing here.\n\n[1] https://github.com/openstack/ironic/blob/master/ironic/drivers/modules/redfish/utils.py#L169-L176\n[2] https://github.com/openstack/sushy/blob/master/sushy/main.py#L114","commit_id":"824f691415927b059ee7ed365b2c1c819285cc54"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"81cf843ffaa4591dc025f13bf5434914d4fc48be","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        self._auth.set_context(self, self._conn)"},{"line_number":115,"context_line":"        self._auth.authenticate()"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    def __del__(self):"},{"line_number":118,"context_line":"        if self._auth:"},{"line_number":119,"context_line":"            self._auth.close()"},{"line_number":120,"context_line":"            self._auth \u003d None"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_17040018","line":117,"updated":"2018-11-12 11:21:50.000000000","message":"Seems to work: http://paste.openstack.org/show/734687/","commit_id":"824f691415927b059ee7ed365b2c1c819285cc54"},{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"be314bce33179f04c9d2c0f21bb8932a6ec1a2d8","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        self._auth.set_context(self, self._conn)"},{"line_number":115,"context_line":"        self._auth.authenticate()"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    def __del__(self):"},{"line_number":118,"context_line":"        if self._auth:"},{"line_number":119,"context_line":"            self._auth.close()"},{"line_number":120,"context_line":"            self._auth \u003d None"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_ffa4ba06","line":117,"in_reply_to":"3f79a3b5_17040018","updated":"2018-11-12 13:10:35.000000000","message":"Done","commit_id":"824f691415927b059ee7ed365b2c1c819285cc54"},{"author":{"_account_id":16635,"name":"deray","email":"debayan.ray@gmail.com","username":"deray"},"change_message_id":"dbb86e4ef3c7d3a0ba96b4a6d76b12f1f1d5d660","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        self._auth.set_context(self, self._conn)"},{"line_number":115,"context_line":"        self._auth.authenticate()"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    def __del__(self):"},{"line_number":118,"context_line":"        if self._auth:"},{"line_number":119,"context_line":"            self._auth.close()"},{"line_number":120,"context_line":"            self._auth \u003d None"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_a800f104","line":117,"range":{"start_line":117,"start_character":4,"end_line":117,"end_character":22},"in_reply_to":"3f79a3b5_8802dc07","updated":"2018-11-02 17:19:25.000000000","message":"Yes. To be precise:\n\n    def call():\n      s \u003d main.Sushy(...)\n      return s.get_system()  # this System obj has a ref to the same Connector obj.\n\nbut after every ``call()`` invocation once the System obj is used to make calls like ``set_power_state()`` etc. it goes out of scope in the containing method and ref_count decreased to 0 and gc\u0027ed.\n\nThank you, Ilya!","commit_id":"824f691415927b059ee7ed365b2c1c819285cc54"},{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"be314bce33179f04c9d2c0f21bb8932a6ec1a2d8","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        self._auth.set_context(self, self._conn)"},{"line_number":115,"context_line":"        self._auth.authenticate()"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    def __del__(self):"},{"line_number":118,"context_line":"        if self._auth:"},{"line_number":119,"context_line":"            self._auth.close()"},{"line_number":120,"context_line":"            self._auth \u003d None"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_9fe7c610","line":117,"range":{"start_line":117,"start_character":4,"end_line":117,"end_character":22},"in_reply_to":"3f79a3b5_a800f104","updated":"2018-11-12 13:10:35.000000000","message":"Done","commit_id":"824f691415927b059ee7ed365b2c1c819285cc54"},{"author":{"_account_id":16635,"name":"deray","email":"debayan.ray@gmail.com","username":"deray"},"change_message_id":"a101ea57496b6e8b147ad665e89233eb654dfef3","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        self._auth.set_context(self, self._conn)"},{"line_number":115,"context_line":"        self._auth.authenticate()"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    def __del__(self):"},{"line_number":118,"context_line":"        if self._auth:"},{"line_number":119,"context_line":"            self._auth.close()"},{"line_number":120,"context_line":"            self._auth \u003d None"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_f615783f","line":117,"range":{"start_line":117,"start_character":4,"end_line":117,"end_character":22},"in_reply_to":"3f79a3b5_ebdd95de","updated":"2018-11-02 07:31:06.000000000","message":"Okay .. I possibly get it now. When the Sushy system itself is out of scope and allowed for GC, for instance here[1], the connector obj is also ref-counted to 0, and so on and so forth and then the Sushy obj is also gc\u0027ed. Am I right?\n\n[1] https://github.com/openstack/ironic/blob/master/ironic/drivers/modules/redfish/management.py#L113","commit_id":"824f691415927b059ee7ed365b2c1c819285cc54"},{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"520e7faae482a5cfcde9841c65d8031a7cc47ee4","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        self._auth.set_context(self, self._conn)"},{"line_number":115,"context_line":"        self._auth.authenticate()"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    def __del__(self):"},{"line_number":118,"context_line":"        if self._auth:"},{"line_number":119,"context_line":"            self._auth.close()"},{"line_number":120,"context_line":"            self._auth \u003d None"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_8802dc07","line":117,"range":{"start_line":117,"start_character":4,"end_line":117,"end_character":22},"in_reply_to":"3f79a3b5_f615783f","updated":"2018-11-02 13:51:46.000000000","message":"The current situation is rather loopy:\n\nSushy -\u003e Auth\nAuth -\u003e Sushy\nSushy -\u003e Connector\nConnector -\u003e Auth\n\nLuckily, Python\u0027s GC should be able to detect reference cycles [1] and collect the objects not referenced by anything else other than reference loops.\n\nI just tried this code so it seems that __del__ is actually called on `gc.collect()`.\n\n  import gc\n  from sushy import main\n\n  def call():\n    s \u003d main.Sushy(\u0027http://localhost:8000\u0027)\n\n  call()\n  gc.collect()\n  # __del__ gets called here\n  call()\n  # __del__ gets called here\n\nDoes it make sense?\n\n1. https://pythoninternal.wordpress.com/2014/08/04/the-garbage-collector/","commit_id":"824f691415927b059ee7ed365b2c1c819285cc54"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"81cf843ffaa4591dc025f13bf5434914d4fc48be","unresolved":false,"context_lines":[{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    def __del__(self):"},{"line_number":118,"context_line":"        if self._auth:"},{"line_number":119,"context_line":"            self._auth.close()"},{"line_number":120,"context_line":"            self._auth \u003d None"},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"    def _parse_attributes(self):"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_b7fe6c04","line":119,"updated":"2018-11-12 11:21:50.000000000","message":"let us catch exceptions and provide a warning log. otherwise python is going to issue something ugly :)","commit_id":"824f691415927b059ee7ed365b2c1c819285cc54"},{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"be314bce33179f04c9d2c0f21bb8932a6ec1a2d8","unresolved":false,"context_lines":[{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    def __del__(self):"},{"line_number":118,"context_line":"        if self._auth:"},{"line_number":119,"context_line":"            self._auth.close()"},{"line_number":120,"context_line":"            self._auth \u003d None"},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"    def _parse_attributes(self):"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_bf0de2db","line":119,"in_reply_to":"3f79a3b5_b7fe6c04","updated":"2018-11-12 13:10:35.000000000","message":"Done","commit_id":"824f691415927b059ee7ed365b2c1c819285cc54"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"3f9ccd834f367ef9fe91e630ac4741a632eead96","unresolved":false,"context_lines":[{"line_number":122,"context_line":""},{"line_number":123,"context_line":"            except Exception as ex:"},{"line_number":124,"context_line":"                LOG.warning(\u0027Ignoring error while closing Redfish session \u0027"},{"line_number":125,"context_line":"                            \u0027with %s: %s\u0027, (self._base_url, ex))"},{"line_number":126,"context_line":"            self._auth \u003d None"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":"    def _parse_attributes(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"3f79a3b5_df221e02","line":125,"range":{"start_line":125,"start_character":43,"end_line":125,"end_character":44},"updated":"2018-11-12 13:22:38.000000000","message":"please remove brackets, otherwise you\u0027ll get an error (it will be treated as one tuple).","commit_id":"948ce356814a330ccad00ba603ea5e5a9890c416"},{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"ba48a072544eb9abc3a17ed29688b04a88f21dac","unresolved":false,"context_lines":[{"line_number":122,"context_line":""},{"line_number":123,"context_line":"            except Exception as ex:"},{"line_number":124,"context_line":"                LOG.warning(\u0027Ignoring error while closing Redfish session \u0027"},{"line_number":125,"context_line":"                            \u0027with %s: %s\u0027, (self._base_url, ex))"},{"line_number":126,"context_line":"            self._auth \u003d None"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":"    def _parse_attributes(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"3f79a3b5_9ff4a657","line":125,"range":{"start_line":125,"start_character":43,"end_line":125,"end_character":44},"in_reply_to":"3f79a3b5_df221e02","updated":"2018-11-12 13:29:44.000000000","message":"Ah, old habits die hard...","commit_id":"948ce356814a330ccad00ba603ea5e5a9890c416"},{"author":{"_account_id":16635,"name":"deray","email":"debayan.ray@gmail.com","username":"deray"},"change_message_id":"54c845958d18dc69e117e660337665fdb26110fc","unresolved":false,"context_lines":[{"line_number":118,"context_line":"    def __del__(self):"},{"line_number":119,"context_line":"        if self._auth:"},{"line_number":120,"context_line":"            try:"},{"line_number":121,"context_line":"                self._auth.close()"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"            except Exception as ex:"},{"line_number":124,"context_line":"                LOG.warning(\u0027Ignoring error while closing Redfish session \u0027"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_9dfeee04","line":121,"range":{"start_line":121,"start_character":16,"end_line":121,"end_character":34},"updated":"2018-11-12 15:51:21.000000000","message":"2 exceptions are already handled inside the close implementation [1]. Do we have any chance to have any other exception?\n\n[1] https://github.com/openstack/sushy/blob/master/sushy/auth.py#L192-L198","commit_id":"cf4bda071d75765c9ec9c323e6ed560b705f6971"},{"author":{"_account_id":16635,"name":"deray","email":"debayan.ray@gmail.com","username":"deray"},"change_message_id":"528b1cd007dd2d252a814b0b9c20254861e53b00","unresolved":false,"context_lines":[{"line_number":118,"context_line":"    def __del__(self):"},{"line_number":119,"context_line":"        if self._auth:"},{"line_number":120,"context_line":"            try:"},{"line_number":121,"context_line":"                self._auth.close()"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"            except Exception as ex:"},{"line_number":124,"context_line":"                LOG.warning(\u0027Ignoring error while closing Redfish session \u0027"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_b846581e","line":121,"range":{"start_line":121,"start_character":16,"end_line":121,"end_character":34},"in_reply_to":"3f79a3b5_189c2cbc","updated":"2018-11-12 16:08:57.000000000","message":"thanks for clarifying, Dmitry!","commit_id":"cf4bda071d75765c9ec9c323e6ed560b705f6971"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"9a767472594d6449358c08e53e7be7ffa49a29d4","unresolved":false,"context_lines":[{"line_number":118,"context_line":"    def __del__(self):"},{"line_number":119,"context_line":"        if self._auth:"},{"line_number":120,"context_line":"            try:"},{"line_number":121,"context_line":"                self._auth.close()"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"            except Exception as ex:"},{"line_number":124,"context_line":"                LOG.warning(\u0027Ignoring error while closing Redfish session \u0027"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_189c2cbc","line":121,"range":{"start_line":121,"start_character":16,"end_line":121,"end_character":34},"in_reply_to":"3f79a3b5_9dfeee04","updated":"2018-11-12 15:59:14.000000000","message":"I asked for a catch-all exception handler because exception in __del__ result in an ugly warning in stderr.","commit_id":"cf4bda071d75765c9ec9c323e6ed560b705f6971"}]}
