edgexfoundry / device-sdk-go

Owner: Device WG

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Segmentation violation when running EdgeX sample Device Service

carlosd-29 opened this issue · comments

Question

Affected Services [REQUIRED]

The issue is located in: Device Service

Is this a regression?

Yes, the previous version in which this bug was not present was: 2.1

Description and Minimal Reproduction [REQUIRED]

I am trying to build a custom device service and I've noticed a couple of issues. One is that both device and profile configurations are using the same file (random-generator-device.yaml). Another is that the configuration.yaml is missing some components. For example RequestTimeout was missing and producing:

level=INFO ts=2023-06-12T19:55:18.442002546Z app=device-simple source=config.go:640 msg="Loading configuration file from res/configuration.yaml"
level=INFO ts=2023-06-12T19:55:18.442294135Z app=device-simple source=config.go:226 msg="Private configuration loaded from file with 0 overrides applied"
level=ERROR ts=2023-06-12T19:55:18.444259518Z app=device-simple source=httpserver.go:101 msg="unable to parse RequestTimeout value of  to a duration: time: invalid duration \"\""
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0xbfdb86]

goroutine 1 [running]:
github.com/edgexfoundry/device-sdk-go/v3/pkg/startup.Bootstrap({0xde1162, 0xd}, {0xefef78, 0x5}, {0xf0f930?, 0xc0003f1f80})
        github.com/edgexfoundry/device-sdk-go/v3@v3.0.0/pkg/startup/bootstrap.go:27 +0x2e6
main.main()
        github.com/edgexfoundry/device-simple/cmd/device-simple/main.go:23 +0x4e

I added that parameter and now I'm getting:

level=INFO ts=2023-06-12T20:04:03.456084501Z app=device-simple source=config.go:640 msg="Loading configuration file from res/configuration.yaml"
level=INFO ts=2023-06-12T20:04:03.456219897Z app=device-simple source=config.go:226 msg="Private configuration loaded from file with 0 overrides applied"
level=INFO ts=2023-06-12T20:04:03.457639516Z app=device-simple source=httpserver.go:133 msg="Web server starting (10.34.125.34:59999)"
level=ERROR ts=2023-06-12T20:04:03.457679445Z app=device-simple source=messaging.go:45 msg="MessageBus configuration not set or missing from service's GetBootstrap() implementation"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0xbfdb86]

goroutine 1 [running]:
github.com/edgexfoundry/device-sdk-go/v3/pkg/startup.Bootstrap({0xde1162, 0xd}, {0xefef78, 0x5}, {0xf0f930?, 0xc0003f1f80})
        github.com/edgexfoundry/device-sdk-go/v3@v3.0.0/pkg/startup/bootstrap.go:27 +0x2e6
main.main()
        github.com/edgexfoundry/device-simple/cmd/device-simple/main.go:23 +0x4e

🔥 Exception or Error





🌍 Your Environment

Deployment Environment:
Ubuntu 20.04

EdgeX Version [REQUIRED]:
3.0

Anything else relevant?

One is that both device and profile configurations are using the same file (random-generator-device.yaml)

@carlosd-29 , yes, the edgexfoundry/edgex-docs#1131 issue has already been submitted for that . See my comments in the issue to where the device file should be linked.

@carlosd-29 , I have also created a docs issue for the section you are using to add the required flags
edgexfoundry/edgex-docs#1132