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

Segmentation fault when initialize aws iot device client binary and also cannot compile the test binary #428

Closed
JosepTeruel opened this issue Oct 4, 2023 · 9 comments
Labels
bug Something isn't working

Comments

@JosepTeruel
Copy link

Hello, Actually i am trying to initialize the aws-iot-device-client binary but when I execute always appear error messages and a segmentation fault (core dumped). Also trying to fix this error I try to run the test binary but when I try to compile appears compilation errors. I will upload the screenshots of the problems

To Reproduce

Steps to reproduce the behavior:

Building

  1. git clone https://github.com/awslabs/aws-iot-device-client
  2. cd aws-iot-device-client
  3. mkdir build
  4. cd build
  5. cmake ../
  6. cmake --build . --target aws-iot-device-client
  7. ./aws-iot-device-client --config-file home/cellect/dc-configs/config.json

To see the error in the test section we type the following command
8. cmake --build . --target test-aws-iot-device-client

Expected behavior

I expect to have the aws iot device client working as usual.

Actual behavior

After execute the step 7 appears some errors and a segmentation fault (core dumped)
Logs

  • Config.json file
    configFile

  • Executing aws-iot-device-client binary with the config.json and getting error message with Segmentation Fault (core dumped)
    aws-iot-device-complete

  • Executing aws-iot-device-client alone and getting error message and Segmentation Fault (core dumped)
    aws-iot-device-client-alone

  • Compiling the test cmake and getting errors
    testErrorMessage

Environment (please complete the following information):

  • OS: [Ubuntu]
  • Version [22.04.2 LTS]
  • Architecture: [x86-64]
  • Device Client commit: [Latest version]

Thanks in advance,
Josep

@JosepTeruel JosepTeruel added the bug Something isn't working label Oct 4, 2023
@HarshGandhi-AWS
Copy link
Contributor

Hello @JosepTeruel , thank you for reaching out to us. From the logs are data you have shared it is not clear what the issue can be. I will try to reproduce the same to identify and resolve the issue.

@HarshGandhi-AWS
Copy link
Contributor

Hey @JosepTeruel , I see that you do not have endpoint value in your config? Did you miss adding it or did you remove it before sharing the logs with us?

Also can you tell us the OS name and its version you are using on your device?

@HarshGandhi-AWS
Copy link
Contributor

I have tested the client on Ubuntu 18 on x86 device, it works fine. It is possible that this is a OS or architecture specific issue.

@JosepTeruel
Copy link
Author

Hello @HarshGandhi-AWS,

Thanks for your reply, I removed the endpoint value before sharing the logs. Actually, the OS is the Ubuntu 22.04.2 x86.

@HarshGandhi-AWS
Copy link
Contributor

Hey @JosepTeruel , from the logs and other information you have shared with us, it looks like there are two issues you are facing using device client.

  1. Device Client is failing to build the test binary to run the unit tests.
  2. Device Client is failing to run and is stopping with a segmentation fault.

For the first one, I was able to root cause the issue. The issue is in the google-test library we use for unit testing. Google-test is treating warning messages as fatal errors because of which the build is failing. This issue is resolved in the newer version of google-test, we will try to update the version to resolve this issue. google/googletest#3024

For the second one, I was not able to reproduce the issue. I tested device client on Ubuntu 22 and it works fine for me. Here are the logs for your reference.

ubuntu@ip-xxx:~/del/aws-iot-device-client/build$ ./aws-iot-device-client --config-file /home/ubuntu/cert/customer-config-prod.conf 
2023-10-13T18:50:00.766Z [WARN]  {FileUtils.cpp}: Permissions to given file/dir path '/home/ubuntu/cert/' is not set to recommended value... {Permissions: {desired: 745, actual: 700}}
2023-10-13T18:50:00.766Z [INFO]  {Config.cpp}: Successfully fetched JSON config file: {
      "endpoint":       "xxx-ats.iot.us-east-2.amazonaws.com",
      "cert":   "/home/ubuntu/cert/cert.cert",
      "key":    "/home/ubuntu/cert/private.pem",
      "root-ca":        "/home/ubuntu/cert/AmazonRootCA1.pem",
  "thing-name": "clionthing",
  "logging": {
    "enable-sdk-logging": false,
    "level": "DEBUG",
    "type": "STDOUT",
    "file": ""
  },
  "jobs": {
    "enabled": false,
    "handler-directory": ""
  },
  "tunneling": {
    "enabled":true
  },
  "device-defender": {
    "enabled": false,
    "interval": 300
  },
  "fleet-provisioning": {
    "enabled": false,
    "template-name": "",
    "template-parameters": "",
    "csr-file": "",
    "device-key": ""
  },
  "config-shadow": {
    "enabled": false
  },
  "sample-shadow": {
    "enabled": false,
    "shadow-name": "",
    "shadow-input-file": "",
    "shadow-output-file": ""
  }
}

