delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/01/31/11:37:33

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D2ADE38582A9
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1706719052;
bh=3rFbMWXTO228ALBQH56m3DCUXdtFond07ckzWSrhikw=;
h=Date:References:Subject:In-Reply-To:To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=bsOdr1HhHZUI/PwGR0LGE9fuU8yhV45fHjsS9Mx3thkHWTSH3bi4WzY7TNG4mZ9d3
55ZGy+Vfp4x7ZqxYHXLWxCW9o8mnVIH5SsS0Uy/fc52zi6l7R1mOWqjtWurrlMos6p
cOTNpvgFg0dwEVB/B/2XWblXEljEJAs5Hlz4wUFU=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 62AF43858C29
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 62AF43858C29
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706718989; cv=none;
b=eGR/99pXeEVEmLnjV3zE6GOqtqYKJ5rf+08zi/XSoYLbFTWvdVM2Ra4DW9j4PIv7x4gRj09WjYn5Y58ulsUjZbwYl1xvslcNatEYDBGwOomQy1t08gEiG+bxeoQJ6aVES9oBff8Wl+KEHIuuReOvoFHN4nViFyfrrpPAfNvYi4g=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1706718989; c=relaxed/simple;
bh=IAxsSLc8mdD49Dnj3iDKoCX9QIPK9hJJYjWktCErZmk=;
h=DKIM-Signature:From:Message-ID:Date:MIME-Version:Subject:To;
b=EVV1qVbDjs0VOVerNRKiugkoMgA8J8fYN/V2LLh5amN4JHqlx+DkI6VY24rpnwhUBXy7XHNTX2kMTERjkDFYSysJUDWhy6ekqKC7Pk8adbwwNAZxnqb2YqoYRElI+bWTePiMXA3JLKUiVjLYBth34xow8QDBI4nulF/r6/pN5qI=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1706718986; x=1707323786;
h=content-transfer-encoding:to:in-reply-to:content-language:subject
:references:user-agent:mime-version:date:message-id:from
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=RDSHNjaPQuWxSQVNppTu66YllRyfo/WVbaG7hHDUc+s=;
b=ZSK779FA+++B9bsih1vvuQ2fJdtGQwO9HWX1yLmZtuKwqJHmuvLiz80e2qNLVhV2cm
SrGMD9yJfov4QIWt6PlidzGYdsmadAkJAcSj6FktWg4qR7aeLE7G6S885ZBfYgJegf7m
9HAtfCnJz5ztwC0TgKnBVdd26KQOgk/Rua0JSVZ+j+VJ9pucBJmkClSKh1TQUSVmtSH5
/f/fpaWN4OQ1EaYr0pS92h5t2Wh8TzGMYnB3NcyX5GhSJw4/1NIXW7oKWsqoAqEhoama
6/W41kIFae4HtXPnVyvaAFxv7UKleWAfPwnPcVrh3gmuqIr6gDzgU/uVHew7cybzeem6
09Pg==
X-Gm-Message-State: AOJu0YwKPBNEJaTA0HTinKS6kZUruofTIJw/Q9CRhr7/virps2xzMeCg
y2NIcK98uf2hi3Amc7wFoxzQGqgvqg8FCX8NO4JNePZUM2FtlkzU2kFSM14HDe0=
X-Google-Smtp-Source: AGHT+IEc20zrR1Jj2O7EpPUTCauUWsEtbcZrOj1sDd6e0RN1p+w0Sopkvfv0xTvjz8TIw6otqQ6BOg==
X-Received: by 2002:a05:620a:4728:b0:785:40d6:bcb5 with SMTP id
bs40-20020a05620a472800b0078540d6bcb5mr947749qkb.43.1706718986492;
Wed, 31 Jan 2024 08:36:26 -0800 (PST)
X-Google-Original-From: Eliah Kagan <eliah DOT kagan AT gmail DOT com>
Message-ID: <79d3b655-f260-422b-9457-332abe0fe7d3@gmail.com>
Date: Wed, 31 Jan 2024 11:36:25 -0500
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
References: <9cb965c1-0a5f-47bb-908e-98093af28e94 AT gmail DOT com>
Subject: Re: python3 3.9.18-1 hanging
In-Reply-To: <9cb965c1-0a5f-47bb-908e-98093af28e94@gmail.com>
To: cygwin AT cygwin DOT com
X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,
SPF_HELO_NONE, SPF_PASS, TXREP,
T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Eliah Kagan via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Eliah Kagan <eliahkagan AT gmail DOT com>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

Hi,

The fastest way to produce the problem described in
https://cygwin.com/pipermail/cygwin/2024-January/255267.html and 
https://cygwin.com/pipermail/cygwin/2024-January/255273.html seems to be 
to run `pip install ...` on a version of `pip` that uses its vendored 
`rich` dependency to draw progress bars. (The hang reliably occurs at 0% 
on the *second* progress bar, and `--progress-bar off` avoids it.) 
Examining what `pip` is doing *may* be sufficient to investigate this.

However, I was able to make a *fairly* simple script that reliably 
produces it, at least on my machine (and on GitHub Actions runners). It 
seems to me that this script may give some insight. In case it's useful:

import hashlib
import threading
import time
t1 = threading.Thread(target=lambda: print("hello"))
t2 = threading.Thread(target=lambda: print("goodbye"))
t1.start()
time.sleep(1)
print("in between")
t2.start()
t1.join()
t2.join()

The interesting thing here is that the `hashlib` import is required. 
Even though that import is not used, the script does not trigger the 
problem if it is removed.

As discussed at
https://github.com/gitpython-developers/GitPython/pull/1814, this script 
is motivated by code in GitPython that produces the hang when unit tests 
are run. The script hangs when attempting to execute `t2.start()`. The 
effect appears specific to Python 3.9.18 on Cygwin. Running that script 
with Python 3.9.16 on Cygwin, or on either Python 3.9.16 or Python 
3.9.18 on either Ubuntu 22.04 LTS or macOS 13, does not produce the 
problem. (I don't have native Windows builds of those versions to test 
with at this time.)

`t1` can be joined before `t2` is started, and the problem still 
reliably occurs. If that is done, then the sleep can be omitted and the 
problem sometimes occurs. Running the statements in a REPL also produces 
the problem without requiring a sleep (presumably the delay of entering 
them is sufficient). The child threads and main thread don't have to 
print to produce the problem; I included that to make it clearer what's 
going on. I have not tested non-blocking delays.

I named that `simple.py` and ran it in various ways to verify that it 
triggers the problem, but I think the most important ways to report are:

/usr/bin/python3.9 simple.py

And:

strace -o strace.out /usr/bin/python3.9 simple.py

By the time I killed the process in the strace run, `strace.out` had 
grown to 1819328 lines, most of which were:

--- Process 25112 (pid: 20768), exception c0000005 at 0000000000000000

(This is the same pattern Daniel Abrahamsson reported when running
`pip install` with strace.)

I made a copy of the first 6610 lines as `truncated.out`, but even that 
is 828 KiB, so I've posted it here rather than attaching it:

https://gist.github.com/EliahKagan/04143302056426d72c7a617d65890dda

The last 8 lines of `truncated.out` are identical, and the original 
`strace.out` continued that way.

(Although the strace output shows that this was run from a directory 
related to GitPython, this was not done with any virtual environment 
activated, nothing from GitPython was imported or otherwise used, and 
neither GitPython nor its distinctive dependencies gitdb and smmap were 
installed in the global environment.)

That GitHub Gist also includes `simple.py` for convenience, and 
`cygcheck.out` in case that would somehow be useful.

-Eliah

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019