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

panic: runtime error: invalid memory address or nil pointer dereference when listing firmwares #141

Closed
3 tasks done
kittaakos opened this issue May 19, 2022 · 4 comments
Closed
3 tasks done
Assignees
Labels
status: waiting for information More information must be provided before work can proceed topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@kittaakos
Copy link

Describe the problem

This happened in the Arduino IDE. See the original comment here.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x14bd30e]

goroutine 1 [running]:
github.com/arduino/arduino-fwuploader/cli/firmware.list(0x0, 0x0)
	/home/runner/work/arduino-fwuploader/arduino-fwuploader/cli/firmware/list.go:66 +0x4e
github.com/arduino/arduino-fwuploader/cli/firmware.newListCommand.func1(0xc000492500, 0xc000158ea0, 0x0, 0x2)
	/home/runner/work/arduino-fwuploader/arduino-fwuploader/cli/firmware/list.go:42 +0x39
github.com/spf13/cobra.(*Command).execute(0xc000492500, 0xc000158e80, 0x2, 0x2, 0xc000492500, 0xc000158e80)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:856 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0xc0001eb900, 0x0, 0x0, 0x1501260)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:960 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:897
main.main()
	/home/runner/work/arduino-fwuploader/arduino-fwuploader/main.go:35 +0x3c Error: Error executing "/Users/a.kitta/dev/git/arduino-ide/arduino-ide-extension/build/arduino-fwuploader" firmware list --format json: unexpected end of JSON input
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x14bd30e]

goroutine 1 [running]:
github.com/arduino/arduino-fwuploader/cli/firmware.list(0x0, 0x0)
	/home/runner/work/arduino-fwuploader/arduino-fwuploader/cli/firmware/list.go:66 +0x4e
github.com/arduino/arduino-fwuploader/cli/firmware.newListCommand.func1(0xc000492500, 0xc000158ea0, 0x0, 0x2)
	/home/runner/work/arduino-fwuploader/arduino-fwuploader/cli/firmware/list.go:42 +0x39
