| www.delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org A6A68396E868 |
| DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
| s=default; t=1624417911; | |
| bh=5jAEIdQd6H/vvNxu5jkioMJ5BdfzZ5fR9O9yUSDMPd4=; | |
| h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe: | |
| List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: | |
| From; | |
| b=tjgumtSLWdlfYnGCzLcRX0Q2FHKVM1WocEPhI92kPenRtA00HqtOdXAsppV0o2nUW | |
| s4KpJqo1FUsfysvSpIdP52TwLwDBQK0dHTQPp8D8IJGelM3P8dyFmfzAGlT4vfQGpt | |
| O1PRj0VIVh+y+K94j33On6GYdiGzX4ueXi75fpYc= | |
| X-Original-To: | cygwin AT cygwin DOT com |
| Delivered-To: | cygwin AT cygwin DOT com |
| DMARC-Filter: | OpenDMARC Filter v1.4.1 sourceware.org 342AE396D83F |
| DKIM-Filter: | OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com 15N38mPW004599 |
| X-Nifty-SrcIP: | [118.243.84.232] |
| Date: | Wed, 23 Jun 2021 12:08:58 +0900 |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: xwin-xdg-menu high cpu usage with rxvt-unicode |
| Message-Id: | <20210623120858.83e471aa7ddbc20cd41efb2c@nifty.ne.jp> |
| In-Reply-To: | <tY-YzUNrM949zC_VJOeRHb8ZfRSYyZs8VHOJw5uBWmP-sdqzFXneuCcEBsv7N5906q8lQdA0SJXUz13FAv1uaTwY9inYMBGrwh1HHoHH1XA=@protonmail.com> |
| References: | <tY-YzUNrM949zC_VJOeRHb8ZfRSYyZs8VHOJw5uBWmP-sdqzFXneuCcEBsv7N5906q8lQdA0SJXUz13FAv1uaTwY9inYMBGrwh1HHoHH1XA=@protonmail.com> |
| X-Mailer: | Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) |
| Mime-Version: | 1.0 |
| X-Spam-Status: | No, score=-1.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, |
| DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, | |
| RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, | |
| TXREP autolearn=no autolearn_force=no version=3.4.2 | |
| X-Spam-Checker-Version: | SpamAssassin 3.4.2 (2018-09-13) on |
| server2.sourceware.org | |
| X-BeenThere: | cygwin AT cygwin DOT com |
| X-Mailman-Version: | 2.1.29 |
| 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: | Takashi Yano via Cygwin <cygwin AT cygwin DOT com> |
| Reply-To: | Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp> |
| Cc: | Jon Turney <jon DOT turney AT dronecode DOT org DOT uk> |
| 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> |
On Mon, 21 Jun 2021 05:49:28 +0000
Viet-Duc Le wrote:
> Hi,
>
> I've encountered a peculiar issue with rxvt-unicode launched from xwin-xdg-menu (20170321-1)
> The image below corresponds to two rxvt-unicode instances, each occupies 30% of system resouce.
> https://imgur.com/a/FTFwIrZ
> I'm using the the latest version of cygwin. 'cygcheck.out' is attached per guideline.
>
> Steps to reproduce:
> - Start XWin Server from Start menu
> - X applications menu -> System Tools -> rxvt-unicode
> - Kill rxvt-unicode to free the resource again
>
> Other observations:
> - XTerm does not incur high resources.
> - Manually launching rxvt-unicode from XTerm does not incur high resources.
>
> I think this is not an issue with rxvt but with xwin-xdg-menu.
> On laptop, it is very noticeable when the fan kicks in.
> Insights and suggestions are much appreciated.
>
> Thanks.
> Viet-Duc
I looked into this problem and found the cause.
urxvt seems to close stdout while xwin-xdg-menu use select()
to read stdout of the launched apps. Since stdout is closed,
select() returns repeatedly without any output. This causes
high cpu load.
I also confirmed that the following patch for xwin-xdg-menu
resolves the issue.
--- execute.c.orig 2017-03-22 05:31:53.000000000 +0900
+++ execute.c 2021-06-22 10:47:28.917675400 +0900
@@ -100,30 +100,38 @@
default: /* parent */
{
+ int stdout_ok = TRUE, stderr_ok = TRUE;
close(stdout_filedes[1]);
close(stderr_filedes[1]);
printf("executing '%s', pid %d\n", (char *) cmd, pid);
/* read from pipes, write to log, until both are closed */
- while (TRUE) {
+ while (stdout_ok || stderr_ok) {
fd_set readfds, errorfds;
- int nfds = max(stdout_filedes[0], stderr_filedes[0]) + 1;
+ int nfds = 0;
FD_ZERO(&readfds);
- FD_SET(stdout_filedes[0], &readfds);
- FD_SET(stderr_filedes[0], &readfds);
+ if (stdout_ok) {
+ FD_SET(stdout_filedes[0], &readfds);
+ nfds = max(nfds, stdout_filedes[0] + 1);
+ }
+ if (stderr_ok) {
+ FD_SET(stderr_filedes[0], &readfds);
+ nfds = max(nfds, stderr_filedes[0] + 1);
+ }
errorfds = readfds;
if (select(nfds, &readfds, NULL, &errorfds, NULL) > 0) {
- if (FD_ISSET(stdout_filedes[0], &readfds))
+ if (FD_ISSET(stdout_filedes[0], &errorfds))
+ stdout_ok = FALSE;
+ else if (FD_ISSET(stdout_filedes[0], &readfds))
LogLineFromFd(stdout_filedes[0], "stdout", pid);
- if (FD_ISSET(stderr_filedes[0], &readfds))
- LogLineFromFd(stderr_filedes[0], "stderr", pid);
- if (FD_ISSET(stdout_filedes[0], &errorfds) &&
- FD_ISSET(stderr_filedes[0], &errorfds))
- break;
+ if (FD_ISSET(stderr_filedes[0], &errorfds))
+ stderr_ok = FALSE;
+ else if (FD_ISSET(stderr_filedes[0], &readfds))
+ LogLineFromFd(stderr_filedes[0], "stderr", pid);
}
else {
break;
Jon, could you please have a look?
--
Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
--
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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |