Skip to content

clip.py frequently hangs in Emacs on WSLg #426

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wolfmanstout opened this issue Nov 13, 2021 · 5 comments
Closed

clip.py frequently hangs in Emacs on WSLg #426

wolfmanstout opened this issue Nov 13, 2021 · 5 comments

Comments

@wolfmanstout
Copy link

It is entirely possible that this is a Windows 11 bug, but I'm filing it here to help others make an informed decision about whether to upgrade.

I have observed frequent hangs when I enable context sensitive dictation, but only on my Windows 11 machine, not my Windows 10 machine. These hangs happen frequently and in multiple applications (e.g. Firefox and Emacs running in WSL), arising from clip.py. Here are the most typical traces:

    8: user\wolfmanstout_talon\code\dictation.py:339 | after = actions.edit.selected_text()
    7:                talon\scripting\actions.py:75  | # edit.selected_text()
    6:                  talon\scripting\types.py:366 | 
    5:      user\wolfmanstout_talon\code\edit.py:12  | actions.edit.copy()
    4:                             contextlib.py:126 | 
    3:                             talon\clip.py:189 | 
    2:                             talon\clip.py:129 | 
    1:                             talon\clip.py:59  | 
    9: user\wolfmanstout_talon\code\dictation.py:295 | text = actions.edit.selected_text()
    8:                talon\scripting\actions.py:75  | # edit.selected_text()
    7:                  talon\scripting\types.py:366 | 
    6:      user\wolfmanstout_talon\code\edit.py:11  | with clip.capture() as s:
    5:                             contextlib.py:119 | 
    4:                             talon\clip.py:185 | 
    3:                             contextlib.py:119 | 
    2:                             talon\clip.py:165 | 
    1:                             talon\clip.py:59  | 

When this happens I've see problematic behavior elsewhere in the operating system even after killing Talon, e.g. Firefox may hang if I paste something in or the Windows start button search feature may not work. I haven't seen these issues when Talon is not interacting with the clipboard.

@wolfmanstout
Copy link
Author

From talking to Ryan, this code is calling Qt's clipboard functions. Nothing on their Windows 11 bug tracker yet about this:
https://bugreports.qt.io/browse/QTBUG-95374?jql=labels%20%3D%20Windows11%20

If I can find the time, I might see if I can create a small Qt-only repro for this and file a bug there.

@lunixbochs
Copy link

I notice you've truncated these traces, can you provide the full backtrace?

@wolfmanstout
Copy link
Author

Sure. Note that I've (not surprisingly) reproduced this on both Dragon and Conformer:

2021-11-12 21:00:34 WARNING [watchdog] "talon.scripting.speech_system.engine_event" @2.0s
   47:                                threading.py:930* # cron thread
   46:                                threading.py:973* 
   45:                                threading.py:910* 
   44:                               talon\cron.py:155| 
   43:                               talon\cron.py:103| 
   42:                     talon\scripting\rctx.py:233| # 'cron' talon_plugins.engines.dragon:<lambda>()
   41:                 talon\scripting\dispatch.py:99 | 
   40:                 talon\scripting\dispatch.py:105| 
   39:                 talon\scripting\dispatch.py:144| 
   38:                 talon\scripting\dispatch.py:133| 
   37:                     talon\scripting\rctx.py:233| # 'phrase' main:_redispatch()
   36:            talon\scripting\speech_system.py:62 | 
   35:                 talon\scripting\dispatch.py:105| 
   34:                 talon\scripting\dispatch.py:144| 
   33:                 talon\scripting\dispatch.py:133| 
   32:                     talon\scripting\rctx.py:233| # 'phrase' main:engine_event()
   31:            talon\scripting\speech_system.py:406| 
   30:                  talon\scripting\actions.py:75 | # core.run_phrase()
   29:                    talon\scripting\types.py:366| 
   28:                talon\scripting\core\core.py:100| 
   27:                  talon\scripting\actions.py:75 | # core.run_command()
   26:                    talon\scripting\types.py:366| 
   25:                talon\scripting\core\core.py:129| 
   24:                  talon\scripting\actions.py:75 | # core.run_talon_script()
   23:                    talon\scripting\types.py:366| 
   22:                talon\scripting\core\core.py:134| 
   21:             talon\scripting\talon_script.py:691| 
   20:             talon\scripting\talon_script.py:590| 
   19:             talon\scripting\talon_script.py:297| 
   18:             talon\scripting\talon_script.py:557| 
   17:                  talon\scripting\actions.py:75 | # auto_insert()
   16:                    talon\scripting\types.py:366| 
   15:   user\wolfmanstout_talon\code\dictation.py:340| def auto_insert(text): actions.user.di..
   14:                  talon\scripting\actions.py:75 | # user.dictation_insert()
   13:                    talon\scripting\types.py:366| 
   12:   user\wolfmanstout_talon\code\dictation.py:255| char = actions.user.dictation_peek_rig..
   11:                  talon\scripting\actions.py:75 | # user.dictation_peek_right()
   10:                    talon\scripting\types.py:366| 
    9: user\wolfmanstout_talon\apps\emacs\emacs.py:204| after = actions.edit.selected_text()
    8:                  talon\scripting\actions.py:75 | # edit.selected_text()
    7:                    talon\scripting\types.py:366| 
    6:        user\wolfmanstout_talon\code\edit.py:11 | with clip.capture() as s:
    5:                               contextlib.py:119| 
    4:                               talon\clip.py:185| 
    3:                               contextlib.py:119| 
    2:                               talon\clip.py:165| 
    1:                               talon\clip.py:59 | 
