Title: Unprotected callbacks from CAN RX thread · Issue #284 · canopen-python/canopen · GitHub
Open Graph Title: Unprotected callbacks from CAN RX thread · Issue #284 · canopen-python/canopen
X Title: Unprotected callbacks from CAN RX thread · Issue #284 · canopen-python/canopen
Description: In my work of porting canopen to asyncio, I stubled across that canopen contains a lot of unprotected thread crossings. By and large all callbacks coming from can through Network.notify() run in another thread. This means that all subscr...
Open Graph Description: In my work of porting canopen to asyncio, I stubled across that canopen contains a lot of unprotected thread crossings. By and large all callbacks coming from can through Network.notify() run in an...
X Description: In my work of porting canopen to asyncio, I stubled across that canopen contains a lot of unprotected thread crossings. By and large all callbacks coming from can through Network.notify() run in an...
Opengraph URL: https://github.com/canopen-python/canopen/issues/284
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unprotected callbacks from CAN RX thread","articleBody":"In my work of porting canopen to asyncio, I stubled across that canopen contains a lot of unprotected thread crossings. By and large all callbacks coming from can through `Network.notify()` run in another thread. This means that all subscribed callbacks must protect any class members access, otherwise interesting results may arise. Many callback handlers have synchronization mechanisms, but there a still quite a few that does not.\r\n\r\n```\r\nemcy.py:EcmyConsumer.on_emcy() Callbacks are not protected\r\nnetwork.py:NodeScanner.on_message_received() self.nodes is not protected\r\nnmt.py:NmtBase.on_command() self._state is update and not protected\r\nnmt.py:NmtSlave.on_command() self.update_heartbeat() is called which alters state\r\nprofiles/p402.py:BaseNode402.on_TPDOs_update_callback() self.tpdo_values[] updated from thread\r\nsdo/server.py:SdoServer:on_request() Modifies lots of variables\r\n```\r\n\r\nI haven't investigated how many of these have an implicit safe design. This issue is mostly for information, but in general race conditions due to missing synchronization protection is sporadic and hard to debug.","author":{"url":"https://github.com/sveinse","@type":"Person","name":"sveinse"},"datePublished":"2021-11-13T23:41:31.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/284/canopen/issues/284"}
| 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:31b909b5-5658-4e00-fdd9-7306701a0683 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9002:1C9D94:63E4B03:83C53EF:6A5DCFFD |
| html-safe-nonce | 2b30fe703094b2ba6a0a7dacf46b1ea43ebd1bc1618ca186e1af3845c4612644 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MDAyOjFDOUQ5NDo2M0U0QjAzOjgzQzUzRUY6NkE1RENGRkQiLCJ2aXNpdG9yX2lkIjoiMjAxNzIzMzg4NjMzMTQxMjQ2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d3ecdc26f609859c5b5cd9254d6ba4e938829571d6a8f34b3f04dd73c090efb6 |
| hovercard-subject-tag | issue:1052803214 |
| 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/canopen-python/canopen/284/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ca53ae5cafa2a5d73a9263f6ba0b60bab67762d76c8aeed12bf3bd56d99bb7f7/canopen-python/canopen/issues/284 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ca53ae5cafa2a5d73a9263f6ba0b60bab67762d76c8aeed12bf3bd56d99bb7f7/canopen-python/canopen/issues/284 |
| og:image:alt | In my work of porting canopen to asyncio, I stubled across that canopen contains a lot of unprotected thread crossings. By and large all callbacks coming from can through Network.notify() run in an... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sveinse |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/canopen-python/canopen git https://github.com/canopen-python/canopen.git |
| octolytics-dimension-user_id | 200581454 |
| octolytics-dimension-user_login | canopen-python |
| octolytics-dimension-repository_id | 68737600 |
| octolytics-dimension-repository_nwo | canopen-python/canopen |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 68737600 |
| octolytics-dimension-repository_network_root_nwo | canopen-python/canopen |
| 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 | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width