Ticket #3208 (closed defect: fixed)

Opened 5 years ago

Last modified 6 months ago

Failed gpm connect attempt ... for vc /dev/tty0

Reported by: onlyjob Owned by: andrew_b
Priority: critical Milestone: 4.8.23
Component: mc-tty Version: 4.8.12
Keywords: Cc:
Blocked By: Blocking: #3614
Branch state: merged Votes for changeset: committed-master

Description

As reported in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=743566

Sometimes when running on virtual terminal, under screen(1), MC is super slow,
consuming 50% of CPU, and spewing literally hundreds of messages like
this to syslog:

mc: *** info
mc: Warning: closing connection
/usr/sbin/gpm[2296]: *** warning [daemon/processconn.c(133)]:
/usr/sbin/gpm[2296]: Failed gpm connect attempt by uid 500 for vc /dev/tty0

I couldn't reproduce it but reporter claims it's been OK with MC_4.8.3
so something could get broken in MC_4.8.11 or earlier.

The following ticket seems related: #3011.

Attachments

0001-Ticket-3208-fix-usage-of-GPM-under-screen-tmux.patch (2.7 KB) - added by andrew_b 5 years ago.
mc-gpm-fix.patch (1.6 KB) - added by mikulas 7 months ago.
Here I'm submitting a patch for this bug

Change History

comment:1 Changed 5 years ago by onlyjob

  • Priority changed from major to critical

I reproduced easily in (K)VM with gpm_1.20.4-6.1 on Debian "testing". It happens in "screen" and in "tmux" when TERM="screen" (over SSH connection) or TERM="screen.linux" (on framebuffer console) when panels are visible.

As temporary remedy setting TERM="xterm" helps.

Regression was introduced with #3011: I built MC_4.8.12 with reverted commit 9699d5dd699db3d5627e7e368ff8ad54448566af and couldn't reproduce the issue any more.

I'm raising priority of this ticket as MC is practically not usable when this problem manifests.

comment:2 Changed 5 years ago by andrew_b

  • Cc acobar added

comment:3 Changed 5 years ago by lzsiga

Hi,
I get the same (or similiar) problem in mc-4.8.11: I do remote access from Windows via putty or dtelnet; if TERM=rxvt/xterm/konsole, there is no problem; if TERM=ansi/linux/vt100 the problem arises: so it is related with the terminal's mouse support (to be more precise: if the terminal has no mouse support, mc tries to use gpm, which fails).

Here are the messages from /var/log/syslog

16:21:50 mcedit: *** info
16:21:50 mcedit: Warning: closing connection
16:21:50 /usr/sbin/gpm[1661]: *** warning [daemon/processconn.c(133)]:
16:21:50 /usr/sbin/gpm[1661]: Failed gpm connect attempt by uid 1001 for vc /dev/tty0
Last edited 5 years ago by lzsiga (previous) (diff)

comment:4 follow-up: ↓ 5 Changed 5 years ago by andrew_b

  • Cc acobar removed
  • Component changed from mc-core to mc-tty

Would you please test the attached patch?

comment:5 in reply to: ↑ 4 Changed 5 years ago by onlyjob

Replying to andrew_b:

Would you please test the attached patch?

Unfortunately it did not help... The following is still logged to "/var/log/messages":

mc: Warning: closing connection
mc: *** info

at the rate around 2800 times per second (with high CPU usage) -- I tested in "tmux" with TERM="screen".

comment:6 Changed 5 years ago by onlyjob

Any update please?

comment:7 Changed 5 years ago by boris

I propose the following simple patch:

--- a/lib/tty/key.c
+++ b/lib/tty/key.c
@@ -2092,7 +2092,6 @@
 
                         /* Try to reopen gpm_mouse connection */
                         disable_mouse ();
-                        enable_mouse ();
                     }
                 }
             }

Probably it's not a perfect solution, but it works.

comment:8 Changed 4 years ago by GlebHappy

mc 4.8.13, ubuntu server 15.10 amd64
Problem still persists

comment:9 Changed 4 years ago by andrixnet

