Title: Bug: race conditions in creating workspace_builds · Issue #1366 · coder/coder · GitHub
Open Graph Title: Bug: race conditions in creating workspace_builds · Issue #1366 · coder/coder
X Title: Bug: race conditions in creating workspace_builds · Issue #1366 · coder/coder
Description: OS Information OS: n/a Browser (if applicable): Architecture: coder --version: Coder v0.5.4-devel+d847d2b Spotted while reading code Steps to Reproduce execute "start" on a workspace from two clients simultaneously Expected one succeeds,...
Open Graph Description: OS Information OS: n/a Browser (if applicable): Architecture: coder --version: Coder v0.5.4-devel+d847d2b Spotted while reading code Steps to Reproduce execute "start" on a workspace from two clien...
X Description: OS Information OS: n/a Browser (if applicable): Architecture: coder --version: Coder v0.5.4-devel+d847d2b Spotted while reading code Steps to Reproduce execute "start" on a workspace from...
Opengraph URL: https://github.com/coder/coder/issues/1366
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bug: race conditions in creating workspace_builds ","articleBody":"## OS Information\r\n\r\n- OS: n/a\r\n- Browser (if applicable): \r\n- Architecture:\r\n- `coder --version`: Coder v0.5.4-devel+d847d2b\r\n\r\nSpotted while reading code\r\n\r\n## Steps to Reproduce\r\n\r\n1. execute \"start\" on a workspace from two clients simultaneously\r\n\r\n## Expected\r\n\r\none succeeds, other fails\r\n\r\n## Actual\r\n\r\nsometimes, both can succeed\r\n\r\n## Logs\r\n\r\n## Screenshot\r\n\r\n\u003c!-- Ideally provide a screenshot, gif, video or screen recording. -->\r\n\r\n## Notes\r\n\r\nThe issue is that coderd reads the DB to find the previous build, then later updates that build while adding a new build. The build could be updated and no longer be the latest during this time. What is needed is either:\r\n\r\n1. A query that finds and updates the latest build as well as adds the new build in a single transaction. This requires all \"is this an allowed transition\" logic to be build into the query.\r\n2. Start and hold open a transaction while doing multiple queries: reading the latest build, checking for errors, and finally writing the new build.\r\n\r\n\r\n","author":{"url":"https://github.com/spikecurtis","@type":"Person","name":"spikecurtis"},"datePublished":"2022-05-10T17:15:51Z","url":"https://github.com/coder/coder/issues/1366"}
| 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:646ec2f4-ddad-c130-aece-b385828de2de |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BCF8:3F4253:298369A:37504B1:6B01BC76 |
| html-safe-nonce | 2743f002c3e1bfa1c1442513d4de7ece485c0b4ca269e0a874e77dda62384f69 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQ0Y4OjNGNDI1MzoyOTgzNjlBOjM3NTA0QjE6NkIwMUJDNzYiLCJ2aXNpdG9yX2lkIjoiMjM0MzA3OTE5MjA1NDMxNjE1MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ccb71ec2a52372f09d48d0c316489ca7d3fe6f39bdd5830c7e97bb2565f8497a |
| hovercard-subject-tag | issue:1231460970 |
| 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/coder/coder/1366/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0135ec37218d2ab3d834961b5c03d67d8b82f43318dc9b6767922e328f372310/coder/coder/issues/1366 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0135ec37218d2ab3d834961b5c03d67d8b82f43318dc9b6767922e328f372310/coder/coder/issues/1366 |
| og:image:alt | OS Information OS: n/a Browser (if applicable): Architecture: coder --version: Coder v0.5.4-devel+d847d2b Spotted while reading code Steps to Reproduce execute "start" on a workspace from two clien... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | spikecurtis |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/coder/coder git https://github.com/coder/coder.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 440752086 |
| octolytics-dimension-repository_nwo | coder/coder |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 440752086 |
| octolytics-dimension-repository_network_root_nwo | coder/coder |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width