busy loop cpu 100%
Author: wangxuanyueCreated Jan 14, 2026Updated Jan 14, 2026
run ./usql_static
ENV : Linux 5.10.0-46.32.uelc20.x86_64
The problem reason given by AI: This is a known issue, typically occurring in specific environments (especially during static builds), causing the readline library to stop blocking while waiting for input and instead continuously return empty results, which leads the main loop into a busy loop that consumes 100% CPU.
<<<<
case cmd != "":
opt, cont, lastErr = h.apply(stdout, stderr, strings.TrimPrefix(cmd, `\`), paramstr)
}
====
case cmd != "":
opt, cont, lastErr = h.apply(stdout, stderr, strings.TrimPrefix(cmd, `\`), paramstr)
default:
if iactive {
time.Sleep(time.Millisecond)
}
}
>>>>Source: xo/usql