From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: tml <tarantool-patches@dev.tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH v5 4/4] crash: report crash data to the feedback server
Date: Thu, 24 Dec 2020 18:15:02 +0100 [thread overview]
Message-ID: <8c0b2bda-5614-eac0-c0b9-36630c4bf315@tarantool.org> (raw)
In-Reply-To: <20201224131601.GB298600@grain>
On 24.12.2020 14:16, Cyrill Gorcunov wrote:
> On Thu, Dec 24, 2020 at 12:22:53AM +0300, Cyrill Gorcunov wrote:
>> On Wed, Dec 23, 2020 at 07:47:44PM +0100, Vladislav Shpilevoy wrote:
>>> Hi! Thanks for the patch!
>>>
>>> See 3 comments and fixes below, and top of the branch in a
>>> separate commit.
>>>
>>
>> Vlad, since we can use json_escape I dropped usage of base64
>> encoder for backtrace. The final interdiff I pushed into
>> gorcunov/gh-5261-crash-report-6 is the following
>
> FWIW gorcunov/gh-5261-crash-report-6 passes all tests
> https://gitlab.com/tarantool/tarantool/-/pipelines/234153923
The branch didn't work on my machine when I tried to crash Tarantool.
Because uname.version even being json-escaped contained a substring
which is not a valid Lua string. This was the broken string:
"Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2\/RELEASE_X86_64"
Lua didn't understand symbol sequence `\/`.
To workaround this I made the child process accept the dump data and
the feedback host via command line arguments. Now seems to be working.
I pushed my fixes on top of the branch, and pasted them below.
====================
diff --git a/src/lib/core/crash.c b/src/lib/core/crash.c
index e62af6836..ee4991b52 100644
--- a/src/lib/core/crash.c
+++ b/src/lib/core/crash.c
@@ -258,10 +258,10 @@ crash_report_feedback_daemon(struct crash_info *cinfo)
* modifications in future.
*/
size = (char *)uname_ptr - p;
- snprintf_safe("require(\'http.client\').post(\'%s\',"
- "'{\"crashdump\":{\"version\":\"%d\","
- "\"data\":", feedback_host,
- crashinfo_version);
+ snprintf_safe("{");
+ snprintf_safe("\"crashdump\":{");
+ snprintf_safe("\"version\":\"%d\",", crashinfo_version);
+ snprintf_safe("\"data\":");
/* The "data" key value */
snprintf_safe("{");
@@ -334,15 +334,20 @@ crash_report_feedback_daemon(struct crash_info *cinfo)
* main feedback daemon uses.
*/
size = e - p;
- snprintf_safe("}}',{timeout=1});os.exit(1);");
+ snprintf_safe("}");
+ snprintf_safe("}");
pr_debug("crashinfo script: %s", head);
- char *exec_argv[4] = {
+ char *exec_argv[7] = {
[0] = tarantool_path,
[1] = "-e",
- [2] = head,
- [3] = NULL,
+ [2] = "require('http.client').post(arg[1],arg[2],{timeout=1});"
+ "os.exit(1);",
+ [3] = "-",
+ [4] = feedback_host,
+ [5] = head,
+ [6] = NULL,
};
/*
@@ -360,9 +365,11 @@ crash_report_feedback_daemon(struct crash_info *cinfo)
* is running fine.
*/
execve(exec_argv[0], exec_argv, environ);
- pr_crit("exec(%s,[%s,%s,%s]) failed",
+ pr_crit("exec(%s,[%s,%s,%s,%s,%s,%s,%s]) failed",
exec_argv[0], exec_argv[0],
- exec_argv[1], exec_argv[2]);
+ exec_argv[1], exec_argv[2],
+ exec_argv[3], exec_argv[4],
+ exec_argv[5], exec_argv[6]);
_exit(1);
} else if (pid < 0) {
pr_crit("unable to vfork (errno %d)", errno);
next prev parent reply other threads:[~2020-12-24 17:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-23 15:41 [Tarantool-patches] [PATCH v5 0/4] Our feedback daemon sends only a few portions of usage Cyrill Gorcunov
2020-12-23 15:41 ` [Tarantool-patches] [PATCH v5 1/4] util: introduce strlcpy helper Cyrill Gorcunov
2020-12-23 15:41 ` [Tarantool-patches] [PATCH v5 2/4] backtrace: allow to specify destination buffer Cyrill Gorcunov
2020-12-23 15:41 ` [Tarantool-patches] [PATCH v5 3/4] crash: move fatal signal handling in Cyrill Gorcunov
2020-12-23 15:41 ` [Tarantool-patches] [PATCH v5 4/4] crash: report crash data to the feedback server Cyrill Gorcunov
2020-12-23 18:47 ` Vladislav Shpilevoy
2020-12-23 18:57 ` Cyrill Gorcunov
2020-12-23 21:22 ` Cyrill Gorcunov
2020-12-24 13:16 ` Cyrill Gorcunov
2020-12-24 17:15 ` Vladislav Shpilevoy [this message]
2020-12-24 17:33 ` Cyrill Gorcunov
2020-12-24 18:22 ` Vladislav Shpilevoy
2020-12-24 18:33 ` Cyrill Gorcunov
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=8c0b2bda-5614-eac0-c0b9-36630c4bf315@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=gorcunov@gmail.com \
--cc=tarantool-patches@dev.tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH v5 4/4] crash: report crash data to the feedback server' \
/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