<HTML><BODY><div>Hi team, </div><div> </div><div>QA LGTM</div><div> </div><div> </div><div data-signature-widget="container"><div spellcheck="false" data-signature-widget="content"><div>--<br>Vitaliia Ioffe</div></div></div><div> </div><div> </div><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;">Пятница, 13 августа 2021, 17:15 +03:00 от Yaroslav Dynnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>:<br> <div id=""><div class="js-helper js-readmsg-msg"><div><div id="style_16288641392033835983_BODY"><div class="cl_111065"><div><div>That's even better, still LGTM.</div><div> </div><div><div><div class="gmail_signature_mr_css_attr"><div><div><div><span>Best regards</span></div><div><span>Yaroslav Dynnikov</span></div></div></div></div></div></div></div> <div class="gmail_quote_mr_css_attr"><div class="mail-quote-collapse"><div class="gmail_attr_mr_css_attr"><span>On Fri, 13 Aug 2021 at 15:14, Vladimir Davydov <<a href="//e.mail.ru/compose/?mailto=mailto%3avdavydov@tarantool.org">vdavydov@tarantool.org</a>> wrote:</span></div><div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote_mr_css_attr">It didn't yield before commit 954194a1ca5c ("net.box: rewrite request<br>implementation in C"). It shouldn't yield now.<br><br>Follow-up #6241<br>---<br><a href="https://github.com/tarantool/tarantool/tree/vdavydov/netbox-dont-yield-in-future-wait-result-if-timeout-is-0" target="_blank">https://github.com/tarantool/tarantool/tree/vdavydov/netbox-dont-yield-in-future-wait-result-if-timeout-is-0</a><br><br>Changes in v2:<br> - Improved test.<br><br> src/box/lua/net_box.c | 2 +<br> test/box/net.box_fiber-async_gh-3107.result | 48 +++++++++++++++++++<br> test/box/net.box_fiber-async_gh-3107.test.lua | 20 ++++++++<br> 3 files changed, 70 insertions(+)<br><br>diff --git a/src/box/lua/net_box.c b/src/box/lua/net_box.c<br>index 229dec590cf9..43a7d78a1122 100644<br>--- a/src/box/lua/net_box.c<br>+++ b/src/box/lua/net_box.c<br>@@ -235,6 +235,8 @@ netbox_request_complete(struct netbox_request *request)<br> static inline bool<br> netbox_request_wait(struct netbox_request *request, double *timeout)<br> {<br>+ if (*timeout == 0)<br>+ return false;<br> double ts = ev_monotonic_now(loop());<br> int rc = fiber_cond_wait_timeout(&request->cond, *timeout);<br> *timeout -= ev_monotonic_now(loop()) - ts;<br>diff --git a/test/box/net.box_fiber-async_gh-3107.result b/test/box/net.box_fiber-async_gh-3107.result<br>index aaaca351a579..ec2fd4f6441a 100644<br>--- a/test/box/net.box_fiber-async_gh-3107.result<br>+++ b/test/box/net.box_fiber-async_gh-3107.result<br>@@ -104,6 +104,54 @@ err:find('Usage') ~= nil<br> ---<br> - true<br> ...<br>+--<br>+-- Check that there's no unexpected yields.<br>+--<br>+function assert_no_csw(func, ...) \<br>+ local csw1 = <a href="http://fiber.info" target="_blank">fiber.info</a>()[<a href="http://fiber.id" target="_blank">fiber.id</a>()].csw \<br>+ local ret = {func(...)} \<br>+ local csw2 = <a href="http://fiber.info" target="_blank">fiber.info</a>()[<a href="http://fiber.id" target="_blank">fiber.id</a>()].csw \<br>+ assert(csw2 - csw1 == 0) \<br>+ return unpack(ret) \<br>+end<br>+---<br>+...<br>+future = c:call('long_function', {1, 2, 3}, {is_async = true})<br>+---<br>+...<br>+assert_no_csw(future.is_ready, future)<br>+---<br>+- false<br>+...<br>+assert_no_csw(future.result, future)<br>+---<br>+- null<br>+- Response is not ready<br>+...<br>+assert_no_csw(future.wait_result, future, 0)<br>+---<br>+- null<br>+- Timeout exceeded<br>+...<br>+finalize_long()<br>+---<br>+...<br>+future:wait_result()<br>+---<br>+- [1, 2, 3]<br>+...<br>+assert_no_csw(future.is_ready, future)<br>+---<br>+- true<br>+...<br>+assert_no_csw(future.result, future)<br>+---<br>+- [1, 2, 3]<br>+...<br>+assert_no_csw(future.wait_result, future)<br>+---<br>+- [1, 2, 3]<br>+...<br> box.schema.func.drop('long_function')<br> ---<br> ...<br>diff --git a/test/box/net.box_fiber-async_gh-3107.test.lua b/test/box/net.box_fiber-async_gh-3107.test.lua<br>index d23f368cbce4..71ba50b62ccb 100644<br>--- a/test/box/net.box_fiber-async_gh-3107.test.lua<br>+++ b/test/box/net.box_fiber-async_gh-3107.test.lua<br>@@ -36,6 +36,26 @@ err:find('Usage') ~= nil<br> _, err = pcall(future.wait_result, future, '100')<br> err:find('Usage') ~= nil<br><br>+--<br>+-- Check that there's no unexpected yields.<br>+--<br>+function assert_no_csw(func, ...) \<br>+ local csw1 = <a href="http://fiber.info" target="_blank">fiber.info</a>()[<a href="http://fiber.id" target="_blank">fiber.id</a>()].csw \<br>+ local ret = {func(...)} \<br>+ local csw2 = <a href="http://fiber.info" target="_blank">fiber.info</a>()[<a href="http://fiber.id" target="_blank">fiber.id</a>()].csw \<br>+ assert(csw2 - csw1 == 0) \<br>+ return unpack(ret) \<br>+end<br>+future = c:call('long_function', {1, 2, 3}, {is_async = true})<br>+assert_no_csw(future.is_ready, future)<br>+assert_no_csw(future.result, future)<br>+assert_no_csw(future.wait_result, future, 0)<br>+finalize_long()<br>+future:wait_result()<br>+assert_no_csw(future.is_ready, future)<br>+assert_no_csw(future.result, future)<br>+assert_no_csw(future.wait_result, future)<br>+<br> box.schema.func.drop('long_function')<br><br> c:close()<br>--<br>2.25.1<br> </blockquote></div></div></div></div></div></div></div></div></blockquote><div> </div></BODY></HTML>