Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDE is non-functional if package index can't be loaded #1084

Closed
3 tasks done
per1234 opened this issue Jun 20, 2022 · 8 comments · Fixed by #1132 or #1418
Closed
3 tasks done

IDE is non-functional if package index can't be loaded #1084

per1234 opened this issue Jun 20, 2022 · 8 comments · Fixed by #1132 or #1418
Assignees
Labels
conclusion: resolved Issue was resolved topic: CLI Related to Arduino CLI topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@per1234
Copy link
Contributor

per1234 commented Jun 20, 2022

Describe the problem

Package indexes are used by the Arduino Boards Manager system to track the Arduino boards platforms that are available for installation.

These come from two types of sources:

  • The official primary package index
  • URLs specified by the user via the "Additional Boards Manager URLs" field of the IDE's "Preferences" dialog

The package indexes are downloaded from these URLs by Arduino IDE 2.x on startup.

🐛 Under the following conditions, the IDE is non-functional:

  • A package index cannot be downloaded from its URL
  • The package index is not already present in directories.data

To reproduce

  1. Select File > Preferences... from the Arduino IDE menus.
  2. Add the following to the "Additional Boards Manager URLs" field:
    https://downloads.arduino.cc/packages/package_nonexistent_index.json
    
    The issue is not specific to this URL. Any URL that does not provide a package index URL download can be used.
  3. Click the OK button.
  4. Select File > Quit from the Arduino IDE menus.
  5. Start the Arduino IDE.
  6. Open the "Board Selector" menus.
    🐛 No boards are shown.
  7. Open the Tools menu.
    🐛 There is no "Boards" menu.
  8. Open the "Boards Manager" view.
    🐛 The view is empty, not even showing the currently installed platforms.
  9. Open the "Library Manager" view.
    🐛 The view is empty.

🐛 The only way for the user to identify the problem is searching through the logs.

Expected behavior

Clearly communicate to the user that there was a problem with downloading the package index.

It would probably also make sense to retain general functionality of the Arduino IDE (though of course the Boards Manager functionality that relies on the missing package index in particular will not be available).

Arduino IDE version

2.0.0-rc7-snapshot-a715da3

Operating system

Windows

Operating system version

10

Additional context

I bisected the issue to 4c55807 (does not occur with the build from cb50d3a)


The logs contain the following:

root ERROR Uncaught Exception:
root ERROR Error: 13 INTERNAL: Error downloading index 'https://downloads.arduino.cc/packages/package_nonexistent_index.json': Server responded with: 404 Not Found
    at Object.callErrorFromStatus (C:\ide 2\tip\48-a715da3\resources\app\node_modules\@grpc\grpc-js\build\src\call.js:31:26)
    at Object.onReceiveStatus (C:\ide 2\tip\48-a715da3\resources\app\node_modules\@grpc\grpc-js\build\src\client.js:349:49)
    at Object.onReceiveStatus (C:\ide 2\tip\48-a715da3\resources\app\node_modules\@grpc\grpc-js\build\src\client-interceptors.js:328:181)
    at C:\ide 2\tip\48-a715da3\resources\app\node_modules\@grpc\grpc-js\build\src\call-stream.js:187:78
    at processTicksAndRejections (node:internal/process/task_queues:78:11)

Even though it is most likely to occur with package indexes provided by via the "Additional Boards Manager URLs" preference (whether by user error, no connection to Internet, or transient network outage on the server), it does also occur even with the primary package index so long as the conditions described previously are present.


Originally reported at #1036 (comment)

I mistakenly claimed that issue had been fixed by #1045 because I did not realize at that time that the package index's absence from directories.data was a required condition to reproduce it.


Related:

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
@kittaakos
Copy link
Contributor

This will be partially fixed with #1132. A follow-up issue is here: arduino/arduino-cli#1788

@per1234
Copy link
Contributor Author

per1234 commented Jul 6, 2022

Hi @Lorandil. There have been significant advancements since the 2.0.0-rc8 version of the Arduino IDE you are using. Please always test using the latest nightly build before submitting a report here on GitHub.

In this case, there is work in progress in a pull request to even further improve the handling of these URLs. The tester build from that pull request is the most advanced form of the Arduino IDE. Please give it a try and then tell us whether it solves your issue.

