mqtt.js client causes event loop to stop
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- javascript, nodejs
- 領域
- desktop
研究方向
Start by reproducing the issue from the nodegui-starter Quick Start setup on Windows with NodeGUI 0.62.0, then compare the label-update loop with and without the mqtt.js connection. The fix is complete when connecting to the MQTT server no longer stops the loop or freezes the QWindow.
由索引模型根據 Issue 內容生成。
描述
Describe the bug
As soon as I connect to an MQTT broker, the event loop stops running and/or becomes very unpredictable.
To Reproduce
Steps to reproduce the behavior:
- Clone the nodegui-starter as described in the Quick Start Guide
npm install @nodegui/nodegui@latest --save- Add a loop to update one of the labels every second
async function loop() {
while(true) {
const timestamp = Math.floor(+new Date() / 1000);
label.setText( `Timestamp: ${timestamp.toString()}` );
await new Promise(resolve => setTimeout(resolve, 1000));
}
}
loop();
npm start- Everything works as expected. Woo!
- install mqtt module, connect to MQTT server
import * as mqtt from 'mqtt';
mqtt.connect('mqtt://localhost:1883');
- Add a button listener, just in case this is related to #864
button.addEventListener('clicked',(checked)=>console.log("clicked")); - The loop executes once, but then gets stuck. Even if I click the button.
Expected behavior
The label should continue to be updated every second, even with a MQTT client present.
Desktop (please complete the following information):
- OS: Windows
- NodeGUI version: 0.62.0
- OS Version: Windows 11
Additional Context
I've tried various other ways of pausing execution, including not using Promises or setTimeout, but this usually ends up freezing the QWindow altogether, resulting in a white, empty window.
- 主要語言
- C++
- 星號
- 9.2k
- 分支
- 315
- PR 合併指標
- 30 天內沒有已合併 PR
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
nodegui/nodegui 的其他 Issue
-
難度 5/5 一週以上 新手友好度 30/100
-
難度 4/5 3-5 天 新手友好度 35/100
-
難度 2/5 1-3 小時 新手友好度 35/100
-
難度 4/5 3-5 天 新手友好度 35/100
-
難度 5/5 一週以上 新手友好度 15/100
相似的 Issue
-
Website Doc Typo 未關閉
難度 1/5 1 小時以內 新手友好度 92/100
-
難度 1/5 1-3 小時 新手友好度 92/100
autowarefoundation/autoware_universe#13413 ·
-
難度 2/5 1-3 小時 新手友好度 88/100
-
automated-analysis bug memory-safety
難度 2/5 1-3 小時 新手友好度 68/100
-
難度 2/5 1-3 小時 新手友好度 88/100