binary-husky/gpt_academic · error · RuntimeError
程序终止。
Error message
程序终止。
What it means
Watchdog abort for the NewBing stream: while iterating newbingfree_handle.stream_chat, if time.time() - observe_window[1] exceeds watch_dog_patience (5s) between yields, RuntimeError('程序终止。') is raised. The NewBing/Sydney protocol relies on websocket pushes that can be silent >5s (handshake, throttling, captcha challenges), tripping the dog.
Source
Thrown at request_llms/bridge_newbingfree.py:249
history_feedin.append([history[2 * i], history[2 * i + 1]])
watch_dog_patience = 5 # 看门狗 (watchdog) 的耐心, 设置5秒即可
response = ""
if len(observe_window) >= 1:
observe_window[0] = "[Local Message] 等待NewBing响应中 ..."
for response in newbingfree_handle.stream_chat(
query=inputs,
history=history_feedin,
system_prompt=sys_prompt,
max_length=llm_kwargs["max_length"],
top_p=llm_kwargs["top_p"],
temperature=llm_kwargs["temperature"],
):
if len(observe_window) >= 1:
observe_window[0] = preprocess_newbing_out_simple(response)
if len(observe_window) >= 2:
if (time.time() - observe_window[1]) > watch_dog_patience:
raise RuntimeError("程序终止。")
return preprocess_newbing_out_simple(response)
def predict(
inputs,
llm_kwargs,
plugin_kwargs,
chatbot,
history=[],
system_prompt="",
stream=True,
additional_fn=None,
):
"""
单线程方法
函数的说明请见 request_llms/bridge_all.py
"""
chatbot.append((inputs, "[Local Message] 等待NewBing响应中 ..."))View on GitHub (pinned to d6bde0fa54)
Solutions
- Check the proxy route to bing.com and the handle's child messages for network errors; retry once.
- Increase watch_dog_patience (30–60s) or update observe_window[1] on each received event.
- Refresh NEWBING_COOKIES — stale sessions cause mid-stream hangs.
- If it keeps tripping, move to a maintained backend; NewBing support is archived.
Defensive patterns
Strategy: retry
Validate before calling
import time window = ['', time.time()] # refresh window[1] per poll; websocket pushes can be silent >5s
Try / catch
try:
resp = newbing_predict_no_ui_long_connection(..., observe_window=window)
except RuntimeError as e:
if '程序终止' in str(e):
window[1] = time.time()
resp = newbing_predict_no_ui_long_connection(..., observe_window=window) Prevention
- watch_dog_patience 30–60s for websocket-backed streams
- Refresh cookies when streams hang mid-generation
- Verify low-latency proxy route to bing.com
When it happens
Trigger: NewBing generation goes >5s without yielding a chunk: slow websocket to Microsoft endpoints, proxy latency, Bing throttling/challenge, or the loader thread's async loop stalled.
Common situations: Overseas proxy with high latency, Bing rate-limiting the account, stale cookies accepted at load then rejected mid-stream, patience left at 5s.
Related errors
AI-assisted analysis of binary-husky/gpt_academic@d6bde0fa54 (2026-08-14).
Data as JSON: /api/errors/e43d46fc750267e6.
Report an issue: GitHub.