Ticket #2416 (closed defect: duplicate)

Opened 13 years ago

Last modified 13 years ago

Closing the window with mc leaves it in background consuming 100% CPU

Reported by: zap Owned by:
Priority: major Milestone:
Component: mc-tty Version:
Keywords: Cc:
Blocked By: Blocking:
Branch state: Votes for changeset:

Description

I've compiled mc 4.7.4 on Nokia N900 (debian-based Maemo5 OS) with ncurses support. When you close the terminal (gnome-terminal based) with Midnight running in it, the mc process will remain in background, consuming 100% CPU.

I've connected to the running mc process with gdb, here's the backtrace:

Program received signal SIGINT, Interrupt.
0x400432f0 in _nc_wgetch () from /usr/lib/libncursesw.so.5
0x400432f0 <_nc_wgetch+28>: str r2, [r11, #-184]
(gdb) where
#0 0x400432f0 in _nc_wgetch () from /usr/lib/libncursesw.so.5
#1 0x40043cf0 in wgetch () from /usr/lib/libncursesw.so.5
#2 0x0007e7d8 in tty_lowlevel_getch () at tty-ncurses.c:242
#3 0x00096964 in get_key_code (no_delay=0) at key.c:1435
#4 0x00094c40 in getch_with_delay () at key.c:657
#5 0x000975e8 in tty_get_event (event=0xbeb6e33c, redo_event=0, block=1) at key.c:1684
#6 0x0001f804 in frontend_run_dlg (h=0x17a478) at dialog.c:1043
#7 0x0001f930 in run_dlg (h=0x17a478) at dialog.c:1075
#8 0x00072290 in create_panels_and_run_mc () at main.c:1716
#9 0x00072578 in do_nc () at main.c:1798
#10 0x00072c38 in main (argc=3, argv=0xbeb6e5a4) at main.c:2048

So, mc is still trying to read the keyboard, despite the fact that stdin has been already closed.

  • getch() returns -1
  • tty_lowlevel_getch() returns -1
  • get_key_code returns -1 as well

then in getch_with_delay() it gets this:

657 c = get_key_code (0);
658 if (c != -1)
659 break;
660 /* Failed -> wait 0.1 secs and try again */
661 try_channels (1);

so it calls getch() again and again, despite the fact that getch() returns EOF.

Change History

comment:1 follow-up: ↓ 2 Changed 13 years ago by slyfox

Looks like #2416

comment:2 in reply to: ↑ 1 Changed 13 years ago by slyfox

Replying to slyfox:

Looks like #2416

Eh, sorry, #2244.

comment:3 Changed 13 years ago by zap

Indeed, looks like it. I've seen that bug before posting this one, but for some reason decided it's different. But now I see it is very similar, or identic.

How do I mark this bug as a duplicate of that one?

comment:4 Changed 13 years ago by andrew_b

  • Status changed from new to closed
  • Component changed from mc-core to mc-tty
  • Summary changed from Closing the window with mc leaves it in background consuming 100% CPU to ,
  • Version 4.7.4 deleted
  • Milestone 4.7 deleted
  • Resolution set to duplicate

Ok, closed.

comment:5 Changed 13 years ago by andrew_b

  • Summary changed from , to Closing the window with mc leaves it in background consuming 100% CPU
Note: See TracTickets for help on using tickets.