BTT freezes, even restarting does not help

Describe the bug
BTT (including floating menus) becomes "Not Responding" for 1 to 5 minutes and recover automatically. Restarting BTT does not help until it automatically recovers, the new processes instantly freeze.


Affected input device (e.g. MacBook Trackpad, Magic Mouse/Trackpad, Touch Bar, etc.):

Everything


Device information:

  • Type of Mac: MacBook M4 Pro
  • macOS version: 26.6.2
  • BetterTouchTool version: 6.820

Additional information (e.g. crash logs, related issues, etc.):

Two sample BetterTouchTool outputs attached, from the same instance.

btt_sample_freeze.txt (238.3 KB)

btt_sample_normal.txt (403.0 KB)

did you copy some very large HTML?

It seens like BTT's clipboard manager froze while trying to parse the HTML for rendering in the manager. 6.824 adds a little optimization to skip very large html.

No, I rarely copy anything large.

The latest HTML that causes some lag (stutter for ~1s) is

<meta charset='utf-8'><a data-v-660fa286="" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; color: rgb(10, 112, 245); transition: color 0.3s; background: 0px 0px rgb(245, 245, 245); text-decoration: none; outline: 0px; cursor: pointer; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;PingFang SC&quot;, &quot;Heiti SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;">(redacted)</a>

which is different from the problem.

BTW, all input processing stops in BTT during the freeze as if it is quit. If I attempt to trigger a mouse gesture, all mouse movements during the freeze will be displayed (likely queued?) after un-freeze.

Mhm the sample you posted is definitely trying to save some copied HTML for BTT's clipboard manager. However if even such a small html as posted above causes a 1s stutter, something must be pretty wrong. In that case I'd recommend to restart your machine. This is mostly handled by system frameworks, so possibly something is in a bad state.

Mind telling me which APIs are being used for this? I'll try to let Claude make an app that hopefully reproduces this (I've been haunted by mysterious stutters for months) to see if it's something my company installed on the system causing this. They know nothing about these "security" products, and I'll need to pin-point issues before opening tickets.

just NSAttributedString's initWithHTML

stringData = [[[NSAttributedString alloc]
    initWithHTML:attributedData
    documentAttributes:nil] string];

Made some experiments with Claude.

<p>hello</p>

parses instantly.

<link rel="stylesheet" href="https://site.that.times.out/style.css"><p>hello</p>

hangs for a long time.

The system console also shows that com.apple.textkit.nsattributedstringagent (the background process that actually handles the parsing) is attempting to do DNS resolution and connection to that site.

init(data:options:documentAttributes:) | Apple Developer Documentation also says that HTML snippets with references to external resources (can happen if copied from the browser) should be avoided.

Maybe you should consider other APIs for this task...

I already added some workaround in the above mentioned 6.824. I think that should resolve your issue

Can confirm that throwing crafted HTML into the clipboard no longer hangs BTT. Considered solved then?

Yep, I hope so!