Tarantool development patches archive
 help / color / mirror / Atom feed
From: Egor Elchinov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v2 2/4] fiber: add option and PoC for Lua parent backtrace
Date: Wed, 14 Jul 2021 12:29:39 +0300
Message-ID: <e31364e2-f1e1-824d-4e60-5b2b41ba073a@tarantool.org> (raw)
In-Reply-To: <YOww5+cfZum2rVTM@grain>



On 12.07.2021 15:09, Cyrill Gorcunov via Tarantool-patches wrote:
> On Fri, Jul 09, 2021 at 02:03:51PM +0300, Egor Elchinov via Tarantool-patches wrote:
>>
>> diff --git a/src/lib/core/fiber.c b/src/lib/core/fiber.c
>> index 924ff3c82..dd26e2f13 100644
>> --- a/src/lib/core/fiber.c
>> +++ b/src/lib/core/fiber.c
>> @@ -220,6 +220,10 @@ fiber_mprotect(void *addr, size_t len, int prot)
>>   static __thread bool fiber_top_enabled = false;
>>   #endif /* ENABLE_FIBER_TOP */
>>   
>> +#if ENABLE_BACKTRACE
>> +static __thread bool fiber_parent_bt_enabled = false;
>> +#endif /* ENABLE_BACKTRACE */
>> +
> 
> So this variable is declared as TLS in a manner of fiber_top
> functionality. You know I somehow find this fishy because
> it is unclear why it is done this way. I think we should
> revisit this moment for @fiber_top_enabled enabled as well
> but not in this series, so lets leave it as is.
> 
> Please revisit snprintf calls in the patch and strncpy
> as well because they _do_not_ append terminating \0 symbol
> if destination size is not enough. I think we should add
> \0 explicitly all the time.
Thanks, fixed hereinafter.
> 
> I mean
> 
> +static int
> +fiber_parent_backtrace_cb(int frameno, void *frameret, const char *func,
> +			  size_t offset, void *cb_ctx)
> +{
> 	...
> +	char buf[512];
> +	int l = snprintf(buf, sizeof(buf), "#%-2d %p in ", frameno, frameret);
> +	if (func)
> +		snprintf(buf + l, sizeof(buf) - l, "%s+%zu", func, offset);
> +	else
> +		snprintf(buf + l, sizeof(buf) - l, "?");
> 
> we could add
> 
> 	buf[sizeof(buf)-1] = '\0';
> 
> Actually 512 bytes for function name should be more than enough but
> better be on a safe side.
> 
> Other than that the patch looks ok to me, great job, thanks!
> 

  reply	other threads:[~2021-07-14  9:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-09 11:03 [Tarantool-patches] [PATCH v2 0/4] fiber: introduce creation backtrace Egor Elchinov via Tarantool-patches
2021-07-09 11:03 ` [Tarantool-patches] [PATCH v2 1/4] fiber: add PoC for fiber " Egor Elchinov via Tarantool-patches
2021-07-12 11:42   ` Cyrill Gorcunov via Tarantool-patches
2021-07-09 11:03 ` [Tarantool-patches] [PATCH v2 2/4] fiber: add option and PoC for Lua parent backtrace Egor Elchinov via Tarantool-patches
2021-07-12 12:09   ` Cyrill Gorcunov via Tarantool-patches
2021-07-14  9:29     ` Egor Elchinov via Tarantool-patches [this message]
2021-07-09 11:03 ` [Tarantool-patches] [PATCH v2 3/4] fiber: refactor lua backtrace routines Egor Elchinov via Tarantool-patches
2021-07-12 12:13   ` Cyrill Gorcunov via Tarantool-patches
2021-07-14  9:42     ` Egor Elchinov via Tarantool-patches
2021-07-09 11:03 ` [Tarantool-patches] [PATCH v2 4/4] fiber: refactor C backtrace and add changelog Egor Elchinov via Tarantool-patches
2021-07-12 12:35   ` Cyrill Gorcunov via Tarantool-patches
2021-07-14  9:42     ` Egor Elchinov via Tarantool-patches

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=e31364e2-f1e1-824d-4e60-5b2b41ba073a@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=eelchinov@tarantool.org \
    --cc=gorcunov@gmail.com \
    /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

Tarantool development patches archive

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lists.tarantool.org/tarantool-patches/0 tarantool-patches/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 tarantool-patches tarantool-patches/ https://lists.tarantool.org/tarantool-patches \
		tarantool-patches@dev.tarantool.org.
	public-inbox-index tarantool-patches

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git