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

Greengrass IPC Publisher Sample Code Segfaults with reduced sleep time #327

Closed
2 tasks done
gearoid-moore opened this issue Sep 29, 2021 · 7 comments
Closed
2 tasks done
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@gearoid-moore
Copy link

gearoid-moore commented Sep 29, 2021

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Known Issue

  • I'm using ATS data type endpoint: the endpoint should look like <prefix>-ats.iot.<region>.amazonaws.com

Describe the bug
Running the Greengrass IPC Publisher for C++ with a reduced sleep time (from 5 seconds to 100 milliseconds) causes a segfault in the program.

Full code below, adapted from: https://docs.aws.amazon.com/greengrass/v2/developerguide/ipc-publish-subscribe.html

#include <iostream>


#include <aws/crt/Api.h>
#include <aws/greengrass/GreengrassCoreIpcClient.h>

using namespace Aws::Crt;

using namespace Aws::Greengrass;


class IpcClientLifecycleHandler : public ConnectionLifecycleHandler {

    void OnConnectCallback() override {
        std::cout << "OnConnectCallback" << std::endl;
    }

    void OnDisconnectCallback(RpcError error) override {

        std::cout << "OnDisconnectCallback: " << error.StatusToString() << std::endl;
        exit(-1);

    }

    bool OnErrorCallback(RpcError error) override {
        std::cout << "OnErrorCallback: " << error.StatusToString() << std::endl;

        return true;

    }

};

int main() {
    String message("Hello from the pub/sub publisher (C++).");
    String topic("test/topic/cpp");
    int timeout = 10;
    
    ApiHandle apiHandle(g_allocator);
    Io::EventLoopGroup eventLoopGroup(1);
    Io::DefaultHostResolver socketResolver(eventLoopGroup, 64, 30);
    Io::ClientBootstrap bootstrap(eventLoopGroup, socketResolver);
    IpcClientLifecycleHandler ipcLifecycleHandler;
    GreengrassCoreIpcClient ipcClient(bootstrap);
    auto connectionStatus = ipcClient.Connect(ipcLifecycleHandler).get();
    if (!connectionStatus) {
        std::cerr << "Failed to establish IPC connection: " << connectionStatus.StatusToString() << std::endl;
        exit(-1);
    }

    while (true) {
        PublishToTopicRequest request;
        Vector<uint8_t> messageData({message.begin(), message.end()});
        BinaryMessage binaryMessage;
        binaryMessage.SetMessage(messageData);
        PublishMessage publishMessage;
        publishMessage.SetBinaryMessage(binaryMessage);
        request.SetTopic(topic);
        request.SetPublishMessage(publishMessage);

        PublishToTopicOperation operation = ipcClient.NewPublishToTopic();
        auto activate = operation.Activate(request, nullptr);
        activate.wait();

        auto responseFuture = operation.GetResult();
        if (responseFuture.wait_for(std::chrono::seconds(timeout)) == std::future_status::timeout) {
            std::cerr << "Operation timed out while waiting for response from Greengrass Core." << std::endl;
            exit(-1);
        }

        auto response = responseFuture.get();
        if (response) {
            std::cout << "Successfully published to topic: " << topic << std::endl;

        } else {
            // An error occurred.
            std::cout << "Failed to publish to topic: " << topic << std::endl;
            auto errorType = response.GetResultType();
            if (errorType == OPERATION_ERROR) {
                auto *error = response.GetOperationError();
                std::cout << "Operation error: " << error->GetMessage().value() << std::endl;
            } else {
                std::cout << "RPC error: " << response.GetRpcError() << std::endl;
            }
            exit(-1);
        }

        std::this_thread::sleep_for(std::chrono::milliseconds(100));
    }

    return 0;
}

Platform/OS/Device
Distributor ID: Ubuntu
Description: Ubuntu 18.04.5 LTS
Release: 18.04
Codename: bionic

Hardware: Nvidia Jetson Xavier

SDK version number
Unsure how to get this - believe I am using the latest version.

