Title: Cython version leaks all handles · Issue #8 · tmetsch/python-dtrace · GitHub
Open Graph Title: Cython version leaks all handles · Issue #8 · tmetsch/python-dtrace
X Title: Cython version leaks all handles · Issue #8 · tmetsch/python-dtrace
Description: In the Cython version, the handles are closed in __del__ both for DTraceConsumer and DTraceContinuousConsumer (used by DTraceConsumerThread). However, these are extension types, and Cython does not use __del__ for extension types (for wh...
Open Graph Description: In the Cython version, the handles are closed in __del__ both for DTraceConsumer and DTraceContinuousConsumer (used by DTraceConsumerThread). However, these are extension types, and Cython does not...
X Description: In the Cython version, the handles are closed in __del__ both for DTraceConsumer and DTraceContinuousConsumer (used by DTraceConsumerThread). However, these are extension types, and Cython does not...
Opengraph URL: https://github.com/tmetsch/python-dtrace/issues/8
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cython version leaks all handles","articleBody":"In the Cython version, the handles are closed in `__del__` both for DTraceConsumer and DTraceContinuousConsumer (used by DTraceConsumerThread). However, these are extension types, and Cython [does not use `__del__` for extension types][1] (for whatever reason), so they will never be called (the explicit `del self.consumer` in DTraceConsumerThread's destructor, which *is* called as it's a normal Python object, just ensures the DTraceContinuousConsumer gets deallocated, but the consumer's `__del__` still won't be called). I believe using `__dealloc__` for the two extension classes would work (though `handle` must be checked for being non-null first).\r\n\r\nThis has also exposed a (minor) potential issue: with Cython, [`__init__` can end up being called multiple times][2], so technically `handle` could be initialised twice, leaking the old return from `dtrace_open`. To be truly correct, either `__init__` should guard against this, or `__cinit__` should be used instead, which will only ever be called once.\r\n\r\n[1]: http://docs.cython.org/en/latest/src/userguide/special_methods.html#finalization-method-dealloc\r\n[2]: http://docs.cython.org/en/latest/src/userguide/special_methods.html#initialisation-methods-cinit-and-init","author":{"url":"https://github.com/jrtc27","@type":"Person","name":"jrtc27"},"datePublished":"2017-11-07T01:04:00.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/8/python-dtrace/issues/8"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a7946e1f-da48-882d-694b-10b1a3d30ff8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AF36:6E05D:448357:57A873:6992864E |
| html-safe-nonce | 145a5a9e949e53de7280acb44e01f85dd2bf8dddbf10e03f5482ae7da76697d4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRjM2OjZFMDVEOjQ0ODM1Nzo1N0E4NzM6Njk5Mjg2NEUiLCJ2aXNpdG9yX2lkIjoiMTY5MTc5MzYyNDAyOTg5MDEyNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | fffc5e48baf27fc7378af7d923324525cc592e4a2a16dc7ad32983cf948ed0f2 |
| hovercard-subject-tag | issue:271675233 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/tmetsch/python-dtrace/8/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f9db6d1426cb4f4fdd9c85cb98fedb92e9ba2703ee7ae073efc7448728f32207/tmetsch/python-dtrace/issues/8 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f9db6d1426cb4f4fdd9c85cb98fedb92e9ba2703ee7ae073efc7448728f32207/tmetsch/python-dtrace/issues/8 |
| og:image:alt | In the Cython version, the handles are closed in __del__ both for DTraceConsumer and DTraceContinuousConsumer (used by DTraceConsumerThread). However, these are extension types, and Cython does not... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jrtc27 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/tmetsch/python-dtrace git https://github.com/tmetsch/python-dtrace.git |
| octolytics-dimension-user_id | 332745 |
| octolytics-dimension-user_login | tmetsch |
| octolytics-dimension-repository_id | 2530864 |
| octolytics-dimension-repository_nwo | tmetsch/python-dtrace |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 2530864 |
| octolytics-dimension-repository_network_root_nwo | tmetsch/python-dtrace |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width