Title: Dispatcher force updating persistence object's chat data attribute · Issue #1452 · python-telegram-bot/python-telegram-bot · GitHub
Open Graph Title: Dispatcher force updating persistence object's chat data attribute · Issue #1452 · python-telegram-bot/python-telegram-bot
X Title: Dispatcher force updating persistence object's chat data attribute · Issue #1452 · python-telegram-bot/python-telegram-bot
Description: Steps to reproduce Use the echobot2 example code with a few changes list below. In main function create a DictPersistence object with store_chat_data set to False. Create the Updater object with persistence set to the object created in t...
Open Graph Description: Steps to reproduce Use the echobot2 example code with a few changes list below. In main function create a DictPersistence object with store_chat_data set to False. Create the Updater object with pe...
X Description: Steps to reproduce Use the echobot2 example code with a few changes list below. In main function create a DictPersistence object with store_chat_data set to False. Create the Updater object with pe...
Opengraph URL: https://github.com/python-telegram-bot/python-telegram-bot/issues/1452
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Dispatcher force updating persistence object's chat data attribute","articleBody":"\u003c!--\r\nThanks for reporting issues of python-telegram-bot!\r\n\r\nUse this template to notify us if you found a bug, or if you want to request a new feature.\r\nIf you're looking for help with programming your bot using our library, feel free to ask your\r\nquestions in out telegram group at: https://t.me/pythontelegrambotgroup\r\n\r\nTo make it easier for us to help you please enter detailed information below.\r\n\r\nPlease note, we only support the latest version of python-telegram-bot and\r\nmaster branch. Please make sure to upgrade & recreate the issue on the latest\r\nversion prior to opening an issue.\r\n-->\r\n### Steps to reproduce\r\n1. Use the echobot2 example code with a few changes list below.\r\n\r\n2. In main function create a DictPersistence object with store_chat_data set to False.\r\n\r\n2. Create the Updater object with persistence set to the object created in the second step.\r\n\r\n4. Send SIGKILL to the process in which the example code is launched.\r\n### Expected behaviour\r\nThe code should normally terminate.\r\n\r\n### Actual behaviour\r\nThe code terminates with the following error:\r\nFile \".../echobot2.py\", line 81, in main\r\n updater.idle()\r\n File \".../.venv/lib/python3.7/site-packages/telegram/ext/updater.py\", line 529, in idle\r\n sleep(1)\r\n File \".../.venv/lib/python3.7/site-packages/telegram/ext/updater.py\", line 504, in signal_handler\r\n self.dispatcher.update_persistence()\r\n File \".../.venv/lib/python3.7/site-packages/telegram/ext/dispatcher.py\", line 437, in update_persistence\r\n self.persistence.update_chat_data(chat_id, self.chat_data[chat_id])\r\n File \".../.venv/lib/python3.7/site-packages/telegram/ext/dictpersistence.py\", line 193, in update_chat_data\r\n if self._chat_data.get(chat_id) == data:\r\nAttributeError: 'NoneType' object has no attribute 'get'\r\n\r\nTracing back the error, it seems that when receiving the SIGKILL signal, the dispatcher is force updating the persistence object's chat data attribute without checking its store_chat_data attribute, see the following code from telegram.ext.dispatcher.py:\r\n\r\n def update_persistence(self):\r\n \"\"\"Update :attr:`user_data` and :attr:`chat_data` in :attr:`persistence`.\r\n \"\"\"\r\n if self.persistence:\r\n for chat_id in self.chat_data:\r\n self.persistence.update_chat_data(chat_id, self.chat_data[chat_id])\r\n for user_id in self.user_data:\r\n self.persistence.update_user_data(user_id, self.user_data[user_id])\r\n\r\n### Configuration\r\n**Operating System:**\r\nManjaro 18.0.4 Illyria\r\n\r\n**Version of Python, python-telegram-bot & dependencies:**\r\npython-telegram-bot 12.0.0b1\r\ncertifi 2019.06.16\r\nfuture 0.17.1\r\nPython 3.7.3 (default, Jun 24 2019, 04:54:02) [GCC 9.1.0]","author":{"url":"https://github.com/CuriousGeorgiy","@type":"Person","name":"CuriousGeorgiy"},"datePublished":"2019-07-20T20:18:59Z","url":"https://github.com/python-telegram-bot/python-telegram-bot/issues/1452"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:8a77711b-0c19-273c-2874-bd2871002491 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A80E:D5B7F:D8A052:11C4A19:6B0279C7 |
| html-safe-nonce | 06ff365115b40472329625b7d63152f355a8d49813cabfa64fa860b1e3327b1b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBODBFOkQ1QjdGOkQ4QTA1MjoxMUM0QTE5OjZCMDI3OUM3IiwidmlzaXRvcl9pZCI6Ijc5MTA0NTcxNTI1MjE3OTYwMzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | dd13342c0b7085e4a1864225fc1c66a40ad71cd1f901128cea57351063045435 |
| hovercard-subject-tag | issue:470710964 |
| 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/python-telegram-bot/python-telegram-bot/1452/issue_layout |
| twitter:image | https://opengraph.githubassets.com/92b33aee7e56918eb34d7093ad2ce5a039c471146bc8ecd404f24f5ac979605c/python-telegram-bot/python-telegram-bot/issues/1452 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/92b33aee7e56918eb34d7093ad2ce5a039c471146bc8ecd404f24f5ac979605c/python-telegram-bot/python-telegram-bot/issues/1452 |
| og:image:alt | Steps to reproduce Use the echobot2 example code with a few changes list below. In main function create a DictPersistence object with store_chat_data set to False. Create the Updater object with pe... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | CuriousGeorgiy |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-telegram-bot/python-telegram-bot git https://github.com/python-telegram-bot/python-telegram-bot.git |
| octolytics-dimension-user_id | 16178365 |
| octolytics-dimension-user_login | python-telegram-bot |
| octolytics-dimension-repository_id | 38696925 |
| octolytics-dimension-repository_nwo | python-telegram-bot/python-telegram-bot |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 38696925 |
| octolytics-dimension-repository_network_root_nwo | python-telegram-bot/python-telegram-bot |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width