To Reproduce (observed behavior)
Follow the steps outlined in the Greengrass Guide for creating + deploying a CPP IPC Publisher, with the code slightly edited as above. (https://docs.aws.amazon.com/greengrass/v2/developerguide/ipc-publish-subscribe.html)

Expected behavior
I would expect the publisher to continue publishing messages indefinetely until the program is stopped.

Logs/output
Segfault log below.

2021-09-29T17:10:55.957Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:56.059Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:56.160Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:56.261Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:56.362Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:56.463Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:56.563Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:56.664Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:56.765Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:56.867Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:56.968Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:57.069Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:57.169Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:57.271Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:57.373Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:57.474Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:57.575Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:57.675Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:57.776Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:57.877Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:57.978Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:58.079Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:58.180Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:58.281Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:58.382Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:58.484Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:58.586Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:58.687Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Successfully published to topic: test/topic/cpp. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:58.788Z [WARN] (Copier) com.example.PubSubPublisherCpp: stderr. malloc(): memory corruption. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:58.810Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:58.810Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. Thread 1 "greengrassv2_pu" received signal SIGABRT, Aborted.. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:58.810Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:58.810Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:58.810Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. #1  0x0000007fb7bc48d4 in __GI_abort () at abort.c:79. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:58.810Z [WARN] (Copier) com.example.PubSubPublisherCpp: stderr. 51	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:58.837Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. #2  0x0000007fb7bfd68c in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7fb7cbe6f8 "%s\n") at ../sysdeps/posix/libc_fatal.c:181. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:58.837Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. #3  0x0000007fb7c03a04 in malloc_printerr (str=str@entry=0x7fb7cba7a8 "malloc(): memory corruption") at malloc.c:5342. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:58.838Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. #4  0x0000007fb7c06b0c in _int_malloc (av=av@entry=0x7fb7ce4a70 <main_arena>, bytes=bytes@entry=64) at malloc.c:3748. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:58.840Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. #5  0x0000007fb7c083a4 in __GI___libc_malloc (bytes=64) at malloc.c:3075. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:10:58.840Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. #6  0x0000007fb7e5852c in operator new(unsigned long) () from /usr/lib/aarch64-linux-gnu/libstdc++.so.6. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:11:00.715Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. #7  0x000000555563d000 in __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<std::__future_base::_Deferred_state<std::thread::_Invoker<std::tuple<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > >, Aws::Greengrass::PublishToTopicResult>, std::allocator<std::__future_base::_Deferred_state<std::thread::_Invoker<std::tuple<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > >, Aws::Greengrass::PublishToTopicResult> >, (__gnu_cxx::_Lock_policy)2> >::allocate (this=<optimized out>, __n=1) at /usr/include/c++/7/ext/new_allocator.h:111. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:11:00.716Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. #8  std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<std::__future_base::_Deferred_state<std::thread::_Invoker<std::tuple<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > >, Aws::Greengrass::PublishToTopicResult>, std::allocator<std::__future_base::_Deferred_state<std::thread::_Invoker<std::tuple<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > >, Aws::Greengrass::PublishToTopicResult> >, (__gnu_cxx::_Lock_policy)2> > >::allocate (__a=..., __n=1) at /usr/include/c++/7/bits/alloc_traits.h:436. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:11:00.716Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. #9  std::__allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<std::__future_base::_Deferred_state<std::thread::_Invoker<std::tuple<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > >, Aws::Greengrass::PublishToTopicResult>, std::allocator<std::__future_base::_Deferred_state<std::thread::_Invoker<std::tuple<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > >, Aws::Greengrass::PublishToTopicResult> >, (__gnu_cxx::_Lock_policy)2> > > (__a=...) at /usr/include/c++/7/bits/allocated_ptr.h:104. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:11:00.716Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. #10 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<std::__future_base::_Deferred_state<std::thread::_Invoker<std::tuple<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > >, Aws::Greengrass::PublishToTopicResult>, std::allocator<std::__future_base::_Deferred_state<std::thread::_Invoker<std::tuple<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > >, Aws::Greengrass::PublishToTopicResult> >, std::thread::_Invoker<std::tuple<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > > > (__a=..., this=<optimized out>) at /usr/include/c++/7/bits/shared_ptr_base.h:635. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:11:00.716Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. #11 std::__shared_ptr<std::__future_base::_Deferred_state<std::thread::_Invoker<std::tuple<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > >, Aws::Greengrass::PublishToTopicResult>, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<std::__future_base::_Deferred_state<std::thread::_Invoker<std::tuple<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > >, Aws::Greengrass::PublishToTopicResult> >, std::thread::_Invoker<std::tuple<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > > > (__a=..., this=<optimized out>, __tag=...) at /usr/include/c++/7/bits/shared_ptr_base.h:1295. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:11:00.717Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. #12 std::shared_ptr<std::__future_base::_Deferred_state<std::thread::_Invoker<std::tuple<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > >, Aws::Greengrass::PublishToTopicResult> >::shared_ptr<std::allocator<std::__future_base::_Deferred_state<std::thread::_Invoker<std::tuple<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > >, Aws::Greengrass::PublishToTopicResult> >, std::thread::_Invoker<std::tuple<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > > > (__a=..., this=<optimized out>, __tag=...) at /usr/include/c++/7/bits/shared_ptr.h:344. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:11:00.718Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. #13 std::allocate_shared<std::__future_base::_Deferred_state<std::thread::_Invoker<std::tuple<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > >, Aws::Greengrass::PublishToTopicResult>, std::allocator<std::__future_base::_Deferred_state<std::thread::_Invoker<std::tuple<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > >, Aws::Greengrass::PublishToTopicResult> >, std::thread::_Invoker<std::tuple<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > > > (__a=...) at /usr/include/c++/7/bits/shared_ptr.h:691. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:11:00.718Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. #14 std::make_shared<std::__future_base::_Deferred_state<std::thread::_Invoker<std::tuple<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > >, Aws::Greengrass::PublishToTopicResult>, std::thread::_Invoker<std::tuple<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > > > () at /usr/include/c++/7/bits/shared_ptr.h:707. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:11:00.718Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. #15 std::__future_base::_S_make_deferred_state<std::thread::_Invoker<std::tuple<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > > > (__fn=...) at /usr/include/c++/7/future:1696. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:11:00.718Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. #16 std::async<Aws::Greengrass::PublishToTopicOperation::GetResult()::<lambda()> > (__policy=std::launch::deferred, __fn=...) at /usr/include/c++/7/future:1735. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:11:00.718Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. #17 Aws::Greengrass::PublishToTopicOperation::GetResult (this=0x7fffffef90) at /home/myusername/gearoid_workspace/cv_app/sdk-cpp-workspace/aws-iot-device-sdk-cpp-v2/greengrass_ipc/source/GreengrassCoreIpcModel.cpp:5905. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:11:00.719Z [INFO] (Copier) com.example.PubSubPublisherCpp: stdout. #18 0x00000055556172bc in main () at /home/myusername/ipc_basic_sample/provided_sample.cpp:65. {scriptName=services.com.example.PubSubPublisherCpp.lifecycle.Run, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}
2021-09-29T17:11:00.783Z [INFO] (Copier) com.example.PubSubPublisherCpp: Run script exited. {exitCode=0, serviceName=com.example.PubSubPublisherCpp, currentState=RUNNING}

Additional context
Add any other context about the problem here.

@gearoid-moore gearoid-moore added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 29, 2021
@chris1287
Copy link

I have the same issue.
@Scriobhneoir how do you get the backtrace directly printed in the greengrass log?

@gearoid-moore
Copy link
Author

@chris1287 I used gdb in the Recipe "Run" command:

{ "Run": "gdb -q --batch -ex \"run\" -ex \"bt\" {artifacts:path}/greengrassv2_pubsub_cpp" }

@bretambrose
Copy link
Contributor

How quickly are you getting the crash? My initial repro attempt has been running about 40 minutes without issue. Any special compilation flags?

@gearoid-moore
Copy link
Author

I get the crash within minutes. The shorter the interval between publish calls, the faster the crash happens. With an interval of 100ms between calls the crash happens within 5 minutes.

No special compilation flags - I built the "aws-iot-device-sdk-cpp-v2-build" with the "Debug" option.

@bretambrose
Copy link
Contributor

I modified the sample to use multiple publish threads and almost no sleep time and am now seemingly able to repro it very quickly. I'm hoping debug + asan will help us zero in on the offending memory trasher(s) quickly and will continue to update this as I find out more.

@bretambrose
Copy link
Contributor

This should be fixed as a part of the v1.14.6 release.

@github-actions
Copy link

github-actions bot commented Nov 2, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

3 participants