unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: Artyom Poptsov <poptsov.artyom@gmail.com>, 42740@debbugs.gnu.org
Subject: bug#42740: Segfault in libssh during ‘guix copy’
Date: Tue, 01 Sep 2020 09:56:56 -0400	[thread overview]
Message-ID: <87eenlzjkn.fsf@gmail.com> (raw)
In-Reply-To: <87h7sljzgn.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sat, 29 Aug 2020 16:31:20 +0200")

Hi Ludovic and Artyom,

Ludovic Courtès <ludo@gnu.org> writes:

> Ludovic Courtès <ludo@gnu.org> skribis:
>
>> So we have the finalization thread closing a channel of session
>> 0x12a4b20 (which causes a write on the channel), and the main thread
>> writing to a channel of that same session.  This is exactly what I
>> described at <https://issues.guix.gnu.org/26976#11>:
>>
>>   AIUI, that means there’s one output compression buffer per session,
>>   and it’s not thread-safe (in Guile 2.2 finalizers are called from a
>>   separate thread.)
>>
>>   I think the fix, in Guile-SSH, is to associate each libssh object
>>   (session, channel, etc.) with a mutex, and to protect all uses of the
>>   libssh object by that mutex.
>>
>> Artyom, WDYT?  Do you think you could take a look into that?
>>
>> In the meantime, I’ll look for the origin of the channel port that’s not
>> explicitly closed and see if we can work around it.
>
> I’ve pushed this change on our side to explicitly close channels and
> sessions:
>
>   https://git.savannah.gnu.org/cgit/guix.git/commit/?id=61fe9ced7da7eefceb931af0cb7363b721f5bdd6
>
> This workaround is similar to that of 2017:
>
>   https://git.savannah.gnu.org/cgit/guix.git/commit/?id=8e469b67f95cfe5b95405b503b8ee315fdf8ce66
>
> It’s really just a workaround so I think we should fix the core issue in
> Guile-SSH (or libssh) so it doesn’t pop up again next month—it’s hard to
> ensure code that opens a channel explicitly closes it.

Do you think the issue lies in guile-ssh or in libssh itself?  Sorry for
not having caught these problems earlier; it seemed to work reliably
when I last tested it.

> Anyway, I would welcome tests using ‘guix copy’, ‘guix deploy’, and
> offloading.  (For offloading, make sure to run the daemon from your
> build tree.)

While attempting to use offload on the core-updates branch, I
encountered stalls and file errors, but with your patch it seems to work
reliable (it's been offloading builds for the last 15 minutes or so
without interruption).

So your workaround fixes seem to work as intended.

I also agree that it'd be much nicer and future proof if we could fix
the root issue.

Thanks!

Maxim




  reply	other threads:[~2020-09-01 13:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-07  9:24 bug#42740: Segfault in libssh during ‘guix copy’ Ludovic Courtès
2020-08-07 18:36 ` Artyom V. Poptsov
2020-08-09  8:48 ` Artyom Poptsov
2020-08-17  3:31   ` Maxim Cournoyer
2020-08-23 16:31     ` Ludovic Courtès
2020-09-15  2:05       ` Maxim Cournoyer
2020-09-15  8:14         ` Ludovic Courtès
2020-09-15 13:48           ` Maxim Cournoyer
2020-08-29 13:31   ` Ludovic Courtès
2020-08-29 14:31     ` Ludovic Courtès
2020-09-01 13:56       ` Maxim Cournoyer [this message]
2020-09-01 20:57         ` Ludovic Courtès
2020-09-02 21:19           ` Ludovic Courtès

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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eenlzjkn.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=42740@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    --cc=poptsov.artyom@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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).