)]}'
{"nova/context.py":[{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"60de7d632e9b41fcbd9c877a934c5af95b438946","unresolved":true,"context_lines":[{"line_number":424,"context_line":"            # Only log the exception traceback for non-nova exceptions."},{"line_number":425,"context_line":"            if not isinstance(e, exception.NovaException):"},{"line_number":426,"context_line":"                LOG.exception(\u0027Error gathering result from cell %s\u0027, cell_uuid)"},{"line_number":427,"context_line":"            result \u003d e"},{"line_number":428,"context_line":"        # The queue is already synchronized."},{"line_number":429,"context_line":"        queue.put((cell_uuid, result))"},{"line_number":430,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5e14977a_8e3b15f1","line":427,"updated":"2022-05-03 15:31:13.000000000","message":"I\u0027m wondering why previously we created a copy from the exception instead of storing it directly.","commit_id":"1d4dbfd4680d32d0619e84dbe563deed892e0506"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"9e41eef435b88c08eb6fe7b642d5b4b79627842b","unresolved":false,"context_lines":[{"line_number":424,"context_line":"            # Only log the exception traceback for non-nova exceptions."},{"line_number":425,"context_line":"            if not isinstance(e, exception.NovaException):"},{"line_number":426,"context_line":"                LOG.exception(\u0027Error gathering result from cell %s\u0027, cell_uuid)"},{"line_number":427,"context_line":"            result \u003d e"},{"line_number":428,"context_line":"        # The queue is already synchronized."},{"line_number":429,"context_line":"        queue.put((cell_uuid, result))"},{"line_number":430,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"676bae1f_68bc988b","line":427,"in_reply_to":"32ae8809_3bb36ab0","updated":"2022-05-04 23:03:06.000000000","message":"Meant to add this yesterday for posterity:\n\nI talked to dansmith and sean-k-mooney [1] and they found the specific reason a new exception object was created here (in Stein) is because of an issue in python2 where a traceback object would never be garbage collected because it contains references to stack frames that were active when the exception was raised [2][3], creating a circular reference [4]. This issue was fixed in python3 [5][6], presumably version 3.3 as a warning in the docs [7] about the circular reference was removed in the version 3.3 docs [8].\n\n[1] https://meetings.opendev.org/irclogs/%23openstack-nova/%23openstack-nova.2022-05-03.log.html#t2022-05-03T16:45:24\n[2] https://stackoverflow.com/questions/44681681/what-could-prevent-a-traceback-from-being-garbage-collected\n[3] https://stackoverflow.com/questions/1658293/why-is-there-a-need-to-explicitly-delete-the-sys-exc-info-traceback\n[4] https://peps.python.org/pep-0344/#open-issue-garbage-collection\n[5] https://peps.python.org/pep-3110/#semantic-changes\n[6] https://mail.python.org/pipermail/python-3000/2007-January/005363.html\n[7] https://docs.python.org/3.2/library/sys.html#sys.exc_info\n[8] https://docs.python.org/3.3/library/sys.html#sys.exc_info","commit_id":"1d4dbfd4680d32d0619e84dbe563deed892e0506"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"c68c84362c1d8b0db0d887373e951ec0a8498dd2","unresolved":true,"context_lines":[{"line_number":424,"context_line":"            # Only log the exception traceback for non-nova exceptions."},{"line_number":425,"context_line":"            if not isinstance(e, exception.NovaException):"},{"line_number":426,"context_line":"                LOG.exception(\u0027Error gathering result from cell %s\u0027, cell_uuid)"},{"line_number":427,"context_line":"            result \u003d e"},{"line_number":428,"context_line":"        # The queue is already synchronized."},{"line_number":429,"context_line":"        queue.put((cell_uuid, result))"},{"line_number":430,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"84c4a69e_0ad82375","line":427,"in_reply_to":"5e14977a_8e3b15f1","updated":"2022-05-03 16:40:37.000000000","message":"I should have linked this earlier but wasn\u0027t sure if people would be interested, this is the only evidence I found of why it was being copied:\n\nhttps://review.opendev.org/c/openstack/nova/+/607934/1/nova/context.py#446\n\nand that comment was removed in PS2 and the comment was not discussed anywhere on the review ... so I googled around to see if there is some kind of scoping problem with assigning a caught exception object to a new variable and could find nothing about potential problems.\n\nThe only thing I found is that if you refer to \"e\" outside (after) the try-except block without assigning it to a new variable, there is different behavior between python 2 and 3 where in one case it doesn\u0027t go out of scope and in one it does:\n\n $ cat t.py \n try:\n     raise Exception(\u0027foo\u0027)\n except Exception as e:\n     print(e)\n\n print(e)\n\n $ python2 t.py \n foo\n foo\n\n $ python3 t.py \n foo\n Traceback (most recent call last):\n   File \"t.py\", line 6, in \u003cmodule\u003e\n     print(e)\n NameError: name \u0027e\u0027 is not defined\n\nWhereas after assigning to new variable:\n\n $ cat t.py \n try:\n     raise Exception(\u0027foo\u0027)\n except Exception as e:\n     err \u003d e\n     print(err)\n\n print(err)\n\n $ python2 t.py \n foo\n foo\n\n $ python3 t.py \n foo\n foo\n\nThe only other place I see this pattern is from the same patch in a different file:\n\nhttps://github.com/openstack/nova/blame/b8cc5704558d3c08fda9db2f1bb7fecb2bcd985d/nova/compute/multi_cell_list.py#L112\n\nI was thinking to ask Dan if he knows anything about it bc he uploaded some of the PS in that review.","commit_id":"1d4dbfd4680d32d0619e84dbe563deed892e0506"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"6cbaa06a733977868f0dbad2ab0178335c3eafbe","unresolved":false,"context_lines":[{"line_number":424,"context_line":"            # Only log the exception traceback for non-nova exceptions."},{"line_number":425,"context_line":"            if not isinstance(e, exception.NovaException):"},{"line_number":426,"context_line":"                LOG.exception(\u0027Error gathering result from cell %s\u0027, cell_uuid)"},{"line_number":427,"context_line":"            result \u003d e"},{"line_number":428,"context_line":"        # The queue is already synchronized."},{"line_number":429,"context_line":"        queue.put((cell_uuid, result))"},{"line_number":430,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"d2dd3081_3330b32f","line":427,"in_reply_to":"676bae1f_68bc988b","updated":"2022-05-06 11:44:45.000000000","message":"Yet another reason to add copious NOTE comments when doing weird stuff like this. Thanks for chasing this down, Mel","commit_id":"1d4dbfd4680d32d0619e84dbe563deed892e0506"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"e3a6c3242e7774e2d386fc2a53738879ec9c60ff","unresolved":false,"context_lines":[{"line_number":424,"context_line":"            # Only log the exception traceback for non-nova exceptions."},{"line_number":425,"context_line":"            if not isinstance(e, exception.NovaException):"},{"line_number":426,"context_line":"                LOG.exception(\u0027Error gathering result from cell %s\u0027, cell_uuid)"},{"line_number":427,"context_line":"            result \u003d e"},{"line_number":428,"context_line":"        # The queue is already synchronized."},{"line_number":429,"context_line":"        queue.put((cell_uuid, result))"},{"line_number":430,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"32ae8809_3bb36ab0","line":427,"in_reply_to":"84c4a69e_0ad82375","updated":"2022-05-04 08:19:51.000000000","message":"Thanks for the explanation.","commit_id":"1d4dbfd4680d32d0619e84dbe563deed892e0506"}]}
