git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: Fredrik Kuivinen <frekui@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	"Shawn O. Pearce" <spearce@spearce.org>,
	git@vger.kernel.org
Subject: Re: [PATCH 7/6] Enable threaded async procedures whenever pthreads is  available
Date: Tue, 23 Mar 2010 21:19:18 +0100	[thread overview]
Message-ID: <201003232119.19430.j6t@kdbg.org> (raw)
In-Reply-To: <4c8ef71003230115y64d36094y178fcfe6576e9c66@mail.gmail.com>

On Dienstag, 23. März 2010, Fredrik Kuivinen wrote:
> On Wed, Mar 17, 2010 at 22:28, Johannes Sixt <j6t@kdbg.org> wrote:
> > ----------
> > convert.c:filter_buffer()
> ...
> Maybe I'm missing something but, isn't it possible that xrealloc is
> called simultaneously from the two threads if GIT_TRACE is set?
>
> Immediately after start_async the parent calls strbuf_read. We then
> get the call chain
> strbuf_read -> strbuf_grow -> ALLOG_GROW -> xrealloc, so xrealloc is
> called before we read any data in the parent.
>
> In the child we have start_command -> trace_argv_printf -> strbuf_grow ->
> ...

Outch! You are right. It seems I missed the call of strbuf_grow before the 
loop in strbuf_read.

OK, this means that convert.c is not safe if (and only if) GIT_TRACE is 
set. :-(

> That xmalloc and xrealloc aren't thread-safe feels a bit fragile.
> Maybe we should try to fix that.

The point of this assessment was to find out whether this is necessary (and 
whether something else that is not thread-safe is used).

> > ----------
> > upload_pack:create_pack_file(): 
> ...
> sha1_to_hex is also called by the parent and the current
> implementation of that function is not thread-safe. sha1_to_hex is
> also called by some paths in the revision machinery, but I don't know
> if it will ever be called in this particular case.

sha1_to_hex is only called by the parent when the async procedure is not used.

-- Hannes

  reply	other threads:[~2010-03-23 20:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-06 15:40 [PATCH 0/6] Pass t5530 on Windows Johannes Sixt
2010-03-06 20:12 ` Junio C Hamano
2010-03-06 21:50   ` Shawn O. Pearce
2010-03-09 20:00     ` [PATCH 7/6] Enable threaded async procedures whenever pthreads is available Johannes Sixt
2010-03-09 23:43       ` Shawn O. Pearce
2010-03-10 22:28       ` Junio C Hamano
2010-03-11 19:53         ` Johannes Sixt
2010-03-12  5:56           ` Junio C Hamano
2010-03-17 21:28         ` Johannes Sixt
2010-03-17 22:19           ` Junio C Hamano
2010-03-23  8:15           ` Fredrik Kuivinen
2010-03-23 20:19             ` Johannes Sixt [this message]
2010-03-23 20:25               ` Johannes Sixt
2010-03-23 20:44                 ` Junio C Hamano
2010-03-23 21:09                   ` Johannes Sixt
2010-03-23 21:42               ` Fredrik Kuivinen

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=201003232119.19430.j6t@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=frekui@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=spearce@spearce.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).