Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH 1/1] txn_limbo: use fiber_clock() instead of fiber_time()
@ 2020-07-20 21:11 Vladislav Shpilevoy
  2020-07-20 22:09 ` Cyrill Gorcunov
  0 siblings, 1 reply; 3+ messages in thread
From: Vladislav Shpilevoy @ 2020-07-20 21:11 UTC (permalink / raw)
  To: tarantool-patches, gorcunov

box.ctl.clear_synchro_queue() used fiber_time()
instead of fiber_clock() to wait for a timeout. This is wrong,
fiber_time() is realtime, not suitable for relative timeouts.

For that purpose always should be used monotonic clock. The patch
fixes that.

Follow up #4849
---
Branch: http://github.com/tarantool/tarantool/tree/gerold103/qsync-fiber_clock
Issue: https://github.com/tarantool/tarantool/issues/4849

 src/box/box.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/box/box.cc b/src/box/box.cc
index 7a7befc32..45340df2e 100644
--- a/src/box/box.cc
+++ b/src/box/box.cc
@@ -960,9 +960,9 @@ box_clear_synchro_queue(void)
 
 	/* Wait until pending confirmations/rollbacks reach us. */
 	double timeout = 2 * replication_synchro_timeout;
-	double start_tm = fiber_time();
+	double start_tm = fiber_clock();
 	while (!txn_limbo_is_empty(&txn_limbo)) {
-		if (fiber_time() - start_tm > timeout)
+		if (fiber_clock() - start_tm > timeout)
 			break;
 		fiber_sleep(0.001);
 	}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Tarantool-patches] [PATCH 1/1] txn_limbo: use fiber_clock() instead of fiber_time()
  2020-07-20 21:11 [Tarantool-patches] [PATCH 1/1] txn_limbo: use fiber_clock() instead of fiber_time() Vladislav Shpilevoy
@ 2020-07-20 22:09 ` Cyrill Gorcunov
  2020-07-21 20:26   ` Vladislav Shpilevoy
  0 siblings, 1 reply; 3+ messages in thread
From: Cyrill Gorcunov @ 2020-07-20 22:09 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches

On Mon, Jul 20, 2020 at 11:11:39PM +0200, Vladislav Shpilevoy wrote:
> box.ctl.clear_synchro_queue() used fiber_time()
> instead of fiber_clock() to wait for a timeout. This is wrong,
> fiber_time() is realtime, not suitable for relative timeouts.
> 
> For that purpose always should be used monotonic clock. The patch
> fixes that.
> 
> Follow up #4849

(side note: monotonic clocks do not account acpi-deep-sleep state,
 ie when cpu is in sleep state it wont be accounted, but i think
 it is impossible scenario for us. so put this note just for
 reference).

Good catch!

Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Tarantool-patches] [PATCH 1/1] txn_limbo: use fiber_clock() instead of fiber_time()
  2020-07-20 22:09 ` Cyrill Gorcunov
@ 2020-07-21 20:26   ` Vladislav Shpilevoy
  0 siblings, 0 replies; 3+ messages in thread
From: Vladislav Shpilevoy @ 2020-07-21 20:26 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: tarantool-patches

Pushed to master.

On 21.07.2020 00:09, Cyrill Gorcunov wrote:
> On Mon, Jul 20, 2020 at 11:11:39PM +0200, Vladislav Shpilevoy wrote:
>> box.ctl.clear_synchro_queue() used fiber_time()
>> instead of fiber_clock() to wait for a timeout. This is wrong,
>> fiber_time() is realtime, not suitable for relative timeouts.
>>
>> For that purpose always should be used monotonic clock. The patch
>> fixes that.
>>
>> Follow up #4849
> 
> (side note: monotonic clocks do not account acpi-deep-sleep state,
>  ie when cpu is in sleep state it wont be accounted, but i think
>  it is impossible scenario for us. so put this note just for
>  reference).
> 
> Good catch!

Thanks for Leonid, he found the problem.

> Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>

Sorry, I forgot to add Acked-By, realized this after push.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-21 20:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-20 21:11 [Tarantool-patches] [PATCH 1/1] txn_limbo: use fiber_clock() instead of fiber_time() Vladislav Shpilevoy
2020-07-20 22:09 ` Cyrill Gorcunov
2020-07-21 20:26   ` Vladislav Shpilevoy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox