edgexfoundry / edgex-compose

EdgeX Foundry Docker Compose release compose files and tools for building EdgeX compose files
Apache License 2.0
81 stars 115 forks source link

Compose Builder sets MQTTBROKERINFO_AUTHMODE incorrectly for Device MQTT #395

Closed jrtitus closed 7 months ago

jrtitus commented 1 year ago

🐞 Bug Report

Affected Services [REQUIRED]

The issue is located in: edgex-device-mqtt

Is this a regression?

Yes, the previous version in which this bug was not present was: v2.3 - Levski

Description and Minimal Reproduction [REQUIRED]

cd compose-builder
make gen ds-mqtt mqtt-broker
docker-compose up -d

docker logs -f edgex-device-mqtt

🔥 Exception or Error


level=WARN ts=2023-07-06T13:04:01.865166013Z app=device-mqtt source=config.go:123 msg="Unable to retrieve MQTT credentials from SecretProvider at secret name 'message-bus': Error retreiving secret secretName: 'Received a '404' response from the secret store'. Retrying for 1m59.998347601s"
...
level=ERROR ts=2023-07-06T13:06:02.336340695Z app=device-mqtt source=init.go:77 msg="ProtocolDriver init failed: unable to initial the MQTT client -> Unable to get init MQTT credentials for secret name 'message-bus': Error retreiving secret secretName: 'Received a '404' response from the secret store'"

level=INFO ts=2023-07-06T13:06:02.343883194Z app=device-mqtt source=driver.go:223 msg="driver is stopping, disconnect the MQTT conn"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0xbe3eca]

goroutine 1 [running]:
github.com/edgexfoundry/device-mqtt-go/internal/driver.(*Driver).Stop(0xc0000c09c0, 0x28?)
        github.com/edgexfoundry/device-mqtt-go/internal/driver/driver.go:224 +0x4a
github.com/edgexfoundry/device-sdk-go/v3/pkg/service.(*deviceService).Stop(0xc0000e7600, 0xc0?)
        github.com/edgexfoundry/device-sdk-go/v3@v3.0.0/pkg/service/service.go:300 +0x2a
github.com/edgexfoundry/device-sdk-go/v3/pkg/service.(*deviceService).Run.func4()
        github.com/edgexfoundry/device-sdk-go/v3@v3.0.0/pkg/service/service.go:148 +0x32
github.com/edgexfoundry/device-sdk-go/v3/pkg/service.(*deviceService).Run(0xc0000e7600)
        github.com/edgexfoundry/device-sdk-go/v3@v3.0.0/pkg/service/service.go:153 +0xc05
github.com/edgexfoundry/device-sdk-go/v3/pkg/startup.Bootstrap({0xdc33ff, 0xb}, {0xee1bec, 0x5}, {0xef1b30?, 0xc0000c09c0})
        github.com/edgexfoundry/device-sdk-go/v3@v3.0.0/pkg/startup/bootstrap.go:25 +0x247
main.main()
        github.com/edgexfoundry/device-mqtt-go/cmd/main.go:22 +0x3e

🌍 Your Environment

Deployment Environment: WSL2

$ uname -a
Linux --- 5.15.90.1-microsoft-standard-WSL2 edgexfoundry/edgex-compose#1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

EdgeX Version [REQUIRED]: v3.0.0 - Minnesota

Anything else relevant?

  1. When using the spiffe/spire services, the error does not occur.
  2. Setting MQTTBROKERINFO_AUTHMODE: none also gets rid of the issue.
lenny-goodell commented 1 year ago

@jrtitus , This is an issue with compose builder, not the service. Moving issue to edgex-compose.

The quick work around is to fix set MQTTBROKERINFO_AUTHMODE to none the compose file for Device MQTT:

    environment:
      EDGEX_SECURITY_SECRET_STORE: "true"
      MQTTBROKERINFO_AUTHMODE: none
lenny-goodell commented 7 months ago

@jumpingliu , I moved this back to Core WG since it is an issue in Compose Builder, not Device MQTT

lenny-goodell commented 7 months ago

@jrtitus , this has been fixed in compose builder on both the main and napa branches.