https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112020-03-28T11:46:55ZRuby Issue Tracking SystemRuby master - Bug #16740: Deprecating and removing the broken Process.clock_getreshttps://bugs.ruby-lang.org/issues/16740?journal_id=848002020-03-28T11:46:55ZEregon (Benoit Daloze)
<ul><li><strong>Related to</strong> <i><a class="issue tracker-2 status-5 priority-4 priority-default closed" href="/issues/8809">Feature #8809</a>: Process.clock_getres</i> added</li></ul> Ruby master - Bug #16740: Deprecating and removing the broken Process.clock_getreshttps://bugs.ruby-lang.org/issues/16740?journal_id=849932020-04-10T07:06:49Zakr (Akira Tanaka)akr@fsij.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Rejected</i></li></ul><p>We discussed this issue at a Ruby developer meeting.<br>
<a href="https://bugs.ruby-lang.org/issues/16693" class="external">https://bugs.ruby-lang.org/issues/16693</a></p>
<p>We don't want to remove the method.</p>
<p>(1) Removing a method is incompatible.</p>
<p>(2) Even if OS implementation of clock_getres is buggy, it is standardized in SUS and future OS may have better implementation.</p> Ruby master - Bug #16740: Deprecating and removing the broken Process.clock_getreshttps://bugs.ruby-lang.org/issues/16740?journal_id=850152020-04-10T12:23:19ZEregon (Benoit Daloze)
<ul></ul><p>OK. I'll improve the documentation to mention it's basically unreliable or broken on most operating systems.</p> Ruby master - Bug #16740: Deprecating and removing the broken Process.clock_getreshttps://bugs.ruby-lang.org/issues/16740?journal_id=850222020-04-10T14:48:02Zakr (Akira Tanaka)akr@fsij.org
<ul></ul><p>Eregon (Benoit Daloze) wrote in <a href="#note-3">#note-3</a>:</p>
<blockquote>
<p>OK. I'll improve the documentation to mention it's basically unreliable or broken on most operating systems.</p>
</blockquote>
<p>When describing such broken behavior, please describe<br>
(1) OS version and (2) actual behavior<br>
to confirm the behavior in future.</p> Ruby master - Bug #16740: Deprecating and removing the broken Process.clock_getreshttps://bugs.ruby-lang.org/issues/16740?journal_id=850242020-04-10T15:26:12Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul></ul><p>I don't think that it is a good idea to say "operating system bugs" in rdoc unless there is a solid evidence. You should report it to the upstream and confirm that it is actually a bug. For this particular case, I'm afraid if it is not a fault of OS but a hardware clock.</p> Ruby master - Bug #16740: Deprecating and removing the broken Process.clock_getreshttps://bugs.ruby-lang.org/issues/16740?journal_id=850272020-04-10T16:26:35ZEregon (Benoit Daloze)
<ul></ul><p><a href="https://github.com/ruby/spec/blob/ec844797a51a017ebc93af833e421362b4b24a17/core/process/fixtures/clocks.rb#L19-L59" class="external">https://github.com/ruby/spec/blob/ec844797a51a017ebc93af833e421362b4b24a17/core/process/fixtures/clocks.rb#L19-L59</a> and the hundreds of failures in CI are solid evidence.</p> Ruby master - Bug #16740: Deprecating and removing the broken Process.clock_getreshttps://bugs.ruby-lang.org/issues/16740?journal_id=850282020-04-10T16:34:39ZEregon (Benoit Daloze)
<ul></ul><p>I'm OK to change to "operating system or hardware bugs", although I don't think it's the fault of the hardware.<br>
clock_gettime() works perfectly fine, but clock_getres() on all platforms tested by Ruby is inaccurate for at least some clocks compared to the actual resolution of clock_gettime().<br>
The OS defines most clocks, so I'd think the bug is there.</p>
<p>I think it's hopeless to report upstream given this will never realistically be fixed and nobody seems to care and it's been broken for I would guess many years.</p>
<p>Sorry, I spent too much time trying to spec this completely broken function.</p> Ruby master - Bug #16740: Deprecating and removing the broken Process.clock_getreshttps://bugs.ruby-lang.org/issues/16740?journal_id=850312020-04-10T16:49:56Zakr (Akira Tanaka)akr@fsij.org
<ul></ul><p>Eregon (Benoit Daloze) wrote in <a href="#note-6">#note-6</a>:</p>
<blockquote>
<p><a href="https://github.com/ruby/spec/blob/ec844797a51a017ebc93af833e421362b4b24a17/core/process/fixtures/clocks.rb#L19-L59" class="external">https://github.com/ruby/spec/blob/ec844797a51a017ebc93af833e421362b4b24a17/core/process/fixtures/clocks.rb#L19-L59</a> and the hundreds of failures in CI are solid evidence.</p>
</blockquote>
<p>It doesn't describe OS version and actual problem of OS behavior.</p> Ruby master - Bug #16740: Deprecating and removing the broken Process.clock_getreshttps://bugs.ruby-lang.org/issues/16740?journal_id=850352020-04-10T18:01:54Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul></ul><p>Eregon (Benoit Daloze) wrote in <a href="#note-6">#note-6</a>:</p>
<blockquote>
<p><a href="https://github.com/ruby/spec/blob/ec844797a51a017ebc93af833e421362b4b24a17/core/process/fixtures/clocks.rb#L19-L59" class="external">https://github.com/ruby/spec/blob/ec844797a51a017ebc93af833e421362b4b24a17/core/process/fixtures/clocks.rb#L19-L59</a> and the hundreds of failures in CI are solid evidence.</p>
</blockquote>
<p>Some of the committers suspected the expectation of the spec. The spec assumes that <code>clock_gettime</code> may return a number whose resolution digit is non-zero. But some people said, it might be only guaranteed that the number returned by <code>clock_gettime</code> is a multiple of the resolution. (IMO, this interpretation of "resolution" is too conservative, but some people actually think so.)</p>
<p>We receive many "bug" reports, but many of them are not a bug. Before we call it a "bug" in the official document, it would be good to ask the developers.</p> Ruby master - Bug #16740: Deprecating and removing the broken Process.clock_getreshttps://bugs.ruby-lang.org/issues/16740?journal_id=850362020-04-10T21:47:57ZEregon (Benoit Daloze)
<ul></ul><p>akr (Akira Tanaka) wrote in <a href="#note-8">#note-8</a>:</p>
<blockquote>
<p>It doesn't describe OS version and actual problem of OS behavior.</p>
</blockquote>
<p>If you look at the "blame" you can easily find CI logs, including OS versions and which clocks failed.</p>
<p>Blame: <a href="https://github.com/ruby/spec/blame/ec844797a51a017ebc93af833e421362b4b24a17/core/process/fixtures/clocks.rb#L19-L59" class="external">https://github.com/ruby/spec/blame/ec844797a51a017ebc93af833e421362b4b24a17/core/process/fixtures/clocks.rb#L19-L59</a></p>
<p>For instance:<br>
<a href="https://github.com/ruby/spec/commit/730d967e06b0f3512e37c2105f1c44c717be674c" class="external">https://github.com/ruby/spec/commit/730d967e06b0f3512e37c2105f1c44c717be674c</a><br>
<a href="https://github.com/ruby/spec/commit/1090192fd712ab5f6e30c0535bac3c52a2af47e5" class="external">https://github.com/ruby/spec/commit/1090192fd712ab5f6e30c0535bac3c52a2af47e5</a><br>
<a href="https://github.com/ruby/spec/commit/c3c89c580a2c4c6d12e055ef21da5ef5c8f6e81e" class="external">https://github.com/ruby/spec/commit/c3c89c580a2c4c6d12e055ef21da5ef5c8f6e81e</a></p> Ruby master - Bug #16740: Deprecating and removing the broken Process.clock_getreshttps://bugs.ruby-lang.org/issues/16740?journal_id=850372020-04-10T22:09:18ZEregon (Benoit Daloze)
<ul></ul><p>mame (Yusuke Endoh) wrote in <a href="#note-9">#note-9</a>:</p>
<blockquote>
<p>But some people said, it might be only guaranteed that the number returned by <code>clock_gettime</code> is a multiple of the resolution.</p>
</blockquote>
<p>Sometimes it returns a resolution less than precise than the clock, but sometimes more precise than the clock, i.e., it's inaccurate both ways.</p>
<p>I don't think it's an issue of the spec, manual testing also confirms it's inaccurate:<br>
<a href="https://github.com/ruby/spec/commit/ec48b92efe3f1d234110eefcea7140896219734d#diff-8906d6a3637b6976b884ac506096afc5" class="external">https://github.com/ruby/spec/commit/ec48b92efe3f1d234110eefcea7140896219734d#diff-8906d6a3637b6976b884ac506096afc5</a></p>
<p>And sometimes it's plain buggy and I doubt this can be seen any other way when clock_getres() returns a negative value:<br>
<a href="https://rubyci.org/logs/rubyci.s3.amazonaws.com/centos6/ruby-trunk/log/20190428T093004Z.fail.html.gz" class="external">https://rubyci.org/logs/rubyci.s3.amazonaws.com/centos6/ruby-trunk/log/20190428T093004Z.fail.html.gz</a></p>
<p>I don't have time to report these bugs to all operations systems.<br>
I've spent hours trying to fix that spec and saw 5+ operating systems fail on in total 10+ clocks, that's all the proof I need to say this is completely broken and unusable.</p>
<p>Feel free to tweak the wording in RDoc if you think "operating system bugs" is too strong but I think it's accurate.<br>
I mean it mostly as "not Ruby's bug, but a bug below and OS are inaccurate differently for <code>clock_getres()</code> so it seems most likely a bug of the OS".</p> Ruby master - Bug #16740: Deprecating and removing the broken Process.clock_getreshttps://bugs.ruby-lang.org/issues/16740?journal_id=850432020-04-11T01:51:55Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul></ul><p>Eregon (Benoit Daloze) wrote in <a href="#note-11">#note-11</a>:</p>
<blockquote>
<p>I don't have time to report these bugs to all operations systems.<br>
I've spent hours trying to fix that spec and saw 5+ operating systems fail on in total 10+ clocks, that's all the proof I need to say this is completely broken and unusable.</p>
<p>Feel free to tweak the wording in RDoc if you think "operating system bugs" is too strong but I think it's accurate.<br>
I mean it mostly as "not Ruby's bug, but a bug below and OS are inaccurate differently for <code>clock_getres()</code> so it seems most likely a bug of the OS".</p>
</blockquote>
<p>Personally, I like to write nothing about the accuracy if we cannot be responsible.</p>
<p>As <a class="user active user-mention" href="https://bugs.ruby-lang.org/users/271">@akr (Akira Tanaka)</a> said, OS names and behaviors should be elaborated in the note so that we will be able to determine if the underlying API is fixed and to remove the note in future. We cannot do so if only "inaccurate on most platform" is written.</p>
<p>If no document is written at all, we don't have to do nothing. We can consider adding such a note if many people face the accuracy issue in practice and report to Ruby.</p> Ruby master - Bug #16740: Deprecating and removing the broken Process.clock_getreshttps://bugs.ruby-lang.org/issues/16740?journal_id=850902020-04-13T16:16:54ZEregon (Benoit Daloze)
<ul></ul><p>I don't think a list of ~15 cases of OS+clock would be helpful there, it's basically all OS we test.<br>
And I doubt anyone would ever bother to update that list anyway.<br>
I think clock_getres() will remain broken or inaccurate forever.</p> Ruby master - Bug #16740: Deprecating and removing the broken Process.clock_getreshttps://bugs.ruby-lang.org/issues/16740?journal_id=850912020-04-13T16:26:41ZEregon (Benoit Daloze)
<ul><li><strong>Assignee</strong> set to <i>Eregon (Benoit Daloze)</i></li></ul><p>I added an explicit list based on the file linked above in a6f7458ea81e084f6ebe7dc5c8cb5b7cb70fe2be.<br>
On the upside it should be even clearer nobody should use this method.<br>
I consider this issue resolved.</p>