Under mc-4.8.10 (distribution version of Slackware-14.1) the problem exists as follows:

  • when logged in as regular user at console, the problem does not happen
  • when logged in via ssh, the problem exists.

I have applied the latest version 4.8.14, the problem still persists.

screen was not involved in my testcases. Only remote sessions via ssh (putty client) using TERM=linux


Using the patch above by boris seems to reduce the problem. Only a single error in syslog when the user starts mc:

Oct 29 21:18:05 HOST /usr/sbin/gpm[1833]: *** warning [daemon/processconn.c(128)]:
Oct 29 21:18:05 HOST /usr/sbin/gpm[1833]: Failed gpm connect attempt by uid 1000 for vc /dev/tty0

I am not knowledgeable enough with the internals of GPM to be able to determine why this happens.

comment:10 Changed 4 years ago by grok

As of 2016.01.25 this is still a problem on an up-to-date:

* Debian Jessie: v 8.3
* Linux kernel: v 3.16.7 amd64
* gpm: v 1.20.4-6.1
* screen: v 4.2.1-3+deb8u1
* mc: v 4.8.13-3

And for that matter -- I'm also getting a version date on gpm of '29th of May 2008'.
Old!
:/

Last edited 4 years ago by grok (previous) (diff)

comment:11 Changed 4 years ago by zaytsev-work

Hmmm... I wasn't able to reproduce it in a long while. Another mystery case for our guru and to investigate?

comment:12 Changed 3 years ago by lzsiga

Still present in my Debian Jessie, mc-4.8.13, gpm-1.20.4, linux terminal (aka Alt+F1). (No problem with xterm, rxvt and alike.)

Now I compiled mc-4.8.17 from source, and it works without problem.

comment:13 Changed 9 months ago by Talkless

It still reproduces on Debian Stretch. Connected to the Stretch mechine via SSH, launched tmux, split it horizontally and launched mc in it. Noticed huge input lag when navigating using arrow keys. Later I have noticed high CPU usage, because grep (via logcheck) started to collect log entries. /var/log/syslog contains around half a million of lines like this:

Dec 11 08:26:15 dev /usr/sbin/gpm[802]: *** warning [daemon/processconn.c(133)]:
Dec 11 08:26:15 dev /usr/sbin/gpm[802]: Failed gpm connect attempt by uid 1001 for vc /dev/tty0
Dec 11 08:26:15 dev mc: *** info
Dec 11 08:26:15 dev mc: Warning: closing connection

comment:14 Changed 7 months ago by egmont

On a side note, gpm should be reworked to emit xterm-compatible mouse sequences, and this would no longer would be a problem then. See https://github.com/telmich/gpm/issues/29 .

comment:15 Changed 7 months ago by mikulas

How to reproduce the bug:

  • compile mc with gpm support
  • run the gpm daemon on the console
  • login to the machine with ssh from console on another machine
  • run mc

At this situation, keyboard response will be sluggish and mc will consume
CPU time when idle. The reason is that mc is trying to reopen the Gpm
connection over and over again and gpm will try to close the connection
over and over again (because the user is not on the local console).

Changed 7 months ago by mikulas

Here I'm submitting a patch for this bug

comment:16 Changed 7 months ago by andrew_b

I hope this fixes #3614 too.

comment:17 Changed 7 months ago by andrew_b

  • Status changed from new to accepted
  • Owner set to andrew_b
  • Blocking 3614 added
  • Branch state changed from no branch to on review
  • Milestone changed from Future Releases to 4.8.23

Branch: 3208_gpm_connect_attempt
changeset:02764a38931a58056cf71c02647a604c9a5faedf

Please test.

comment:18 Changed 6 months ago by andrew_b

  • Votes for changeset set to andrew_b
  • Branch state changed from on review to approved

comment:19 Changed 6 months ago by andrew_b

  • Status changed from accepted to testing
  • Votes for changeset changed from andrew_b to committed-master
  • Resolution set to fixed
  • Branch state changed from approved to merged

comment:20 Changed 6 months ago by andrew_b

  • Status changed from testing to closed
Note: See TracTickets for help on using tickets.