2021-11-06 22:06:19 WARNING [watchdog] "talon.scripting.speech_system.engine_event" @2.0s
   47:                              threading.py:930 * # cron thread
   46:                              threading.py:973 * 
   45:                              threading.py:910 * 
   44:                             talon\cron.py:155 | 
   43:                             talon\cron.py:106 | 
   42:                              talon\vad.py:21  | 
   41:          talon\scripting\speech_system.py:355 | 
   40:                      talon\engines\w2l.py:1067| 
   39:               talon\scripting\dispatch.py:105 | 
   38:               talon\scripting\dispatch.py:144 | 
   37:               talon\scripting\dispatch.py:133 | 
   36:                   talon\scripting\rctx.py:233 | # 'phrase' main:_redispatch()
   35:          talon\scripting\speech_system.py:62  | 
   34:               talon\scripting\dispatch.py:105 | 
   33:               talon\scripting\dispatch.py:144 | 
   32:               talon\scripting\dispatch.py:133 | 
   31:                   talon\scripting\rctx.py:233 | # 'phrase' main:engine_event()
   30:          talon\scripting\speech_system.py:406 | 
   29:                talon\scripting\actions.py:75  | # core.run_phrase()
   28:                  talon\scripting\types.py:366 | 
   27:              talon\scripting\core\core.py:100 | 
   26:                talon\scripting\actions.py:75  | # core.run_command()
   25:                  talon\scripting\types.py:366 | 
   24:              talon\scripting\core\core.py:129 | 
   23:                talon\scripting\actions.py:75  | # core.run_talon_script()
   22:                  talon\scripting\types.py:366 | 
   21:              talon\scripting\core\core.py:134 | 
   20:           talon\scripting\talon_script.py:691 | 
   19:           talon\scripting\talon_script.py:590 | 
   18:           talon\scripting\talon_script.py:297 | 
   17:           talon\scripting\talon_script.py:557 | 
   16:                talon\scripting\actions.py:75  | # auto_insert()
   15:                  talon\scripting\types.py:366 | 
   14: user\wolfmanstout_talon\code\dictation.py:351 | def auto_insert(text): actions.user.di..
   13:                talon\scripting\actions.py:75  | # user.dictation_insert()
   12:                  talon\scripting\types.py:366 | 
   11: user\wolfmanstout_talon\code\dictation.py:266 | char = actions.user.dictation_peek_rig..
   10:                talon\scripting\actions.py:75  | # user.dictation_peek_right()
    9:                  talon\scripting\types.py:366 | 
    8: user\wolfmanstout_talon\code\dictation.py:339 | after = actions.edit.selected_text()
    7:                talon\scripting\actions.py:75  | # edit.selected_text()
    6:                  talon\scripting\types.py:366 | 
    5:      user\wolfmanstout_talon\code\edit.py:12  | actions.edit.copy()
    4:                             contextlib.py:126 | 
    3:                             talon\clip.py:189 | 
    2:                             talon\clip.py:129 | 
    1:                             talon\clip.py:59  | 

@wolfmanstout
Copy link
Author

Having now tested this for a couple more weeks, I have narrowed it down to Emacs running on WSLg. The reason I thought this affected multiple apps (e.g. Firefox) was because multiple apps would freeze when this happens, obscuring culprit finding (including after Talon restart). I've disabled context sensitivity in Emacs for the past five days and the issue has not recurred (even though I continue to use Emacs). One of the comments in this WSLg bug report sounds like someone else seeing a similar issue: microsoft/wslg#401

It seems highly likely that the fix will lie within WSLg, but it may be helpful to keep this open in case others run into the same problem. If I can find the time I will try to create a cleaner repro to post on WSLg issue tracker.

@wolfmanstout wolfmanstout changed the title clip.py frequently hangs on Windows 11 clip.py frequently hangs in Emacs on WSLg Nov 26, 2021
@lunixbochs lunixbochs added the qt label Jan 19, 2023
@lunixbochs
Copy link

lunixbochs commented Mar 19, 2023

please file a new issue if talon-rust has this behavior, as we have an entirely new clipboard backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants