Mark RubySingleThreadExecutor as a SerialExecutorService - #1070
Conversation
|
The old implementation doesn't look substantially different than the new one does. Both call Old implementation: Current implementation: I'll leave this PR open a little longer to see if anyone else has thoughts, otherwise I can accept it. |
|
I should also note I didn't see any test assertions of this behavior. The only place I saw concurrent-ruby/spec/concurrent/executor/executor_service_shared.rb Lines 202 to 211 in eae2851 |
|
That's what I saw too when checking if/how to adapt tests. On the other hand, the To be honest, my original intend for my question in #1069 was to ensure that the semantics of a Still, if this holds, it may be worthwhile to update the def serialized?
@max_length <= 1
endI believe the same should be valid for the |
…tive' from app/dependabot Bumps [concurrent-ruby](https://github.com/ruby-concurrency/concurrent- ruby) from 1.3.3 to 1.3.7. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/ruby- concurrency/concurrent-ruby/releases">concurrent-ruby's releases</a>.</em></p> <blockquote> <h2>v1.3.7</h2> <!-- raw HTML omitted --> <p>There are 3 security fixes in this release, so updating is recommended. These security vulnerabilities are not very likely to be hit in practice and have a corresponding <code>Low</code> severity score.</p> <!-- raw HTML omitted --> <h2>What's Changed</h2> <ul> <li><a href="https://github.com/ruby-concurrency/concurrent- ruby/security/advisories/GHSA-h8w8-99g7-qmvj">CVE-2026-54904</a> <code>AtomicReference#update</code> livelocks when the stored value is <code>Float::NAN</code>. Fix by <a href="https://github.com/joshuay03"><code>@joshuay03</code></a> and <a href="https://github.com/eregon"><code>@eregon</code></a></li> <li><a href="https://github.com/ruby-concurrency/concurrent- ruby/security/advisories/GHSA-wv3x-4vxv-whpp">CVE-2026-54905</a> <code>ReentrantReadWriteLock</code> read-count overflow grants a write lock without exclusivity. Fix by <a href="https://github.com/joshuay03"><code>@joshuay03</code></a></li> <li><a href="https://github.com/ruby-concurrency/concurrent- ruby/security/advisories/GHSA-6wx8-w4f5-wwcr">CVE-2026-54906</a> <code>ReadWriteLock</code> allows wrong-thread write release and stray read-release counter corruption. Fix by <a href="https://github.com/joshuay03"><code>@joshuay03</code></a></li> <li>concurrent-ruby-ext: fix build on Darwin 32-bit by <a href="https://github.com/barracuda156"><code>@barracuda156</code></a> in <a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/pull/1064">ruby-concurrency/concurrent-ruby#1064</a></li> <li>Add SECURITY.md by <a href="https://github.com/eregon"><code>@eregon</code></a> in <a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/pull/1104">ruby-concurrency/concurrent-ruby#1104</a></li> <li>Add Ruby 4.0 in CI by <a href="https://github.com/eregon"><code>@eregon</code></a> in <a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/pull/1106">ruby-concurrency/concurrent-ruby#1106</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/barracuda156"><code>@barracuda156</code></a> made their first contribution in <a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/pull/1064">ruby-concurrency/concurrent-ruby#1064</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/ruby- concurrency/concurrent- ruby/compare/v1.3.6...v1.3.7">https://github.com/ruby- concurrency/concurrent-ruby/compare/v1.3.6...v1.3.7</a></p> <h2>v1.3.6</h2> <!-- raw HTML omitted --> <h2>What's Changed</h2> <ul> <li>Run tests without the C extension in CI by <a href="https://github.com/eregon"><code>@eregon</code></a> in <a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/pull/1081">ruby-concurrency/concurrent-ruby#1081</a></li> <li>Fix typo in Promise docs by <a href="https://github.com/danieldiekme ier"><code>@danieldiekmeier</code></a> in <a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/pull/1083">ruby-concurrency/concurrent-ruby#1083</a></li> <li>Correct word in readme by <a href="https://github.com/wwahammy"><code>@wwahammy</code></a> in <a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/pull/1084">ruby-concurrency/concurrent-ruby#1084</a></li> <li>Fix mistakes in MVar documentation by <a href="https://github.com/trinistr"><code>@trinistr</code></a> in <a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/pull/1087">ruby-concurrency/concurrent-ruby#1087</a></li> <li>Fix multi require concurrent/executor/cached_thread_pool by <a href="https://github.com/OuYangJinTing"><code>@OuYangJinTing</code></a> in <a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/pull/1085">ruby-concurrency/concurrent-ruby#1085</a></li> <li>Use typed data APIs by <a href="https://github.com/nobu"><code>@nobu</code></a> in <a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/pull/1096">ruby-concurrency/concurrent-ruby#1096</a></li> <li>Add Joshua Young to the list of maintainers by <a href="https://github.com/eregon"><code>@eregon</code></a> in <a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/pull/1097">ruby-concurrency/concurrent-ruby#1097</a></li> <li>Asynchronous pruning for RubyThreadPoolExecutor by <a href="https://github.com/joshuay03"><code>@joshuay03</code></a> in <a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/pull/1082">ruby-concurrency/concurrent-ruby#1082</a></li> <li>Mark RubySingleThreadExecutor as a SerialExecutorService by <a href="https://github.com/meineerde"><code>@meineerde</code></a> in <a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/pull/1070">ruby-concurrency/concurrent-ruby#1070</a></li> <li>Allow TimerTask to be safely restarted after shutdown and avoid duplicate tasks by <a href="https://github.com/bensheldon"><code>@bensheldon</code></a> in <a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/pull/1001">ruby-concurrency/concurrent-ruby#1001</a></li> <li>Flaky test fix: allow ThreadPool to shutdown before asserting completed_task_count by <a href="https://github.com/bensheldon"><code>@bensheldon</code></a> in <a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/pull/1098">ruby-concurrency/concurrent-ruby#1098</a></li> <li><code>ThreadPoolExecutor#kill</code> will <code>wait_for_termination</code> in JRuby; ensure <code>TimerSet</code> timer thread shuts down cleanly by <a href="https://github.com/bensheldon"><code>@bensheldon</code></a> in <a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/pull/1044">ruby-concurrency/concurrent-ruby#1044</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/danieldiekmeier"><code>@danieldiekmeier </code></a> made their first contribution in <a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/pull/1083">ruby-concurrency/concurrent-ruby#1083</a></li> <li><a href="https://github.com/wwahammy"><code>@wwahammy</code></a> made their first contribution in <a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/pull/1084">ruby-concurrency/concurrent-ruby#1084</a></li> <li><a href="https://github.com/trinistr"><code>@trinistr</code></a> made their first contribution in <a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/pull/1087">ruby-concurrency/concurrent-ruby#1087</a></li> <li><a href="https://github.com/OuYangJinTing"><code>@OuYangJinTing</code></a> made their first contribution in <a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/pull/1085">ruby-concurrency/concurrent-ruby#1085</a></li> <li><a href="https://github.com/nobu"><code>@nobu</code></a> made their first contribution in <a href="https://redirect.github.com/ruby- concurrency/concurrent-ruby/pull/1096">ruby-concurrency/concurrent- ruby#1096</a></li> <li><a href="https://github.com/joshuay03"><code>@joshuay03</code></a> made their first contribution in <a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/pull/1082">ruby-concurrency/concurrent-ruby#1082</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/ruby- concurrency/concurrent- ruby/compare/v1.3.5...v1.3.6">https://github.com/ruby- concurrency/concurrent-ruby/compare/v1.3.5...v1.3.6</a></p> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/ruby- concurrency/concurrent-ruby/blob/master/CHANGELOG.md">concurrent-ruby's changelog</a>.</em></p> <blockquote> <h2>Release v1.3.7 (16 June 2026)</h2> <p>concurrent-ruby:</p> <ul> <li>See the <a href="https://github.com/ruby-concurrency/concurrent- ruby/releases/tag/v1.3.7">release notes on GitHub</a>.</li> </ul> <h2>Release v1.3.6 (13 December 2025)</h2> <p>concurrent-ruby:</p> <ul> <li>See the <a href="https://github.com/ruby-concurrency/concurrent- ruby/releases/tag/v1.3.6">release notes on GitHub</a>.</li> </ul> <h2>Release v1.3.5, edge v0.7.2 (15 January 2025)</h2> <p>concurrent-ruby:</p> <ul> <li>(<a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/issues/1062">#1062</a>) Remove dependency on logger.</li> </ul> <p>concurrent-ruby-edge:</p> <ul> <li>(<a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/issues/1062">#1062</a>) Remove dependency on logger.</li> </ul> <h2>Release v1.3.4 (10 August 2024)</h2> <ul> <li>(<a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/issues/1060">#1060</a>) Fix bug with return value of <code>Concurrent.available_processor_count</code> when <code>cpu.cfs_quota_us</code> is -1.</li> <li>(<a href="https://redirect.github.com/ruby-concurrency/concurrent- ruby/issues/1058">#1058</a>) Add <code>Concurrent.cpu_shares</code> that is cgroups aware.</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/ruby-concurrency/concurrent-ruby/commit/ 4c8fc28ab6bb9bd8258a4c0c2fa6d35ebe77b3cb"><code>4c8fc28</code></a> Release 1.3.7</li> <li><a href="https://github.com/ruby-concurrency/concurrent-ruby/commit/ d91ca9426cb819d6cc63f1bd64bfe54644d0beca"><code>d91ca94</code></a> Fix AtomicReference#update livelock when stored value is Float::NAN on JRuby ...</li> <li><a href="https://github.com/ruby-concurrency/concurrent-ruby/commit/ 7e4d711bacf7a1dac3ef6bda44004387be2dc7e6"><code>7e4d711</code></a> Fix <code>ReentrantReadWriteLock</code> read hold overflow into write-lock bit</li> <li><a href="https://github.com/ruby-concurrency/concurrent-ruby/commit/ 6e37e0644b83b182971dc540d2e4bee38df61386"><code>6e37e06</code></a> Fix <code>AtomicReference#update</code> livelock when stored value is <code>Float::NAN</code></li> <li><a href="https://github.com/ruby-concurrency/concurrent-ruby/commit/ 2825cfa12cb708b76557803957f76862eb1151a2"><code>2825cfa</code></a> Cleanup spec</li> <li><a href="https://github.com/ruby-concurrency/concurrent-ruby/commit/ 3fd493283ca5f84f0ef4e84aabd43ad68df4626b"><code>3fd4932</code></a> Fix <code>ReadWriteLock</code> wrong-thread write release and stray read release</li> <li><a href="https://github.com/ruby-concurrency/concurrent-ruby/commit/ 1974b4772efc034ee8eaa562b4370343f4c5c54b"><code>1974b47</code></a> Add Ruby 4.0 in CI</li> <li><a href="https://github.com/ruby-concurrency/concurrent-ruby/commit/ df8706d40c483d76bbb0b3a35a633c68fa9e17be"><code>df8706d</code></a> Add SECURITY.md (<a href="https://redirect.github.com/ruby- concurrency/concurrent-ruby/issues/1104">#1104</a>)</li> <li><a href="https://github.com/ruby-concurrency/concurrent-ruby/commit/ 7a1b78941c081106c20a9ca0144ac73a48d254ab"><code>7a1b789</code></a> Bump actions/upload-pages-artifact from 4 to 5</li> <li><a href="https://github.com/ruby-concurrency/concurrent-ruby/commit/ 9b2dbf712896a638a73d2fa221206961c8d6484d"><code>9b2dbf7</code></a> Bump actions/deploy-pages from 4 to 5</li> <li>Additional commits viewable in <a href="https://github.com/ruby- concurrency/concurrent-ruby/compare/v1.3.3...v1.3.7">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security- vulnerabilities/about-dependabot-security-updates#about-compatibility- scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/tursodatabase/turso/network/alerts). </details> Closes #7661
This resolves #1069.
However, I'm still not 100% sure if the
RubySingleThreadExecutoris actually serialized. From my understanding of the code, it is, but there may be edge-cases I'm missing (such as when the thread dies).As such, I'd still appreciate if someone who knows the (intended) RubyThreadPoolExecutor semantics to review this.