busy loop cpu 100%
run ./usql_static
<img width="682" height="47" alt="Image" src="https://github.com/user-attachments/assets/f2ab1cdf-38a0-48c6-93a8-67a11dfd6223" />
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.
```go
<<<<
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)
}
}
>>>>
```
0 条评论