I'll provide instructions for how you can download the tester build:

  1. Sign in to your GitHub account.
    (GitHub only allows downloads of the tester builds when you are signed in.)
  2. Open this page in your browser:
    https://github.com/arduino/arduino-ide/pull/1132/checks
  3. From the list of workflow runs on the left side of the page, click on "Arduino IDE" (this is the build workflow).
  4. From the "Artifacts" section of the page, click the download link for your operating system.
    For example, if you are using Windows, use the "Windows_X86-64_zip" link.
  5. Wait for the download to finish.
  6. Extract or install the downloaded file as usual.

@Lorandil
Copy link

Lorandil commented Jul 7, 2022

Hi @per1234 ,

I tried the nightly from today and it didn't solve the problem for me.

@per1234
Copy link
Contributor Author

per1234 commented Jul 7, 2022

@Lorandil I think it will be better for us to continue this investigation over on the Arduino Forum. Please post in the dedicated category for Arduino IDE 2.x:

https://forum.arduino.cc/c/software/arduino-ide-2-0-beta/93

I'm certain to see your post over there.

@per1234 per1234 added conclusion: resolved Issue was resolved and removed conclusion: resolved Issue was resolved labels Jul 8, 2022
@per1234
Copy link
Contributor Author

per1234 commented Jul 8, 2022

The issue was closed inadvertently during the merge of #1132 due to a chance occurrence of a GitHub issue closing keyword.

The IDE has been made much more resilient to failed package index downloads via #1132, and also does an excellent job of communicating about such failures to the user via the notification system.

The IDE now works just as expected when following the instructions I provided above. There remains one case where a failed package index download produces unexpected behavior:

  1. Select File > Preferences... from the Arduino IDE menus.
  2. Add the following to the "Additional Boards Manager URLs" field:
    https://downloads.arduino.cc/packages/package_nonexistent_index.json
    
  3. Click the OK button.
  4. Select File > Quit from the Arduino IDE menus.
  5. Rename or delete (⚠ carefully!) the following folder:
    • Windows:
      %LOCALAPPDATA%\Arduino15\
      
      (e.g., C:\Users\<username>\AppData\Local\Arduino15\)
    • Linux:
      ~/.arduino15/
      
    • macOS:
      ~/Library/Arduino15/
      
  6. Start the Arduino IDE.

🐛 The IDE startup hangs at the splash screen

Additional context

The IDE will start and function correctly if you close and then restart it.

@per1234 per1234 reopened this Jul 8, 2022
@Lorandil
Copy link

Hi all,
just a quick update: The problem is fixed for me with the nightly of 2022-07-10.

The working boards are there and an error message is displayed - which exposes the root cause of the problem:
There was a blank after the esp8266 board manager link. Removing the blank solved the issue completely.
I suggest left/right trimming blanks from the boardmanager URLs.

Thanks for fixing the problem!

@per1234
Copy link
Contributor Author

per1234 commented Jul 13, 2022

I'm glad you were able to find the problem @Lorandil

There was a blank after the esp8266 board manager link. Removing the blank solved the issue completely.
I suggest left/right trimming blanks from the boardmanager URLs.

Thanks for your report.

I did some experimentation but was not ever able to reproduce the problem. Please provide detailed instructions I can follow to reproduce it.

@kittaakos kittaakos added the topic: CLI Related to Arduino CLI label Sep 5, 2022
kittaakos pushed a commit to kittaakos/arduino-ide that referenced this issue Sep 28, 2022
 - IDE2 can start if the package index download fails. Closes arduino#1084
 - Split the lib and platform index update. Closes arduino#1156

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit to kittaakos/arduino-ide that referenced this issue Sep 29, 2022
 - IDE2 can start if the package index download fails. Closes arduino#1084
 - Split the lib and platform index update. Closes arduino#1156

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit to kittaakos/arduino-ide that referenced this issue Oct 4, 2022
 - IDE2 can start if the package index download fails. Closes arduino#1084
 - Split the lib and platform index update. Closes arduino#1156

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
@per1234 per1234 added the conclusion: resolved Issue was resolved label Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: CLI Related to Arduino CLI topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
3 participants