Thomas Rast <tr...@student.ethz.ch> writes:

> Actually scratch that again.  It *is* a stack overflow, except that this
> is a thread stack, for which the OS X defaults are 512kB apparently, as
> opposed to 2MB on linux.
> ...
> And indeed the following patch fixes it.  Sounds like the delta
> unpacking needs a rewrite to support stackless operation.  Sigh.

Yikes.  Thanks for digging it to the bottom.

I am not sure if I want to carry this patch in its current form,
though.  As this episode demonstrates, no default is good enough for
everybody, and I am not sure if a configuration variable is a good
way to go, either.

>
> diff --git i/builtin/index-pack.c w/builtin/index-pack.c
> index 6be99e2..f73291f 100644
> --- i/builtin/index-pack.c
> +++ w/builtin/index-pack.c
> @@ -1075,13 +1075,17 @@ static void resolve_deltas(void)
>       nr_dispatched = 0;
>       if (nr_threads > 1 || getenv("GIT_FORCE_THREADS")) {
>               init_thread();
> +             pthread_attr_t attr;
> +             pthread_attr_init(&attr);
> +             pthread_attr_setstacksize(&attr, 2*1024*1024);
>               for (i = 0; i < nr_threads; i++) {
> -                     int ret = pthread_create(&thread_data[i].thread, NULL,
> +                     int ret = pthread_create(&thread_data[i].thread, &attr,
>                                                threaded_second_pass, 
> thread_data + i);
>                       if (ret)
>                               die(_("unable to create thread: %s"),
>                                   strerror(ret));
>               }
> +             pthread_attr_destroy(&attr);
>               for (i = 0; i < nr_threads; i++)
>                       pthread_join(thread_data[i].thread, NULL);
>               cleanup_thread();
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to