github.com/spf13/cobra.(*Command).execute(0xc000492500, 0xc000158e80, 0x2, 0x2, 0xc000492500, 0xc000158e80)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:856 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0xc0001eb900, 0x0, 0x0, 0x1501260)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:960 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:897
main.main()
	/home/runner/work/arduino-fwuploader/arduino-fwuploader/main.go:35 +0x3c
    at ChildProcess.<anonymous> (/Users/a.kitta/dev/git/arduino-ide/arduino-ide-extension/lib/node/exec-util.js:53:31)
    at ChildProcess.emit (node:events:394:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
    at Process.callbackTrampoline (node:internal/async_hooks:130:17)

To reproduce

I do not have a straightforward way to reproduce the defect, but as noted here, the firmware updater returns with an invalid JSON occasionally.

Click to expand the invalid JSON
[
  {
    "board_name": "Arduino MKR1000",
    "board_fqbn": "arduino:samd:mkr1000",
    "module": "WINC1500",
    "firmware_version": "19.4.4",
    "Latest": false
  },
  {
    "board_name": "Arduino MKR1000",
    "board_fqbn": "arduino:samd:mkr1000",
    "module": "WINC1500",
    "firmware_version": "19.5.2",
    "Latest": false
  },
  {
    "board_name": "Arduino MKR1000",
    "board_fqbn": "arduino:samd:mkr1000",
    "module": "WINC1500",
    "firmware_version": "19.5.4",
    "Latest": false
  },
  {
    "board_name": "Arduino MKR1000",
    "board_fqbn": "arduino:samd:mkr1000",
    "module": "WINC1500",
    "firmware_version": "19.6.1",
    "Latest": true
  },
  {
    "board_name": "Arduino MKR WiFi 1010",
    "board_fqbn": "arduino:samd:mkrwifi1010",
    "module": "NINA",
    "firmware_version": "1.0.0",
    "Latest": false
  },
  {
    "board_name": "Arduino MKR WiFi 1010",
    "board_fqbn": "arduino:samd:mkrwifi1010",
    "module": "NINA",
    "firmware_version": "1.1.0",
    "Latest": false
  },
  {
    "board_name": "Arduino MKR WiFi 1010",
    "board_fqbn": "arduino:samd:mkrwifi1010",
    "module": "NINA",
    "firmware_version": "1.2.1",
    "Latest": false
  },
  {
    "board_name": "Arduino MKR WiFi 1010",
    "board_fqbn": "arduino:samd:mkrwifi1010",
    "module": "NINA",
    "firmware_version": "1.2.2",
    "Latest": false
  },
  {
    "board_name": "Arduino MKR WiFi 1010",
    "board_fqbn": "arduino:samd:mkrwifi1010",
    "module": "NINA",
    "firmware_version": "1.2.3",
    "Latest": false
  },
  {
    "board_name": "Arduino MKR WiFi 1010",
    "board_fqbn": "arduino:samd:mkrwifi1010",
    "module": "NINA",
    "firmware_version": "1.2.4",
    "Latest": false
  },
  {
    "board_name": "Arduino MKR WiFi 1010",
    "board_fqbn": "arduino:samd:mkrwifi1010",
    "module": "NINA",
    "firmware_version": "1.3.0",
    "Latest": false
  },
  {
    "board_name": "Arduino MKR WiFi 1010",
    "board_fqbn": "arduino:samd:mkrwifi1010",
    "module": "NINA",
    "firmware_version": "1.4.0",
    "Latest": false
  },
  {
    "board_name": "Arduino MKR WiFi 1010",
    "board_fqbn": "arduino:samd:mkrwifi1010",
    "module": "NINA",
    "firmware_version": "1.4.1",
    "Latest": false
  },
  {
    "board_name": "Arduino MKR WiFi 1010",
    "board_fqbn": "arduino:samd:mkrwifi1010",
    "module": "NINA",
    "firmware_version": "1.4.2",
    "Latest": false
  },
  {
    "board_name": "Arduino MKR WiFi 1010",
    "board_fqbn": "arduino:samd:mkrwifi1010",
    "module": "NINA",
    "firmware_version": "1.4.3",
    "Latest": false
  },
  {
    "board_name": "Arduino MKR WiFi 1010",
    "board_fqbn": "arduino:samd:mkrwifi1010",
    "module": "NINA",
    "firmware_version": "1.4.4",
    "Latest": false
  },
  {
    "board_name": "Arduino MKR WiFi 1010",
    "board_fqbn": "arduino:samd:mkrwifi1010",
    "module": "NINA",
    "firmware_version": "1.4.5",
    "Latest": false
  },
  {
    "board_name": "Arduino MKR WiFi 1010",
    "board_fqbn": "arduino:samd:mkrwifi1010",
    "module": "NINA",
    "firmware_version": "1.4.6",
    "Latest": false
  },
  {
    "board_name": "Arduino MKR WiFi 1010",
    "board_fqbn": "arduino:samd:mkrwifi1010",
    "module": "NINA",
    "firmware_version": "1.4.7",
    "Latest": false
  },
  {
    "board_name": "Arduino MKR WiFi 1010",
    "board_fqbn": "arduino:samd:mkrwifi1010",
    "module": "NINA",
    "firmware_version": "1.4.8",
    "Latest": true
  },
  {
    "board_name": "Arduino NANO 33 IoT",
    "board_fqbn": "arduino:samd:nano_33_iot",
    "module": "NINA",
    "firmware_version": "1.0.0",
    "Latest": false
  },
  {
    "board_name": "Arduino NANO 33 IoT",
    "board_fqbn": "arduino:samd:nano_33_iot",
    "module": "NINA",
    "firmware_version": "1.1.0",
    "Latest": false
  },
  {
    "board_name": "Arduino NANO 33 IoT",
    "board_fqbn": "arduino:samd:nano_33_iot",
    "module": "NINA",
    "firmware_version": "1.2.1",
    "Latest": false
  },
  {
    "board_name": "Arduino NANO 33 IoT",
    "board_fqbn": "arduino:samd:nano_33_iot",
    "module": "NINA",
    "firmware_version": "1.2.2",
    "Latest": false
  },
  {
    "board_name": "Arduino NANO 33 IoT",
    "board_fqbn": "arduino:samd:nano_33_iot",
    "module": "NINA",
    "firmware_version": "1.2.3",
    "Latest": false
  },
  {
    "board_name": "Arduino NANO 33 IoT",
    "board_fqbn": "arduino:samd:nano_33_iot",
    "module": "NINA",
    "firmware_version": "1.2.4",
    "Latest": false
  },
  {
    "board_name": "Arduino NANO 33 IoT",
    "board_fqbn": "arduino:samd:nano_33_iot",
    "module": "NINA",
    "firmware_version": "1.3.0",
    "Latest": false
  },
  {
    "board_name": "Arduino NANO 33 IoT",
    "board_fqbn": "arduino:samd:nano_33_iot",
    "module": "NINA",
    "firmware_version": "1.4.0",
    "Latest": false
  },
  {
    "board_name": "Arduino NANO 33 IoT",
    "board_fqbn": "arduino:samd:nano_33_iot",
    "module": "NINA",
    "firmware_version": "1.4.1",
    "Latest": false
  },
  {
    "board_name": "Arduino NANO 33 IoT",
    "board_fqbn": "arduino:samd:nano_33_iot",
    "module": "NINA",
    "firmware_version": "1.4.2",
    "Latest": false
  },
  {
    "board_name": "Arduino NANO 33 IoT",
    "board_fqbn": "arduino:samd:nano_33_iot",
    "module": "NINA",
    "firmware_version": "1.4.3",
    "Latest": false
  },
  {
    "board_name": "Arduino NANO 33 IoT",
    "board_fqbn": "arduino:samd:nano_33_iot",
    "module": "NINA",
    "firmware_version": "1.4.4",
    "Latest": false
  },
  {
    "board_name": "Arduino NANO 33 IoT",
    "board_fqbn": "arduino:samd:nano_33_iot",
    "module": "NINA",
    "firmware_version": "1.4.5",
    "Latest": false
  },
  {
    "board_name": "Arduino NANO 33 IoT",
    "board_fqbn": "arduino:samd:nano_33_iot",
    "module": "NINA",
    "firmware_version": "1.4.6",
    "Latest": false
  },
  {
    "board_name": "Arduino NANO 33 IoT",
    "board_fqbn": "arduino:samd:nano_33_iot",
    "module": "NINA",
    "firmware_version": "1.4.7",
    "Latest": false
  },
  {
    "board_name": "Arduino NANO 33 IoT",
    "board_fqbn": "arduino:samd:nano_33_iot",
    "module": "NINA",
    "firmware_version": "1.4.8",
    "Latest": true
  },
  {
    "board_name": "Arduino MKR Vidor 4000",
    "board_fqbn": "arduino:samd:mkrvidor4000",
    "module": "NINA",
    "firmware_version": "1.0.0",
    "Latest": false
  },
  {
    "board_name": "Arduino MKR Vidor 4000",
    "board_fqbn": "arduino:samd:mkrvidor4000",
    "module": "NINA",
    "firmware_version": "1.1.0",
    "Latest": true
  },
  {
    "board_name": "Arduino Uno WiFi Rev2",
    "board_fqbn": "arduino:megaavr:uno2018",
    "module": "NINA",
    "firmware_version": "1.2.1",
    "Latest": false
  },
  {
    "board_name": "Arduino Uno WiFi Rev2",
    "board_fqbn": "arduino:megaavr:uno2018",
    "module": "NINA",
    "firmware_version": "1.2.2",
    "Latest": false
  },
  {
    "board_name": "Arduino Uno WiFi Rev2",
    "board_fqbn": "arduino:megaavr:uno2018",
    "module": "NINA",
    "firmware_version": "1.2.3",
    "Latest": false
  },
  {
    "board_name": "Arduino Uno WiFi Rev2",
    "board_fqbn": "arduino:megaavr:uno2018",
    "module": "NINA",
    "firmware_version": "1.2.4",
    "Latest": false
  },
  {
    "board_name": "Arduino Uno WiFi Rev2",
    "board_fqbn": "arduino:megaavr:uno2018",
    "module": "NINA",
    "firmware_version": "1.3.0",
    "Latest": false
  },
  {
    "board_name": "Arduino Uno WiFi Rev2",
    "board_fqbn": "arduino:megaavr:uno2018",
    "module": "NINA",
    "firmware_version": "1.4.0",
    "Latest": false
  },
  {
    "board_name": "Arduino Uno WiFi Rev2",
    "board_fqbn": "arduino:megaavr:uno2018",
    "module": "NINA",
    "firmware_version": "1.4.1",
    "Latest": false
  },
  {
    "board_name": "Arduino Uno WiFi Rev2",
    "board_fqbn": "arduino:megaavr:uno2018",
    "module": "NINA",
    "firmware_version": "1.4.2",
    "Latest": false
  },
  {
    "board_name": "Arduino Uno WiFi Rev2",
    "board_fqbn": "arduino:megaavr:uno2018",
    "module": "NINA",
    "firmware_version": "1.4.3",
    "Latest": false
  },
  {
    "board_name": "Arduino Uno WiFi Rev2",
    "board_fqbn": "arduino:megaavr:uno2018",
    "module": "NINA",
    "f

Expected behavior

No error.

Arduino Firmware Uploader version

arduino-fwuploader Version: 2.0.0 Commit: eb51bf2 Date: 2021-07-28T16:19:28Z

Operating system

macOS

Operating system version

12.3.1 (21E258)

Additional context

I could not reproduce the bug. The latest and 2.0.0 versions worked when I executed the following command in a terminal.

./arduino-fwuploader firmware list --format json

But it happened multiple times in the IDE. I do not know where the null pointer exception comes from.

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest version
  • My report contains all necessary details
@kittaakos kittaakos added the type: imperfection Perceived defect in any part of project label May 19, 2022
@per1234 per1234 added the topic: code Related to content of the project itself label May 19, 2022
@umbynos
Copy link
Contributor

umbynos commented May 19, 2022

Hi @kittaakos could you please try if the problem is still present in the latest release (2.2.0 ATM)? I'm asking because this probably has been fixed in #128

@per1234 per1234 added the status: waiting for information More information must be provided before work can proceed label May 19, 2022
@kittaakos
Copy link
Author

Thank you for the quick reaction ❤️

could you please try if the problem is still present in the latest release (2.2.0 ATM)?

I tried it with both 2.0.0 and 2.2.0:

I could not reproduce the bug. The latest and 2.0.0 versions worked when I executed the following command in a terminal.

./arduino-fwuploader firmware list --format json

But it happened multiple times in the IDE. I do not know where the null pointer exception comes from.

I promise to close this issue once the IDE2 uses the latest (2.2.0) version, and I do not see the panic anymore. Unfortunately, I have no idea how to reproduce this. It happened only twice so far, from the IDE2 from debug mode.


Feel free to keep the waiting for information label.

@per1234
Copy link
Contributor

per1234 commented May 19, 2022

I have also observed this panic periodically when starting the IDE.

I was never able to find how to reproduce it consistently though, even with manually corrupting the index, so I couldn't investigate.

@kittaakos
Copy link
Author

I am closing it. I have not seen the same error with the 2.2.0 version in IDE2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for information More information must be provided before work can proceed topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

3 participants