Closed
Description
Describe the problem
When starting Arduino IDE 2.1.1, it tries to restore the last opened project. If that project is on a shared folder that is now unavailable, the IDE never starts. It does not show an error message. It does not even open a window.
Starting the IDE from CMD prints this:
Failed to start the electron application.
[Error: UNKNOWN: unknown error, stat '\\192.168.1.20\Share\Test\main\main.ino'] {
errno: -4094,
code: 'UNKNOWN',
syscall: 'stat',
path: '\\\\192.168.1.20\\Share\\Test\\main\\main.ino'
}
I had to remove the workspace-object from %AppData%\arduino-ide\config.json, then it started again.
To reproduce
- Create a new sketch
- Save it on a shared folder (e.g. on a NAS or on a folder shared from a different computer)
- Close Arduino IDE
- Unplug your network cable / disconnect WiFi
- Start Arduino IDE
Expected behavior
The IDE should start up, and show a new, empty project (possibly the default sketch that's also shown when clicking on File -> New Sketch). It should ideally show a warning that the previous project (insert path here) could not be reopened.
Arduino IDE version
2.1.1
Operating system
Windows
Operating system version
Windows 10
Additional context
Additional reports
Related
- https://forum.arduino.cc/t/ide-2-1-1-wont-load/1158292
- https://forum.arduino.cc/t/arduino-2-0-ide-does-not-launch/1059988
Issue checklist
- I searched for previous reports in the issue trackerI verified the problem still occurs when using the latest nightly buildMy report contains all necessary details
Activity
kittaakos commentedon Aug 18, 2023
Thanks for the report and for collecting the forum posts. It was super helpful to locate the error:
arduino-ide/arduino-ide-extension/src/electron-main/theia/electron-main-application.ts
Lines 260 to 263 in 9a6a457
To get an
UNKNOWN
error forsyscall: 'stat'
on Windows:IDE2 must handle
UNKNOWN
code here:arduino-ide/arduino-ide-extension/src/node/sketches-service-impl.ts
Lines 692 to 695 in 9a6a457
The timeout is ~25s on my Windows env; IDE2 must use slow tests.
nodejs/node#19965 (comment)
Another topic IDE2 should consider is this:
arduino-ide/arduino-ide-extension/src/node/sketches-service-impl.ts
Line 679 in 9a6a457
So if, for whatever reason, IDE2 cannot open a sketch due to
EACCESS
, the app will hang at startup.fix: handle `UNKNOWN` code on `syscall: 'stat'`
UNKNOWN
code onsyscall: 'stat'
#2174fix: handle `UNKNOWN` code on `syscall: 'stat'`
per1234 commentedon Aug 18, 2023
Despite quite some efforts, I was never able to reproduce this due to #1797. I'm actually quite mystified as to how @Niko-O managed that.
However, I had seen some reports on the forum of a similar problem involving restoring sketches from normal paths. I wasn't able to reproduce it by saving a sketch to a removable drive, then removing the drive before restarting the IDE. However, I noticed the pattern that the sketch was on
D:\
in both reports. This is interesting because that drive letter is typically associated with a DVD drive on computers that have one. My hypothesis was that attempting to restore a sketch from a DVD drive without a disc produced an unusual exception Arduino IDE was not designed to handle. So I tried it out and sure enough I was able to produce a hang under these conditions:To reproduce
Equipment
Set up
create and format hard disk partitions
in the search field.The "Disk Management" window will open.
ⓘ I'll refer to it as
D:\
through the rest of these instructions, but the demo will work for any drive letter.A context menu will open.
The "Change Drive Letter and Paths for ..." dialog will open.
D:\
drive letter, repeat the above procedure via the "Disk Management" utility to assign itD:\
.create and format hard disk partitions
in the search field.The "Disk Management" window will open.
A context menu will open.
The "Change Drive Letter and Paths for ..." dialog will open.
Demo
🐛 The IDE never starts.
The logs show the error:
Arduino IDE version
69ae38e
Operating system
Windows
Operating system version
11
Niko-O commentedon Aug 18, 2023
If opening a project form a path that starts with
\\Server\Share
does not work for you, mounting it as a network drive might work.per1234 commentedon Aug 19, 2023
Thanks for the suggestion. I tried that, but was not able to reproduce the fault via this approach of opening a sketch from a path on a network drive (which is not subject to #1797) and then causing the IDE to attempt to restore the sketch from that path on a startup after I had disconnected the drive.
Instead of producing the fault reported here as I hoped, the IDE only exhibited the intended behavior of falling back on opening a new sketch under these conditions, just the same as it does if it attempts to restore a sketch from a path on a standard removable drive that was removed from the computer since the previous IDE session.
Niko-O commentedon Aug 19, 2023
@per1234
I suspect that's because when you unmount the drive, Windows knows for sure that anything inside that path is definitely not accessible.
If I keep the drive mounted but unplug the network connection and then start the IDE, I can reproduce the issue.
(I find it a bit weird that the drive letter is small here. Windows should not care, but it's weird nontheless.)
fix: handle `UNKNOWN` code on `syscall: 'stat'`