Title: Procedure update under load could result irreversible loss of code. · Issue #2379 · HeidiSQL/HeidiSQL · GitHub
Open Graph Title: Procedure update under load could result irreversible loss of code. · Issue #2379 · HeidiSQL/HeidiSQL
X Title: Procedure update under load could result irreversible loss of code. · Issue #2379 · HeidiSQL/HeidiSQL
Description: Description I believe this exists in ALL versions of HeidiSQL and MySQL (and possibly for other engines as well). When procedure is updated the following sequence of commands is being executed: SELECT ROUTINE_NAME FROM information_schema...
Open Graph Description: Description I believe this exists in ALL versions of HeidiSQL and MySQL (and possibly for other engines as well). When procedure is updated the following sequence of commands is being executed: SEL...
X Description: Description I believe this exists in ALL versions of HeidiSQL and MySQL (and possibly for other engines as well). When procedure is updated the following sequence of commands is being executed: SEL...
Opengraph URL: https://github.com/HeidiSQL/HeidiSQL/issues/2379
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Procedure update under load could result irreversible loss of code.","articleBody":"### Description\n\nI believe this exists in ALL versions of HeidiSQL and MySQL (and possibly for other engines as well). \n\nWhen procedure is updated the following sequence of commands is being executed:\n1. SELECT ROUTINE_NAME FROM `information_schema`.`ROUTINES` WHERE....\n2. CREATE PROCEDURE `HeidiSQL_temproutine_1`....\n3. DROP PROCEDURE IF EXISTS `HeidiSQL_temproutine_1`\\\\\n4. DROP PROCEDURE IF EXISTS `SP_NAME`\\\\\n5. CREATE PROCEDURE `SP_NAME`....\n\nThis works fine on an idle DB.\nHowever, I noticed when DB is under load (in my case it's a flow of SP calls with 50-150ms execution time each, but could be long running call as well) step 4 was execute already, but step 5 stuck in the waiting state (\"**Waiting for stored procedure metadata lock**\"). \nIt is logical that it cannot update SP while it's being executed. I don't know why the lock is not released immediately when SP execution finishes, but nevertheless it cannot run the CREATE statement even with small executions.\n\nSo, there is a situation when old procedure has been deleted already but new one was not created yet. This is very dangerous as workload starts to error (as procedure was deleted) and in my case it enters the loop keeping the lock.\nThis could last indefinitely. What people do when application hangs? they close it! So did I. When HeidiSQL was closed my procedure was gone. Even if I don't close app, a connection could be lost at any time due to network and result will be the same. Even without any problems on a client side, metadata lock will end with timeout after some time.\n\nI don't know how this should be solved (considering problems putting DDL in transactions) \nbut seems like creating temporary routine first and deleting it **at the very end** could help a bit. At least HeidiSQL could set a specific waiting period and kill query after it, and restore saved (old) version. Not ideal, but much better than a complete loss of an object in DB.\n\n\u003cimg width=\"271\" height=\"46\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/5c2657d8-6bd0-459b-b7fc-c12a5f122961\" /\u003e\n\n### HeidiSQL version\n\n12.14.0.7165\n\n### Database server version\n\nMySQL 8.0 \n\n### Reproduction recipe\n\n1. Create procedure.\n2. Call it in a loop.\n3. Modify SP code and press \"Save\"\n4. Check \"Waiting for stored procedure metadata lock\" for CREATE statement connection indefinite until step#2 is active\n5. Kill connection with CREATE statement\n6. Check that SP is lost in DB.\n\n### Error/Backtrace\n\n```shell\n\n```","author":{"url":"https://github.com/OXYAMINE","@type":"Person","name":"OXYAMINE"},"datePublished":"2026-01-22T07:29:56.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/2379/HeidiSQL/issues/2379"}
| 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:e398339c-f491-2a85-b362-da3d71cfdc9f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CA2A:3A8343:2E1A61:3D156B:6973EB07 |
| html-safe-nonce | 5604e10d46d849c4ba0521d40fd7f6edd4d56a32d51873bc3e6334665668977b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQTJBOjNBODM0MzoyRTFBNjE6M0QxNTZCOjY5NzNFQjA3IiwidmlzaXRvcl9pZCI6IjE0MTYwNDE4NzU5MjI3NDIwMjMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 883345ecfb7a37a8ccd2ef6af871ed193032e78f0fa52244c53700c3adb2f56f |
| hovercard-subject-tag | issue:3841634391 |
| 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/HeidiSQL/HeidiSQL/2379/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1ddfbaf9e7c4c4a41fc3ad68ca566b9939746ea9769b14a73d3aa18603dde9d8/HeidiSQL/HeidiSQL/issues/2379 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1ddfbaf9e7c4c4a41fc3ad68ca566b9939746ea9769b14a73d3aa18603dde9d8/HeidiSQL/HeidiSQL/issues/2379 |
| og:image:alt | Description I believe this exists in ALL versions of HeidiSQL and MySQL (and possibly for other engines as well). When procedure is updated the following sequence of commands is being executed: SEL... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | OXYAMINE |
| hostname | github.com |
| expected-hostname | github.com |
| None | 99794f659b61e238a7ec37595eeb36b54a0ba1f2ae246f51ccb8ac5e4f08812e |
| turbo-cache-control | no-preview |
| go-import | github.com/HeidiSQL/HeidiSQL git https://github.com/HeidiSQL/HeidiSQL.git |
| octolytics-dimension-user_id | 1338505 |
| octolytics-dimension-user_login | HeidiSQL |
| octolytics-dimension-repository_id | 109230350 |
| octolytics-dimension-repository_nwo | HeidiSQL/HeidiSQL |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 109230350 |
| octolytics-dimension-repository_network_root_nwo | HeidiSQL/HeidiSQL |
| 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 | 8b15a65f03216f079a4ae509ff400d3e2ce03b58 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width