Description
Describe the problem
The IDE hangs permanently during the "Save As..." operation under the following conditions:
- IDE was last shut down via "File > Quit"
- Currently selected board is from a different platform than the one selected in the previous window
- The language server "indexing" process is in progress
To reproduce
- Start the Arduino IDE.
- Select File > Quit from the Arduino IDE menus.
❗ This exact shutdown method is required. The bug does not occur after shutting the IDE down via File > Close or the native window close control on the title bar (i.e., X or 🔴). - Start the Arduino IDE.
- Select File > New from the Arduino IDE menus.
- Select a board of a different platform from the Tools > Board menu in the Arduino IDE.
ⓘ e.g., if you originally had "Arduino Uno" ("Arduino AVR Boards" platform) selected, you could select "Arduino Nano 33 BLE" ("Arduino Mbed OS Nano Boards" platform).
❗ The issue is timing sensitive, so you will have a short time window if selecting a board from a lightweight platform such as "Arduino AVR Boards". The boards of any of the "Arduino Mbed OS ____ Boards" platforms are recommended as these provide a large window. - Immediately select File > Save As... from the Arduino IDE menus.
- Immediately click the Save button.
❗ This must be done while the IDE is still in the state where it shows something like "indexing 42/188" at the left side of the status bar.
🐛 The IDE hangs forever in the state where the window title is "index.html" and contains spinning dots:
Expected behavior
The sketch that was produced by the "Save As..." operation is loaded in the Arduino IDE.
Arduino IDE version
2.0.0-rc5-snapshot-f36df02 Date: 2022-03-17T10:22:00.589Z
Operating system
Windows
Operating system version
10
Additional context
The first version I can reproduce this fault with is e6b9d4e. I can not reproduce the fault with 69ac1f4.
The "Save As..." process stopped working correctly at 112153f (#829), so it is possible that the bug was introduced somewhere between 69ac1f4 and e6b9d4e but was not visible due to #829
I see the following output printed on the command line after I do a File > Quit:
root ERROR Uncaught Exception:
root ERROR Error: Connection got disposed.
at Object.dispose (C:\ide 2\18-arduino-ide_2.0.0-rc5-snapshot-f36df02_Windows_64bit\resources\app\node_modules\vscode-jsonrpc\lib\main.js:904:25)
at C:\ide 2\18-arduino-ide_2.0.0-rc5-snapshot-f36df02_Windows_64bit\resources\app\node_modules\vscode-ws-jsonrpc\lib\socket\connection.js:14:41
at CallbackList.invoke (C:\ide 2\18-arduino-ide_2.0.0-rc5-snapshot-f36df02_Windows_64bit\resources\app\node_modules\vscode-jsonrpc\lib\events.js:62:39)
at Emitter.fire (C:\ide 2\18-arduino-ide_2.0.0-rc5-snapshot-f36df02_Windows_64bit\resources\app\node_modules\vscode-jsonrpc\lib\events.js:121:36)
at closeHandler (C:\ide 2\18-arduino-ide_2.0.0-rc5-snapshot-f36df02_Windows_64bit\resources\app\node_modules\vscode-jsonrpc\lib\main.js:240:26)
at CallbackList.invoke (C:\ide 2\18-arduino-ide_2.0.0-rc5-snapshot-f36df02_Windows_64bit\resources\app\node_modules\vscode-jsonrpc\lib\events.js:62:39)
at Emitter.fire (C:\ide 2\18-arduino-ide_2.0.0-rc5-snapshot-f36df02_Windows_64bit\resources\app\node_modules\vscode-jsonrpc\lib\events.js:121:36)
at WebSocketMessageReader.fireClose (C:\ide 2\18-arduino-ide_2.0.0-rc5-snapshot-f36df02_Windows_64bit\resources\app\node_modules\vscode-jsonrpc\lib\messageReader.js:111:27)
at WebSocketMessageReader.fireClose (C:\ide 2\18-arduino-ide_2.0.0-rc5-snapshot-f36df02_Windows_64bit\resources\app\node_modules\vscode-ws-jsonrpc\lib\socket\reader.js:67:19)
at C:\ide 2\18-arduino-ide_2.0.0-rc5-snapshot-f36df02_Windows_64bit\resources\app\node_modules\vscode-ws-jsonrpc\lib\socket\reader.js:24:18
I see the same output printed multiple times after the fault occurs.
I suspect it is related to #657
I was only able to reproduce the fault by saving during the language server "indexing" operation triggered by the board selection. The fault did not occur for me when saving during subsequent indexing operation triggered by editing the sketch.
I was not able to reproduce the issue with the "Arduino > Language: Log" setting enabled.
Originally reported at:
- https://forum.arduino.cc/t/saving-files-is-a-crap-shoot/970560/5
- https://forum.arduino.cc/t/freeze-on-save-when-using-save-as/996842
Some of the user reports did not match the specific procedure for reproduction I described above, and I have also encountered it occasionally under other conditions.
I believe that the fault can be triggered in other ways, but I wanted to provide a procedure that consistently reproduces the issue and this was the one I happened to discover.
Issue checklist
- I searched for previous reports in the issue tracker
- I verified the problem still occurs when using the latest nightly build
- My report contains all necessary details