Keyboard input occasionally goes unresponsive

More
11 Oct 2023 07:29 #282731 by dberndt
Hey folks, I'm looking for some suggestions about where to go next in troubleshooting a keyboard issue.

Running 2.9pre1, RIP, Axis, on linux mint 21 using xfce 4.16/xfwm4 on preempt_rt 6.1.20-1

Everything works normally and well most of the time. I use the machine a few times a week for small projects and linuxcnc works, is stable, usable, no keyboard issues, no issues at all really.

But... every once in a while, it seems the keyboard input to linuxcnc gets frozen, or lost, or somehow delayed? I don't really know what to look at to deduce further the nature of the error.

-When the keyboard issue happens Linuxcnc is no longer responsive to any keyboard inputs. Even things like alt+f to open the file menu,
-The problem might tend to start happening when I spam a bunch of keys in/am being productive. An example might be reloading an NGC file via ctrl+r then F5 for MDI and then intending to do a tool change via m6 but finding that I can't type into the MDI window, or anywhere else... This is a suggestion of what I think may be happening, but it's not easily repeatable for me.
-Everything you can do in linuxcnc with a mouse still works.
-The keyboard still works in every other app, the terminal, all the other virtual consoles, etc
-Windows manager things still work, I can resize the linuxcnc window with the mouse, I can resize/minimize/maximize/etc the linuxcnc with windows manager hotkeys.
-Virtual/on screen keyboard is provides not difference from real keyboard
-Unplugging the keyboard and replugging it makes no difference. adding a second keyboard does not help, removing all physical keyboards and using on screen keyboard doesn't help, using a keyboard over VNC does not work.
-It might be the case that if left for a long enough period of time (overnight) the keyboard responsiveness returns, but my sample size on that is very small and it may not be an accurate statement.
-Restarting linuxcnc seems to fix the issue. But restarting linuxcnc and re-homing in the middle of a part is a bit of a gamble as to how well my home switches repeat.

Does anyone have any suggestions as to what I can do to track this down further where the keystrokes are disappearing to? I guess that means investigating axis.py? Are there any other layers to the onion or logging I can turn on/investigate?

 

Please Log in or Create an account to join the conversation.

  • tommylight
  • tommylight's Avatar
  • Away
  • Moderator
  • Moderator
More
11 Oct 2023 12:47 #282743 by tommylight
Replied by tommylight on topic Keyboard input occasionally goes unresponsive
I would assume with quite some certainty that it is a USB keyboard, so if the PC has a PS/2 port and you have an older keyboard with PS/2 connector, test that, see if it gets rid of the issue.
You can also open a terminal and type
sudo top
then use LinuxCNC and watch top to see what is using CPU cycles when the issue happens, it would be at the top of TOP list.

Please Log in or Create an account to join the conversation.

More
17 Nov 2023 18:03 #285762 by dberndt
Replied by dberndt on topic Keyboard input occasionally goes unresponsive
Bringing this one back up as I've had the issue show up a few times recently.

Here's a path to recreation
Get a relatively large ngc, say a few megs, something that'll take a few seconds to load.
Load the file, or use reload/ctrl+r, all will recreate the issue
When the reload is happening and the progress bar is visible at the bottom of axis, press some keys.

When I do this my keyboard becomes non-responsive in axis until i restart linuxcnc.

Please Log in or Create an account to join the conversation.

More
19 Nov 2023 18:10 #285931 by bkt
you try to change keyboard right? after these when these things happens for first open "resources" app (not know name in debian so) fork check level of usages of ram and cpu )....

Please Log in or Create an account to join the conversation.

More
21 Nov 2023 04:08 #286139 by dberndt
Replied by dberndt on topic Keyboard input occasionally goes unresponsive
Yes. I've tried all the keyboard things... Keyboard replacement, etc.

As per my first post, During this condition the keyboard still works everywhere else. Even the on screen keyboard is affected by this problem, it continues to work in all other apps but not in linuxcnc.

Has anyone tried to duplicate?

Please Log in or Create an account to join the conversation.

More
27 Nov 2023 22:48 #286642 by bkt
never see these .... seems wm problem ....

Please Log in or Create an account to join the conversation.

More
06 Dec 2023 16:26 #287365 by dberndt
Replied by dberndt on topic Keyboard input occasionally goes unresponsive
I've had some time to do more digging on this.


There is a call for root_window.update() in open_file_guts that is the source of my problem.

github.com/LinuxCNC/linuxcnc/blob/221758...cripts/axis.py#L1319
    finally:
        # Before unbusying, I update again, so that any keystroke events
        # that reached the program while it was busy are sent to the
        # label, not to another window in the application.  If this
        # update call is removed, the events are only handled after that
        # widget is destroyed and focus has passed to some other widget,
        # which will handle the keystrokes instead, leading to the
        # R-while-loading bug.
        #print "load_time", time.time() - t0
        root_window.update()
        root_window.tk.call("destroy", ".info.progress")
        root_window.tk.call("grab", "release", ".info.progress")
....

It's probably related to the fact that right after it's called the info.progress widget gets destroyed, some sort of timing bug, race condition, unclear. It could also just be the update() function as axis doesn't call it explicitly anywhere else that s frequently used. Padding these lines with some extra time.sleeps around them in various combinations to try to make space the update out from the removal of info.progress widget did not provide any meaningful fix, and introduces the event caching issue that the code is trying to prevent in the first place.

So in short, probably a problem with my OS/WM/Whatever. I've tried all the reasonable WM options available stock in linux mint 21 but all except for wayland+(some wm I've forgotten the name of) seem to have the problem. But the wayland debug output still didn't seem right, it will need more than the 5 minutes testing I gave it.

I've replaced the root_window.update() with a .update_idletasks() which I realize isn't nearly the same thing and opens up a event caching issue during file loading. I don't recommend it for anyone else, but until I update my OS again or a version of TK beyond 8.6.12 rolls into linux mint I don't plan to play with this again unless I find myself losing keyboard functionality again.

I saw in the TCL/TK 8.6.7 release notes there is a bug fixed " * Avoid unreleasable global grab due to menu keyboard traversal". Which sounds kind of like my issue, but I haven't investigated further, and I'm on a latter version.

Please Log in or Create an account to join the conversation.

Time to create page: 0.074 seconds
Powered by Kunena Forum