awslabs / aws-iot-device-client

The AWS IoT Device Client provides device-side functionality for AWS IoT Services.
Apache License 2.0
129 stars 65 forks source link

AWS IoT Device Client Segmentation fault #462

Open veigaMak opened 2 months ago

veigaMak commented 2 months ago

Describe the bug

When trying to follow the Get Started with AWS IoT tutorial, I've replaced the Cloud9 instance with my own Raspberrypi. I manage to do everything until the end of the 3.3. For some reason the aws-iot-device-client service does not work. I tried to run directly the executable (sudo /sbin/aws-iot-device-client --config-file /etc/.aws-iot-device-client/aws-iot-device-client.conf) and I got a "Segmentation fault" error.

To Reproduce

Steps to reproduce the behavior:

  1. Install a clean version of RaspberryOS lite
  2. Install cmake, libssl-dev, git
  3. Install AWS iot sdk (is this necessary?)
  4. Install and configure AWS CLI
  5. Install AWS iot device client
  6. Execute the setup.sh script

Logs

2024-07-04T14:02:35.906Z [INFO]  {Config.cpp}: Successfully fetched JSON config file:
    {
      "endpoint":       "endpoint",
      "cert":   "cert",
      "key":    "key",
      "root-ca":        "root-ca",
      "thing-name":     "deviceClientThing",
      "logging":        {
        "level":        "DEBUG",
        "type": "FILE",
        "file": "/var/log/aws-iot-device-client/aws-iot-device-client.log",
        "enable-sdk-logging":   false,
        "sdk-log-level":        "TRACE",
        "sdk-log-file": "/var/log/aws-iot-device-client/sdk.log"
      },
      "jobs":   {
        "enabled":      true,
        "handler-directory": "/etc/.aws-iot-device-client/jobs"
      },
      "tunneling":      {
        "enabled":      true
      },
      "device-defender":        {
        "enabled":      true,
        "interval": 300
      },
      "fleet-provisioning":     {
        "enabled":      false,
        "template-name": "",
        "template-parameters": "",
        "csr-file": "",
        "device-key": ""
      },
      "samples": {
        "pub-sub": {
          "enabled": true,
          "publish-topic": "/topic/workshop/dc/pub",
          "publish-file": "/home/pi/workshop_dc/pubfile.txt",
          "subscribe-topic": "/topic/workshop/dc/sub",
          "subscribe-file": "/home/pi/workshop_dc/subfile.txt"
        }
      },
      "config-shadow":  {
        "enabled":      false
      },
      "sample-shadow": {
        "enabled": false,
        "shadow-name": "",
        "shadow-input-file": "",
        "shadow-output-file": ""
      }
    }

2024-07-04T14:02:35.906Z [INFO]  {FileUtils.cpp}: Successfully create directory /root/.aws-iot-device-client/sample-shadow/ with required permissions 700
2024-07-04T14:02:35.906Z [INFO]  {Config.cpp}: ~/.aws-iot-device-client/sample-shadow/default-sample-shadow-document
2024-07-04T14:02:35.906Z [INFO]  {Config.cpp}: Succesfully create default file: /root/.aws-iot-device-client/sample-shadow/default-sample-shadow-document required for storage of shadow document
2024-07-04T14:02:35.906Z [DEBUG] {Config.cpp}: Did not find a runtime configuration file, assuming Fleet Provisioning has not run for this device
2024-07-04T14:02:35.906Z [DEBUG] {Config.cpp}: Did not find a http proxy config file /root/.aws-iot-device-client/http-proxy.conf, assuming HTTP proxy is disabled on this device
2024-07-04T14:02:35.907Z [DEBUG] {EnvUtils.cpp}: Updated PATH environment variable to: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.aws-iot-device-client:/root/.aws-iot-device-client/jobs:/home/pi/workshop_dc/aws-iot-device-client:/home/pi/workshop_dc/aws-iot-device-client/jobs
2024-07-04T14:02:35.907Z [DEBUG] {LockFile.cpp}: creating lockfile
2024-07-04T14:02:35.907Z [INFO]  {Main.cpp}: Now running AWS IoT Device Client version v1.9.1-bfae937
2024-07-04T14:02:35.907Z [INFO]  {SharedCrtResourceManager.cpp}: SDK logging is disabled. Enable it with --enable-sdk-logging on the command line or logging::enable-sdk-logging in your configuration file
2024-07-04T14:02:35.907Z [DEBUG] {Retry.cpp}: Retryable function starting, it will retry until success
2024-07-04T14:02:36.022Z [INFO]  {SharedCrtResourceManager.cpp}: Establishing MQTT connection with client id deviceClientThing...
2024-07-04T14:02:36.648Z [INFO]  {SharedCrtResourceManager.cpp}: MQTT connection established with return code: 0
Segmentation fault

Additional context

Is this related to this issue?

HarshGandhi-AWS commented 1 month ago

Hello @veigaMak , thank you for reaching out to us. To answer your question, no the issue you have linked should not related since it was resolved in previous client version update.

Give us some time to reproduce the issue and find the root cause. Most likely it is an setup issue but I can share more details once I reproduce the issue and solve it.

Regards, Harsh Gandhi

rui-maksense commented 3 weeks ago

Hello @HarshGandhi-AWS.

Any news on this issue, I'm also getting this exact behaviour.

Here's some additional info on my system

Linux version 6.6.20+rpt-rpi-v8 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT Debian 1:6.6.20-1+rpt1 (2024-03-07)

Cheers