)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"e375a2c8c5717d3e15c0bc086d546f786d284fb6","unresolved":true,"context_lines":[{"line_number":11,"context_line":""},{"line_number":12,"context_line":"The `close` API currently calls `pyeclib_c.destroy` immediately. This"},{"line_number":13,"context_line":"may close the underlying EC descriptor during an in-flight EC operation,"},{"line_number":14,"context_line":"resulting in the operation\u0027s failure or a memory leak."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Address the race condition by making `close` drop the driver\u0027s reference"},{"line_number":17,"context_line":"to the handle instead, so that outstanding references remain valid. Rely"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"90531732_f22e723b","line":14,"range":{"start_line":14,"start_character":40,"end_line":14,"end_character":53},"updated":"2026-08-20 15:44:00.000000000","message":"How\u0027s the memory leak come in? I don\u0027t quite see it yet.","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"800feb09413788e8d6201c5459786d21d771c30f","unresolved":true,"context_lines":[{"line_number":11,"context_line":""},{"line_number":12,"context_line":"The `close` API currently calls `pyeclib_c.destroy` immediately. This"},{"line_number":13,"context_line":"may close the underlying EC descriptor during an in-flight EC operation,"},{"line_number":14,"context_line":"resulting in the operation\u0027s failure or a memory leak."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Address the race condition by making `close` drop the driver\u0027s reference"},{"line_number":17,"context_line":"to the handle instead, so that outstanding references remain valid. Rely"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"83d268ab_d0be0127","line":14,"range":{"start_line":14,"start_character":40,"end_line":14,"end_character":53},"in_reply_to":"11505d98_c8760d22","updated":"2026-08-25 21:57:41.000000000","message":"I\u0027m not sure what sort of guarantees we can provide while `liberasurecode_instance_destroy` doesn\u0027t know about in-flight operations and can only fail with `-EBACKENDNOTAVAIL`. That\u0027s definitely part of why I\u0027m interested in session support, so liberasurecode can push back and say, \"no, you can\u0027t destroy that yet, there\u0027s someone else still using it.\"\n\nActually... maybe I should take that back -- I guess with this change as-is, maybe we *can* provide some meaningful guarantees (at the cost of unknown, or at any rate squishier, descriptor lifetimes).\n\nI\u0027m glad @cschwede@nvidia.com is planning to take a look! Maybe he can swing us (or is it just me? 😉) to one side or the other.","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"},{"author":{"_account_id":38767,"name":"Wael Halbawi","display_name":"Wael Halbawi","email":"whalbawi@nvidia.com","username":"whalbawi"},"change_message_id":"526a44035f4e11247829fab3536c2140e7ba129e","unresolved":true,"context_lines":[{"line_number":11,"context_line":""},{"line_number":12,"context_line":"The `close` API currently calls `pyeclib_c.destroy` immediately. This"},{"line_number":13,"context_line":"may close the underlying EC descriptor during an in-flight EC operation,"},{"line_number":14,"context_line":"resulting in the operation\u0027s failure or a memory leak."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Address the race condition by making `close` drop the driver\u0027s reference"},{"line_number":17,"context_line":"to the handle instead, so that outstanding references remain valid. Rely"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"11505d98_c8760d22","line":14,"range":{"start_line":14,"start_character":40,"end_line":14,"end_character":53},"in_reply_to":"52cea9cb_b89f91ba","updated":"2026-08-21 22:27:05.000000000","message":"Given that there is no leak in the single-threaded case, I think it boils down to whether pyeclib should provide (any) thread-safety guarantees or not.","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"},{"author":{"_account_id":38767,"name":"Wael Halbawi","display_name":"Wael Halbawi","email":"whalbawi@nvidia.com","username":"whalbawi"},"change_message_id":"8f58b6ee4c04ca6ffe095b4ce50eec94fda9eb5d","unresolved":true,"context_lines":[{"line_number":11,"context_line":""},{"line_number":12,"context_line":"The `close` API currently calls `pyeclib_c.destroy` immediately. This"},{"line_number":13,"context_line":"may close the underlying EC descriptor during an in-flight EC operation,"},{"line_number":14,"context_line":"resulting in the operation\u0027s failure or a memory leak."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Address the race condition by making `close` drop the driver\u0027s reference"},{"line_number":17,"context_line":"to the handle instead, so that outstanding references remain valid. Rely"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"97acc21d_e11b50ed","line":14,"range":{"start_line":14,"start_character":40,"end_line":14,"end_character":53},"in_reply_to":"90531732_f22e723b","updated":"2026-08-20 19:34:46.000000000","message":"Does this look OK?\n- `t1` releases the GIL\n- `t1` calls and returns from [`liberasurecode_encode`](https://opendev.org/openstack/pyeclib/src/branch/master/src/pyeclib_c/pyeclib_c.c#L541)\n--- `t2` acquires the GIL\n--- `t2` calls and returns from `.close()` -- [`liberasurecode_instance_destroy`](https://opendev.org/openstack/pyeclib/src/branch/master/src/pyeclib_c/pyeclib_c.c#L322) invalidates the EC descriptor\n--- `t2` releases the GIL\n- `t1` acquires the GIL\n- `t1` calls [`liberasurecode_encode_cleanup`](https://opendev.org/openstack/pyeclib/src/branch/master/src/pyeclib_c/pyeclib_c.c#L570), which [fails](https://opendev.org/openstack/liberasurecode/src/branch/master/src/erasurecode.c#L342) and returns early without [freeing](https://opendev.org/openstack/liberasurecode/src/branch/master/src/erasurecode.c#L349-L362) the buffers","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"2fc8e85bd3af57a396612b521ba10a0960c5c58c","unresolved":true,"context_lines":[{"line_number":11,"context_line":""},{"line_number":12,"context_line":"The `close` API currently calls `pyeclib_c.destroy` immediately. This"},{"line_number":13,"context_line":"may close the underlying EC descriptor during an in-flight EC operation,"},{"line_number":14,"context_line":"resulting in the operation\u0027s failure or a memory leak."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Address the race condition by making `close` drop the driver\u0027s reference"},{"line_number":17,"context_line":"to the handle instead, so that outstanding references remain valid. Rely"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"52cea9cb_b89f91ba","line":14,"range":{"start_line":14,"start_character":40,"end_line":14,"end_character":53},"in_reply_to":"97acc21d_e11b50ed","updated":"2026-08-20 22:08:22.000000000","message":"Makes perfect sense, thanks! Not that I doubted there was one; I just figured you could point it out to me pretty quick since it was already loaded in your head 😉\n\nI *think* I\u0027m OK with that sort of a leak during a race, but I might be convinced otherwise.","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"e375a2c8c5717d3e15c0bc086d546f786d284fb6","unresolved":true,"context_lines":[{"line_number":13,"context_line":"may close the underlying EC descriptor during an in-flight EC operation,"},{"line_number":14,"context_line":"resulting in the operation\u0027s failure or a memory leak."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Address the race condition by making `close` drop the driver\u0027s reference"},{"line_number":17,"context_line":"to the handle instead, so that outstanding references remain valid. Rely"},{"line_number":18,"context_line":"on the `PyCapsule`-associated destructor to close the EC descriptor once"},{"line_number":19,"context_line":"the last reference is released."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"ebfcf0fd_e424819b","line":16,"range":{"start_line":16,"start_character":0,"end_line":16,"end_character":26},"updated":"2026-08-20 15:44:00.000000000","message":"But who\u0027s responsible for the race condition? I\u0027m not so sure that it\u0027s us -- and it kinda seems reasonable to me that \"caller writes racy code\" should imply \"program has racy behavior\"...","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"},{"author":{"_account_id":38767,"name":"Wael Halbawi","display_name":"Wael Halbawi","email":"whalbawi@nvidia.com","username":"whalbawi"},"change_message_id":"8f58b6ee4c04ca6ffe095b4ce50eec94fda9eb5d","unresolved":true,"context_lines":[{"line_number":13,"context_line":"may close the underlying EC descriptor during an in-flight EC operation,"},{"line_number":14,"context_line":"resulting in the operation\u0027s failure or a memory leak."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Address the race condition by making `close` drop the driver\u0027s reference"},{"line_number":17,"context_line":"to the handle instead, so that outstanding references remain valid. Rely"},{"line_number":18,"context_line":"on the `PyCapsule`-associated destructor to close the EC descriptor once"},{"line_number":19,"context_line":"the last reference is released."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"52b3d797_ee8fc0bf","line":16,"range":{"start_line":16,"start_character":0,"end_line":16,"end_character":26},"in_reply_to":"ebfcf0fd_e424819b","updated":"2026-08-20 19:34:46.000000000","message":"Makes sense. I agree that there\u0027s no need to characterize the nature of the change as addressing a race condition. My perspective is that releasing the GIL in certain places eliminates implied serialization behavior and this patch attempts to address that.","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"e375a2c8c5717d3e15c0bc086d546f786d284fb6","unresolved":true,"context_lines":[{"line_number":16,"context_line":"Address the race condition by making `close` drop the driver\u0027s reference"},{"line_number":17,"context_line":"to the handle instead, so that outstanding references remain valid. Rely"},{"line_number":18,"context_line":"on the `PyCapsule`-associated destructor to close the EC descriptor once"},{"line_number":19,"context_line":"the last reference is released."},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Assisted-by: OpenAI Codex (GPT-5.6)"},{"line_number":22,"context_line":"Change-Id: I07610dd5b8a8da607a48a5c947e2bd1a3aa2b725"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"c5d02944_8181b0ca","line":19,"updated":"2026-08-20 15:44:00.000000000","message":"IDK about this plan -- I rather liked that `.close()` offered some explicit control over EC descriptor lifetimes. If we rely entirely on GC to call the PyCapsule destructor, we don\u0027t actually know when (or IIRC even on which thread) it will get cleaned up.","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"2fc8e85bd3af57a396612b521ba10a0960c5c58c","unresolved":true,"context_lines":[{"line_number":16,"context_line":"Address the race condition by making `close` drop the driver\u0027s reference"},{"line_number":17,"context_line":"to the handle instead, so that outstanding references remain valid. Rely"},{"line_number":18,"context_line":"on the `PyCapsule`-associated destructor to close the EC descriptor once"},{"line_number":19,"context_line":"the last reference is released."},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Assisted-by: OpenAI Codex (GPT-5.6)"},{"line_number":22,"context_line":"Change-Id: I07610dd5b8a8da607a48a5c947e2bd1a3aa2b725"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"2c1b8089_44f0ca0e","line":19,"in_reply_to":"26836ad3_80f23e8f","updated":"2026-08-20 22:08:22.000000000","message":"\u003e Do you think we should abandon this patch\n\nOr change its scope a bit. Like I said, that `self._handle` business seems much better here -- that\u0027s a TOCTOU bug we *do* control.\n\n\u003e document the thread-safety guarantees of this library\n\nThat\u0027s **definitely** a good idea, and I feel bad that I haven\u0027t done that already.\n\nCome to think of it, I\u0027m not sure we *publish* docs anywhere... should probably fix *that*, too... but at least the renderings for e.g. cli.rst are pretty usable on both [GitHub](https://github.com/openstack/pyeclib/blob/master/doc/source/cli.rst) and [OpenDev](https://opendev.org/openstack/pyeclib/src/branch/master/doc/source/cli.rst). I feel like just having a `thread-safety.rst` that talks about thread-safety issues would be a great starting point.","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"},{"author":{"_account_id":38767,"name":"Wael Halbawi","display_name":"Wael Halbawi","email":"whalbawi@nvidia.com","username":"whalbawi"},"change_message_id":"526a44035f4e11247829fab3536c2140e7ba129e","unresolved":false,"context_lines":[{"line_number":16,"context_line":"Address the race condition by making `close` drop the driver\u0027s reference"},{"line_number":17,"context_line":"to the handle instead, so that outstanding references remain valid. Rely"},{"line_number":18,"context_line":"on the `PyCapsule`-associated destructor to close the EC descriptor once"},{"line_number":19,"context_line":"the last reference is released."},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Assisted-by: OpenAI Codex (GPT-5.6)"},{"line_number":22,"context_line":"Change-Id: I07610dd5b8a8da607a48a5c947e2bd1a3aa2b725"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"d576f5d9_176868de","line":19,"in_reply_to":"2c1b8089_44f0ca0e","updated":"2026-08-21 22:27:05.000000000","message":"Acknowledged","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"},{"author":{"_account_id":38767,"name":"Wael Halbawi","display_name":"Wael Halbawi","email":"whalbawi@nvidia.com","username":"whalbawi"},"change_message_id":"8f58b6ee4c04ca6ffe095b4ce50eec94fda9eb5d","unresolved":true,"context_lines":[{"line_number":16,"context_line":"Address the race condition by making `close` drop the driver\u0027s reference"},{"line_number":17,"context_line":"to the handle instead, so that outstanding references remain valid. Rely"},{"line_number":18,"context_line":"on the `PyCapsule`-associated destructor to close the EC descriptor once"},{"line_number":19,"context_line":"the last reference is released."},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Assisted-by: OpenAI Codex (GPT-5.6)"},{"line_number":22,"context_line":"Change-Id: I07610dd5b8a8da607a48a5c947e2bd1a3aa2b725"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"26836ad3_80f23e8f","line":19,"in_reply_to":"c5d02944_8181b0ca","updated":"2026-08-20 19:34:46.000000000","message":"Interestingly, Swift doesn\u0027t seem to call `.close()` anywhere -- I should\u0027ve done that search earlier! Do you think we should abandon this patch then and document the thread-safety guarantees of this library instead?","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"},{"author":{"_account_id":6968,"name":"Christian Schwede","email":"cschwede@nvidia.com","username":"cschwede"},"change_message_id":"a721f8acb9d99aed70a8ff71cb7bb1842141db1c","unresolved":false,"context_lines":[{"line_number":16,"context_line":"Address the race condition by making `close` drop the driver\u0027s reference"},{"line_number":17,"context_line":"to the handle instead, so that outstanding references remain valid. Rely"},{"line_number":18,"context_line":"on the `PyCapsule`-associated destructor to close the EC descriptor once"},{"line_number":19,"context_line":"the last reference is released."},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Assisted-by: OpenAI Codex (GPT-5.6)"},{"line_number":22,"context_line":"Change-Id: I07610dd5b8a8da607a48a5c947e2bd1a3aa2b725"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"d6c72557_0fe0ef67","line":19,"in_reply_to":"d576f5d9_176868de","updated":"2026-08-28 13:15:57.000000000","message":"\u003e Interestingly, Swift doesn\u0027t seem to call .close() anywhere -- I should\u0027ve done that search earlier! Do you think we should abandon this patch then and document the thread-safety guarantees of this library instead?\n\nThat\u0027s an interesting finding!\n\nRegarding the patch itself, I would not abandon this. I like Tim\u0027s idea to change the scope a bit - the `self._handle` change lgtm, like that! So maybe reduce it to that part for now?","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"}],"/PATCHSET_LEVEL":[{"author":{"_account_id":6968,"name":"Christian Schwede","email":"cschwede@nvidia.com","username":"cschwede"},"change_message_id":"a721f8acb9d99aed70a8ff71cb7bb1842141db1c","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"7c6bdbd5_a3aaf276","updated":"2026-08-28 13:15:57.000000000","message":"+1 because I like the change of `self._handle` (that change alone is closer to a +2 from my side), and I think this does not break anything today.","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"800feb09413788e8d6201c5459786d21d771c30f","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"4eae5255_3d06c3b4","updated":"2026-08-25 21:57:41.000000000","message":"FWIW, I put together some basic threading documentation for liberasurecode: https://review.opendev.org/c/openstack/liberasurecode/+/1001885/1/doc/threading.md\n\nI\u0027m not entirely sure what thread-safety documentation should *look like*, though -- I\u0027d appreciate some feedback on that before I put something comparable together for pyeclib.","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"e375a2c8c5717d3e15c0bc086d546f786d284fb6","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"c5df1b90_ab464481","updated":"2026-08-20 15:44:00.000000000","message":"Have you taken a look at the session-API work? I feel like you might like how it allows `liberasurecode_instance_destroy` (and by extension, `ECPyECLibDriver.close`) to fail with `-EBACKENDHASOPENSESSIONS` if callers lean into the new API. See\n\n- 982505: [Introduce a session-based API](https://review.opendev.org/c/openstack/liberasurecode/+/982505) which gets the new API into liberasurecode\n- 982506: [Add buffer cache to sessions](https://review.opendev.org/c/openstack/liberasurecode/+/982506) which tries for some performance improvements by reusing buffers\n- 983666: [Introduce session support](https://review.opendev.org/c/openstack/pyeclib/+/983666) which enables the above in pyeclib","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"},{"author":{"_account_id":38767,"name":"Wael Halbawi","display_name":"Wael Halbawi","email":"whalbawi@nvidia.com","username":"whalbawi"},"change_message_id":"8f58b6ee4c04ca6ffe095b4ce50eec94fda9eb5d","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"1aed3375_aaafa6f5","updated":"2026-08-20 19:34:46.000000000","message":"Thanks for the review @tburke@nvidia.com!","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"},{"author":{"_account_id":38767,"name":"Wael Halbawi","display_name":"Wael Halbawi","email":"whalbawi@nvidia.com","username":"whalbawi"},"change_message_id":"af34b1f1197f352bd7ad3d8043b575fd81b54fb0","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"dab275c4_1afa7df0","updated":"2026-08-19 21:07:12.000000000","message":"recheck\n\nPyPI mirror returning an error:\n```\nCaused by ResponseError(\u0027too many 502 error responses\u0027)\n```","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"2fc8e85bd3af57a396612b521ba10a0960c5c58c","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"91078aea_35378898","in_reply_to":"2ee1af28_dbd3944a","updated":"2026-08-20 22:08:22.000000000","message":"Thanks! Sorry, it\u0027s a decent-size body of work. Could probably skip the middle patch for now, if we\u0027re mainly looking at how we might evolve the API -- plus it looks like I still had some questions about what Claude was doing in some places on that one.","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"},{"author":{"_account_id":38767,"name":"Wael Halbawi","display_name":"Wael Halbawi","email":"whalbawi@nvidia.com","username":"whalbawi"},"change_message_id":"aaec00cacc96ac4611b11098b47d0877ddcd0259","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"2ee1af28_dbd3944a","in_reply_to":"c5df1b90_ab464481","updated":"2026-08-20 20:24:27.000000000","message":"I haven\u0027t. Will take a look!","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"}],"src/pyeclib/core.py":[{"author":{"_account_id":38767,"name":"Wael Halbawi","display_name":"Wael Halbawi","email":"whalbawi@nvidia.com","username":"whalbawi"},"change_message_id":"526a44035f4e11247829fab3536c2140e7ba129e","unresolved":true,"context_lines":[{"line_number":84,"context_line":"        )"},{"line_number":85,"context_line":""},{"line_number":86,"context_line":"    def close(self) -\u003e None:"},{"line_number":87,"context_line":"        if self._handle is not None:"},{"line_number":88,"context_line":"            pyeclib_c.destroy(self._handle)"},{"line_number":89,"context_line":"        self._handle \u003d None"},{"line_number":90,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"c022e9d2_0c7b96d9","side":"PARENT","line":87,"updated":"2026-08-21 22:27:05.000000000","message":"Here\u0027s a shot at closing the TOCTOU window:\n```python\ndef close(self) -\u003e None:\n    handle \u003d self._handle\n    if handle is None:\n        return\n    self._handle \u003d None\n    pyeclib_c.destroy(handle)\n```\nI\u0027m not a big fan, especially without atomic exchange, and with no thread-safety guarantees I don\u0027t know what it buys us.","commit_id":"8870d5b2d2c777e97495a0353edee80f3a67a803"},{"author":{"_account_id":38767,"name":"Wael Halbawi","display_name":"Wael Halbawi","email":"whalbawi@nvidia.com","username":"whalbawi"},"change_message_id":"7cdc6ec962832813f6f622d395b8a75b73f30597","unresolved":false,"context_lines":[{"line_number":84,"context_line":"        )"},{"line_number":85,"context_line":""},{"line_number":86,"context_line":"    def close(self) -\u003e None:"},{"line_number":87,"context_line":"        if self._handle is not None:"},{"line_number":88,"context_line":"            pyeclib_c.destroy(self._handle)"},{"line_number":89,"context_line":"        self._handle \u003d None"},{"line_number":90,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"415b4067_a2bdbdf6","side":"PARENT","line":87,"in_reply_to":"7a2bec8a_3d0e971a","updated":"2026-09-21 18:34:27.000000000","message":"Just learnt about `dis`! I think the examples you provided are helpful. The error messages are different and I think it would be nice to avoid:\n```sh\npyeclib.exceptions.ECDriverError: pyeclib_c_destroy ERROR: Unknown error. Please inspect syslog for liberasurecode error report.\n```\nresulting from `pyeclib_c.destroy(None)`.","commit_id":"8870d5b2d2c777e97495a0353edee80f3a67a803"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"800feb09413788e8d6201c5459786d21d771c30f","unresolved":true,"context_lines":[{"line_number":84,"context_line":"        )"},{"line_number":85,"context_line":""},{"line_number":86,"context_line":"    def close(self) -\u003e None:"},{"line_number":87,"context_line":"        if self._handle is not None:"},{"line_number":88,"context_line":"            pyeclib_c.destroy(self._handle)"},{"line_number":89,"context_line":"        self._handle \u003d None"},{"line_number":90,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7a2bec8a_3d0e971a","side":"PARENT","line":87,"in_reply_to":"c022e9d2_0c7b96d9","updated":"2026-08-25 21:57:41.000000000","message":"Main benefit would be avoiding a `pyeclib_c.destroy(None)` call, which blows up with\n```\npyeclib.exceptions.ECDriverError: pyeclib_c_destroy ERROR: Unknown error. Please inspect syslog for liberasurecode error report.\n```\nI figure, if there\u0027s a race to close, I\u0027m OK with letting both of them \"succeed,\" even if only one actually calls `pyeclib_c.destroy`.\n\nOTOH, maybe one of them *should* blow up? Certainly that\u0027s what happens if you serially perform a double destroy:\n\n```\n\u003e\u003e\u003e x \u003d pyeclib_c.init(8, 4, 6)\n\u003e\u003e\u003e pyeclib_c.destroy(x)\n\u003e\u003e\u003e pyeclib_c.destroy(x)\nTraceback (most recent call last):\n  File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\npyeclib.exceptions.ECBackendInstanceNotAvailable: pyeclib_c_destroy ERROR: Backend instance not found. Please inspect syslog for liberasurecode error report.\n```\n\nBut a serial double `close` is currently fine:\n```\n\u003e\u003e\u003e x \u003d pyeclib.ec_iface.ECDriver(k\u003d8, m\u003d4, ec_type\u003d\u0027liberasurecode_rs_vand\u0027)\n\u003e\u003e\u003e x.close()\n\u003e\u003e\u003e x.close()\n\u003e\u003e\u003e\n```\n\nI\u0027m open to suggestion.\n\n---\n\n*If* we want to try to smooth it over, maybe it\u0027d be more palatable reworded as\n```\ndef close(self) -\u003e None:\n    handle, self._handle \u003d self._handle, None\n    if handle is not None:\n        pyeclib_c.destroy(handle)\n```\n? Certainly it makes the *intent* pretty clear -- though `dis` tells me that the assignment isn\u0027t actually as atomic as it may appear:\n\n```\n\u003e\u003e\u003e dis.dis(pyeclib.core.ECPyECLibDriver.close)\n 86           0 RESUME                   0\n\n 87           2 LOAD_FAST                0 (self)\n              4 LOAD_ATTR                0 (_handle)\n             24 LOAD_CONST               0 (None)\n             26 SWAP                     2\n             28 STORE_FAST               1 (handle)\n             30 LOAD_FAST                0 (self)\n             32 STORE_ATTR               0 (_handle)\n\n 88          42 LOAD_FAST                1 (handle)\n             44 POP_JUMP_IF_NONE        22 (to 90)\n\n 89          46 LOAD_GLOBAL              3 (NULL + pyeclib_c)\n             56 LOAD_ATTR                4 (destroy)\n             76 LOAD_FAST                1 (handle)\n             78 CALL                     1\n             86 POP_TOP\n             88 RETURN_CONST             0 (None)\n\n 88     \u003e\u003e   90 RETURN_CONST             0 (None)\n```","commit_id":"8870d5b2d2c777e97495a0353edee80f3a67a803"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"e375a2c8c5717d3e15c0bc086d546f786d284fb6","unresolved":true,"context_lines":[{"line_number":93,"context_line":"            raise ECBackendInstanceNotAvailable("},{"line_number":94,"context_line":"                \"erasure coding handle is closed\""},{"line_number":95,"context_line":"            )"},{"line_number":96,"context_line":"        return handle"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"    def encode(self, data_bytes: bytes) -\u003e list[bytes]:"},{"line_number":99,"context_line":"        return pyeclib_c.encode(self.handle, data_bytes)"}],"source_content_type":"text/x-python","patch_set":1,"id":"8756c491_7569d142","line":96,"updated":"2026-08-20 15:44:00.000000000","message":"This sort of a change is *definitely* a good idea. Probably want something similar in `close` if we keep the `destroy` call.","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"},{"author":{"_account_id":38767,"name":"Wael Halbawi","display_name":"Wael Halbawi","email":"whalbawi@nvidia.com","username":"whalbawi"},"change_message_id":"8f58b6ee4c04ca6ffe095b4ce50eec94fda9eb5d","unresolved":false,"context_lines":[{"line_number":93,"context_line":"            raise ECBackendInstanceNotAvailable("},{"line_number":94,"context_line":"                \"erasure coding handle is closed\""},{"line_number":95,"context_line":"            )"},{"line_number":96,"context_line":"        return handle"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"    def encode(self, data_bytes: bytes) -\u003e list[bytes]:"},{"line_number":99,"context_line":"        return pyeclib_c.encode(self.handle, data_bytes)"}],"source_content_type":"text/x-python","patch_set":1,"id":"57c6df1a_526535e6","line":96,"in_reply_to":"8756c491_7569d142","updated":"2026-08-20 19:34:46.000000000","message":"Acknowledged","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"}],"test/test_pyeclib_api.py":[{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"e375a2c8c5717d3e15c0bc086d546f786d284fb6","unresolved":true,"context_lines":[{"line_number":1107,"context_line":"            encode_resume.set()"},{"line_number":1108,"context_line":"            thread.join()"},{"line_number":1109,"context_line":""},{"line_number":1110,"context_line":"            self.assertIsNone(exc)"},{"line_number":1111,"context_line":""},{"line_number":1112,"context_line":""},{"line_number":1113,"context_line":"if __name__ \u003d\u003d \"__main__\":"}],"source_content_type":"text/x-python","patch_set":1,"id":"0215e6c3_d90d76d3","line":1110,"updated":"2026-08-20 15:44:00.000000000","message":"Backing out the change under `src/`, this pops with\n```\nECBackendInstanceNotAvailable(\u0027pyeclib_c_encode ERROR: Backend instance not found. Please inspect syslog for liberasurecode error report.\u0027) is not None\n```\n...which kinda seems reasonable to me when there\u0027s a race like that. At least it\u0027s not a segfault! (I hit a fair few of those trying to get free-threaded builds working with `Py_MOD_GIL_NOT_USED` before I got the locking right in liberasurecode.)","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"},{"author":{"_account_id":38767,"name":"Wael Halbawi","display_name":"Wael Halbawi","email":"whalbawi@nvidia.com","username":"whalbawi"},"change_message_id":"8f58b6ee4c04ca6ffe095b4ce50eec94fda9eb5d","unresolved":false,"context_lines":[{"line_number":1107,"context_line":"            encode_resume.set()"},{"line_number":1108,"context_line":"            thread.join()"},{"line_number":1109,"context_line":""},{"line_number":1110,"context_line":"            self.assertIsNone(exc)"},{"line_number":1111,"context_line":""},{"line_number":1112,"context_line":""},{"line_number":1113,"context_line":"if __name__ \u003d\u003d \"__main__\":"}],"source_content_type":"text/x-python","patch_set":1,"id":"e338a358_b0c5668e","line":1110,"in_reply_to":"0215e6c3_d90d76d3","updated":"2026-08-20 19:34:46.000000000","message":"Acknowledged","commit_id":"9b94e0b20eea91b6196207bf213a9d774597e654"},{"author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"tag":"autogenerated:zuul:check","change_message_id":"a892e4a8d492fbbb9839505231dc7c290ecdcac1","unresolved":false,"context_lines":[{"line_number":1088,"context_line":"            self.assertTrue(close_resume.wait(timeout\u003d5))"},{"line_number":1089,"context_line":""},{"line_number":1090,"context_line":"        exc \u003d None"},{"line_number":1091,"context_line":"        def work():"},{"line_number":1092,"context_line":"            nonlocal exc"},{"line_number":1093,"context_line":"            try:"},{"line_number":1094,"context_line":"                self.driver.close()"}],"source_content_type":"text/x-python","patch_set":2,"id":"abbd40fb_cc6a41ab","line":1091,"updated":"2026-09-21 18:54:36.000000000","message":"pep8: E306 expected 1 blank line before a nested definition, found 0","commit_id":"275323a983f74a8c0786f772ff488d275341e6cf"},{"author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"tag":"autogenerated:zuul:check","change_message_id":"a892e4a8d492fbbb9839505231dc7c290ecdcac1","unresolved":false,"context_lines":[{"line_number":1096,"context_line":"                exc \u003d e"},{"line_number":1097,"context_line":""},{"line_number":1098,"context_line":"        with mock.patch(\"pyeclib_c.destroy\", side_effect\u003ddestroy_gated) \\"},{"line_number":1099,"context_line":"            as destroy_mock:"},{"line_number":1100,"context_line":"            thread \u003d threading.Thread(target\u003dwork)"},{"line_number":1101,"context_line":"            thread.start()"},{"line_number":1102,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"4545f501_21a6e170","line":1099,"updated":"2026-09-21 18:54:36.000000000","message":"pep8: E125 continuation line with same indent as next logical line","commit_id":"275323a983f74a8c0786f772ff488d275341e6cf"}]}