2023-10-13T18:50:00.766Z [INFO]  {FileUtils.cpp}: Successfully create directory /home/ubuntu/.aws-iot-device-client/sample-shadow/ with required permissions 700
2023-10-13T18:50:00.766Z [INFO]  {Config.cpp}: ~/.aws-iot-device-client/sample-shadow/default-sample-shadow-document
2023-10-13T18:50:00.766Z [INFO]  {Config.cpp}: Succesfully create default file: /home/ubuntu/.aws-iot-device-client/sample-shadow/default-sample-shadow-document required for storage of shadow document
2023-10-13T18:50:00.766Z [DEBUG] {Config.cpp}: Did not find a runtime configuration file, assuming Fleet Provisioning has not run for this device
2023-10-13T18:50:00.766Z [DEBUG] {Config.cpp}: Did not find a http proxy config file /home/ubuntu/.aws-iot-device-client/http-proxy.conf, assuming HTTP proxy is disabled on this device
2023-10-13T18:50:00.767Z [DEBUG] {EnvUtils.cpp}: Updated PATH environment variable to: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/ubuntu/.aws-iot-device-client:/home/ubuntu/.aws-iot-device-client/jobs:/home/ubuntu/del/aws-iot-device-client/build:/home/ubuntu/del/aws-iot-device-client/build/jobs
2023-10-13T18:50:00.767Z [DEBUG] {LockFile.cpp}: creating lockfile
2023-10-13T18:50:00.767Z [INFO]  {Main.cpp}: Now running AWS IoT Device Client version v1.8.33-af69d33
2023-10-13T18:50:00.769Z [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
2023-10-13T18:50:00.769Z [DEBUG] {Retry.cpp}: Retryable function starting, it will retry until success
2023-10-13T18:50:00.774Z [INFO]  {SharedCrtResourceManager.cpp}: Establishing MQTT connection with client id clionthing...
2023-10-13T18:50:00.901Z [INFO]  {SharedCrtResourceManager.cpp}: MQTT connection established with return code: 0
2023-10-13T18:50:00.901Z [INFO]  {SharedCrtResourceManager.cpp}: Shared MQTT connection is ready!
2023-10-13T18:50:00.901Z [INFO]  {Main.cpp}: Provisioning with Secure Elements is disabled
2023-10-13T18:50:00.901Z [INFO]  {Main.cpp}: Config shadow is disabled
2023-10-13T18:50:00.901Z [INFO]  {Main.cpp}: Jobs is disabled
2023-10-13T18:50:00.901Z [INFO]  {Main.cpp}: Secure Tunneling is enabled
2023-10-13T18:50:00.901Z [INFO]  {Main.cpp}: Device Defender is disabled
2023-10-13T18:50:00.901Z [INFO]  {Main.cpp}: Sample shadow is disabled
2023-10-13T18:50:00.901Z [INFO]  {Main.cpp}: Pub Sub is disabled
2023-10-13T18:50:00.901Z [INFO]  {Main.cpp}: Sensor Publish is disabled
2023-10-13T18:50:00.901Z [INFO]  {SharedCrtResourceManager.cpp}: Starting Device Client features.
2023-10-13T18:50:00.901Z [DEBUG] {FeatureRegistry.cpp}: Attempting to start Secure Tunneling
2023-10-13T18:50:00.901Z [INFO]  {SecureTunnelingFeature.cpp}: Running Secure Tunneling!
2023-10-13T18:50:00.901Z [INFO]  {Main.cpp}: Client base has been notified that Secure Tunneling has started
2023-10-13T18:50:00.932Z [DEBUG] {SecureTunnelingFeature.cpp}: Subscribed to tunnel notification topic
^C2023-10-13T18:50:04.578Z [INFO]  {Main.cpp}: Received signal: (2)
2023-10-13T18:50:04.578Z [DEBUG] {Main.cpp}: Inside of shutdown()
2023-10-13T18:50:04.578Z [DEBUG] {Main.cpp}: Calling stop all
2023-10-13T18:50:04.578Z [DEBUG] {FeatureRegistry.cpp}: Attempting to stop Secure Tunneling
2023-10-13T18:50:04.578Z [DEBUG] {SecureTunnelingFeature.cpp}: SecureTunnelingFeature::stop
2023-10-13T18:50:04.578Z [INFO]  {Main.cpp}: Secure Tunneling has stopped
2023-10-13T18:50:04.578Z [INFO]  {Main.cpp}: All features have stopped
2023-10-13T18:50:04.578Z [DEBUG] {SharedCrtResourceManager.cpp}: Attempting to disconnect MQTT connection
2023-10-13T18:50:04.579Z [INFO]  {SharedCrtResourceManager.cpp}: MQTT Connection is now disconnected
ubuntu@ip-xxx:~/del/aws-iot-device-client/build$ 

@HarshGandhi-AWS
Copy link
Contributor

Hello @JosepTeruel , I am still not able to reproduce the issue where you are getting segmentation fault. Can you try updating the device client version and using it? Also please use root permissions to start the client to see if it is not failing because of some permission issues.

@kdaviscellect
Copy link

kdaviscellect commented Oct 16, 2023 via email

@JosepTeruel
Copy link
Author

Here is an example:

2023-10-16T09:22:56.623Z [WARN] {FileUtils.cpp}: Permissions to given file/dir path 'configs/config.json' is not set to recommended value... {Permissions: {desired: 640, actual: 644}}

However your documentation says to do the following:
chmod 644 ~/dc-configs/dc-testconn-config.json

@HarshGandhi-AWS
Copy link
Contributor

I think you were following the documentation from the workshop @kdaviscellect shared earlier. I can work with the documentation team to update the permissions written on the workshop page. Device Client repo Readme is upto date and you can refer it for everything.
https://github.com/awslabs/aws-iot-device-client/blob/main/docs/PERMISSIONS.md

I will close this ticket and cut another one with the documentation team to update the workshop.

Thank you,
Harsh Gandhi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants