Title: The timeout setting is not honored when a transaction is active (with example) · Issue #124510 · python/cpython · GitHub
Open Graph Title: The timeout setting is not honored when a transaction is active (with example) · Issue #124510 · python/cpython
X Title: The timeout setting is not honored when a transaction is active (with example) · Issue #124510 · python/cpython
Description: Bug report Bug description: The timeout argument to sqlite3.connect is not honored and a "sqlite3.OperationalError: database is locked" is triggered immediately if this script is invoked a second time while the first is still running (sl...
Open Graph Description: Bug report Bug description: The timeout argument to sqlite3.connect is not honored and a "sqlite3.OperationalError: database is locked" is triggered immediately if this script is invoked a second t...
X Description: Bug report Bug description: The timeout argument to sqlite3.connect is not honored and a "sqlite3.OperationalError: database is locked" is triggered immediately if this script is invoked ...
Opengraph URL: https://github.com/python/cpython/issues/124510
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"The timeout setting is not honored when a transaction is active (with example)","articleBody":"# Bug report\n\n### Bug description:\n\nThe timeout argument to sqlite3.connect is not honored and a \"sqlite3.OperationalError: database is locked\" is triggered immediately if this script is invoked a second time while the first is still running (sleeping). This only happens when a\ntransaction is active - if the BEGIN statement is removed the bug is not triggered.\n\nExpected behavior: the script should wait for up to 10 seconds for the first invocation to finish before giving up\nActual behavior: the script immediately crashes with \"sqlite3.OperationalError: database is locked\"\n\nPython version: 3.11.2 (Debian: python3.11-minimal 3.11.2-6+deb12u3, libpython3.11-stdlib:amd64 3.11.2-6+deb12u3)\nSQLite version: 3.40.1 (Debian: sqlite3 3.40.1-2)\nOS: Debian GNU/Linux 12.7\nKernel: Linux 6.1.0-22-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.94-1 (2024-06-21) x86_64 GNU/Linux\n\n```\n#\n# a table must be manually created first:\n# sqlite3 testcase.db 'CREATE TABLE IF NOT EXISTS customers (a)'\n# (if this is done by the script the bug is not triggered for some reason)\n#\n\nimport sqlite3\nimport time\n\nconn = sqlite3.connect(\n 'testcase.db',\n isolation_level = None, # test case will work even if this is left out\n timeout = 10\n)\n\nc = conn.cursor()\n\nprint('starting transaction')\nc.execute('''BEGIN''')\nprint('transaction started')\n\nprint('doing SELECT')\nc.execute('SELECT * FROM customers', ())\nprint('did SELECT')\n\nprint('doing UPDATE')\nc.execute('UPDATE customers SET a = 0 WHERE a = 999999', ())\nprint('did UPDATE')\n\nprint('sleeping')\ntime.sleep(30)\nprint('slept')\n\nprint('transaction ended')\n\n```\n\n\n### CPython versions tested on:\n\n3.11\n\n### Operating systems tested on:\n\nLinux","author":{"url":"https://github.com/jogc","@type":"Person","name":"jogc"},"datePublished":"2024-09-25T10:42:41.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/124510/cpython/issues/124510"}
| 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:cae26a09-188d-792e-cddc-1c3ac0604641 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AFFA:12FD57:38E427:4D41AB:6969DA44 |
| html-safe-nonce | 70fd2c1375cf9f5b2f918ed9221b0a4bf2e564387778c9cee3034385d04703e8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRkZBOjEyRkQ1NzozOEU0Mjc6NEQ0MUFCOjY5NjlEQTQ0IiwidmlzaXRvcl9pZCI6Ijg3MjAxMzkyNTQ2NTEwMTc3OTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d64301a9112d1b457fb0003171067a015e51aa9027979334bab57c5e6786f3f2 |
| hovercard-subject-tag | issue:2547632373 |
| 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/cpython/124510/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bd289ec8cea655e7631834a033b1b8f8f1f5aa265921cbe685bb6149eaed85ea/python/cpython/issues/124510 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bd289ec8cea655e7631834a033b1b8f8f1f5aa265921cbe685bb6149eaed85ea/python/cpython/issues/124510 |
| og:image:alt | Bug report Bug description: The timeout argument to sqlite3.connect is not honored and a "sqlite3.OperationalError: database is locked" is triggered immediately if this script is invoked a second t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jogc |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| 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 | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width