From: Leonid Vasiliev <lvasiliev@tarantool.org> To: Sergey Ostanevich <sergos@tarantool.org> Cc: m.semkin@corp.mail.ru, tarantool-patches@dev.tarantool.org, Vladislav Shpilevoy <v.shpilevoy@tarantool.org>, Mergen Imeev <imeevma@gmail.com> Subject: Re: [Tarantool-patches] [PATCH 1/2] sql: add missing diag_set on failure when working with files inside SQL module Date: Fri, 11 Dec 2020 18:05:01 +0300 [thread overview] Message-ID: <3bf1c67c-6753-2c4d-e362-33b7dfadaec7@tarantool.org> (raw) In-Reply-To: <95BFAA11-3CB5-430E-938A-B3AF9701A38E@tarantool.org> Hi! Thank you for the review. On 10.12.2020 17:15, Sergey Ostanevich wrote: > Thanks for the patch! > > I have a question if those diags are too low in the call stack? In the new patchset, I added common `diag_set()` if `sql_execute()` fails without setting an error to diag. > Apparently, the unixOpen() is a single space the robust_open() > is called, so we’d have only one diag set instead of two? In this case, we will not know exactly where the error occurred. I think the best way to use the stack diag for such purposes but that is out of the scope of this problem. I will create a separate task about these improvements (or find existing ones). > > Following this path - we should just cover UNIXVFS and sql_io_methods > members with diag set, given the errno is preserved. > > By now the solution is partial, so can be applied only if we’re in a > rush. This solution is minimalistic and solves a specific problem (and only this problem). Because now we have a crash and fixes should be included in the next release. > > Sergos > >> On 8 Dec 2020, at 22:59, Leonid Vasiliev <lvasiliev@tarantool.org> wrote: >> >> From: Mergen Imeev <imeevma@gmail.com> >> >> SQL module didn't set an error in the diagnostics area on a file >> operation failure. This could lead to a crash like in #5537. >> >> Part of #5537 >> --- >> src/box/sql/os_unix.c | 9 +++++++-- >> 1 file changed, 7 insertions(+), 2 deletions(-) >> >> diff --git a/src/box/sql/os_unix.c b/src/box/sql/os_unix.c >> index b351c55..557d709 100644 >> --- a/src/box/sql/os_unix.c >> +++ b/src/box/sql/os_unix.c >> @@ -159,14 +159,17 @@ robust_open(const char *z, int f, mode_t m) >> if (fd < 0) { >> if (errno == EINTR) >> continue; >> + diag_set(SystemError, strerror(errno)); >> break; >> } >> if (fd >= SQL_MINIMUM_FILE_DESCRIPTOR) >> break; >> close(fd); >> fd = -1; >> - if (open("/dev/null", f, m) < 0) >> + if (open("/dev/null", f, m) < 0) { >> + diag_set(SystemError, strerror(errno)); >> break; >> + } >> } >> if (fd >= 0) { >> if (m != 0) { >> @@ -831,8 +834,10 @@ seekAndWriteFd(int fd, /* File descriptor to write to */ >> rc = write(fd, pBuf, nBuf); >> } while (rc < 0 && errno == EINTR); >> >> - if (rc < 0) >> + if (rc < 0) { >> + diag_set(SystemError, strerror(errno)); >> *piErrno = errno; >> + } >> return rc; >> } >> >> -- >> 2.7.4 >> >
next prev parent reply other threads:[~2020-12-11 15:06 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-08 19:59 [Tarantool-patches] [PATCH 0/2] Fix working with temporary files in VDBE Leonid Vasiliev 2020-12-08 19:59 ` [Tarantool-patches] [PATCH 1/2] sql: add missing diag_set on failure when working with files inside SQL module Leonid Vasiliev 2020-12-10 14:15 ` Sergey Ostanevich 2020-12-11 15:05 ` Leonid Vasiliev [this message] 2020-12-08 19:59 ` [Tarantool-patches] [PATCH 2/2] sql: update temporary file name format Leonid Vasiliev 2020-12-10 16:39 ` Sergey Ostanevich 2020-12-10 23:08 ` Leonid Vasiliev 2020-12-11 12:51 ` Nikita Pettik 2020-12-11 14:52 ` m.semkin 2020-12-11 15:19 ` Leonid Vasiliev
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=3bf1c67c-6753-2c4d-e362-33b7dfadaec7@tarantool.org \ --to=lvasiliev@tarantool.org \ --cc=imeevma@gmail.com \ --cc=m.semkin@corp.mail.ru \ --cc=sergos@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH 1/2] sql: add missing diag_set on failure when working with files inside SQL module' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox