Bug #63896
Updated by Dhairya Parmar 5 months ago
when waiting for onfinish, with this test case(trivial before and after parts removed): <pre><code class="cpp"> for(int i = 0; i < NUM_BUF; ++i) { writefinish.reset(new C_SaferCond("test-nonblocking-writefinish-non-contiguous")); rc = client->ll_preadv_pwritev(fh, current_iov++, 1, i * NUM_BUF * 10, true, writefinish.get(), nullptr); ASSERT_EQ(rc, 0); total_bytes_written += writefinish->wait(); } ASSERT_EQ(total_bytes_written, bytes_to_write); readfinish.reset(new C_SaferCond("test-nonblocking-readfinish-contiguous")); rc = client->ll_preadv_pwritev(fh, iov_in_contiguous, NUM_BUF, 0, false, readfinish.get(), &bl); ASSERT_EQ(rc, 0); total_bytes_read = readfinish->wait(); // should be less since the data written is non-contiguous but the read // was contiguous ASSERT_LE(total_bytes_read, bytes_to_write); </code></pre> the executions stalls, check out 1_execution_stalled_contiguous_read linked below _BUT_ if the code to wait for context to complete is removed, i.e.: <pre><code class="cpp"> for(int i = 0; i < NUM_BUF; ++i) { writefinish.reset(new C_SaferCond("test-nonblocking-writefinish-non-contiguous")); rc = client->ll_preadv_pwritev(fh, current_iov++, 1, i * NUM_BUF * 10, true, writefinish.get(), nullptr); ASSERT_EQ(rc, 0); total_bytes_written += writefinish->wait(); } ASSERT_EQ(total_bytes_written, bytes_to_write); readfinish.reset(new C_SaferCond("test-nonblocking-readfinish-contiguous")); rc = client->ll_preadv_pwritev(fh, iov_in_contiguous, NUM_BUF, 0, false, readfinish.get(), &bl); ASSERT_EQ(rc, 0); </code></pre> execution aborts with a core dump with: <pre><code class="text"> 2023-12-28T19:53:08.780+0530 7f0f47a4a9c0 20 client.4423 awaiting reply|forward|kick on 0x7fff7814eaa0 terminate called after throwing an instance of 'std::system_error' what(): Invalid argument *** Caught signal (Aborted) ** </code></pre> checkout 2_core_dumped(attached below) for more info Ideally these should've just returned bytes less than total bytes written since the data between offsets must be 0 but it failed to handle this case