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

s2n_init() failure on Ubuntu 22.04 #2667

Closed
disa6302 opened this issue Sep 12, 2023 · 6 comments
Closed

s2n_init() failure on Ubuntu 22.04 #2667

disa6302 opened this issue Sep 12, 2023 · 6 comments
Assignees
Labels
bug This issue is a bug. p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.

Comments

@disa6302
Copy link

Describe the bug

I am using this SDK as a dependency in another project on Ubuntu 22.04 EC2 instance. When I build with cmake, it builds fine, but when I run the application, I see this:

s2n_init() failed: 402653266 (The libcrypto major version number seen at compile-time is different from the major version number seen at run-time)
Fatal error condition occurred in /project_cpp/build/_deps/cloudwatch-src/crt/aws-crt-cpp/crt/aws-c-io/source/s2n/s2n_tls_channel_handler.c:197: 0 && "s2n_init() failed"
Exiting Application
No call stack information available
Aborted (core dumped)
ubuntu@ip-172-31-27-51:~

I install libssl-dev using apt-get. This is my cmake file:

set(CMAKE_CXX_STANDARD 17)

set(CUSTOM_MEMORY_MANAGEMENT OFF CACHE BOOL "Tell AWS SDK to not use custom memory management" FORCE)
set(ENABLE_TESTING OFF CACHE BOOL "Disable building tests for AWS SDK" FORCE)
set(BUILD_ONLY "monitoring;logs" CACHE STRING "Tell AWS SDK to only build monitoring and logs" FORCE)

FetchContent_Declare(
        cloudwatch
        GIT_REPOSITORY https://github.com/aws/aws-sdk-cpp
        GIT_TAG        1.10.9
)

FetchContent_GetProperties(cloudwatch)
if(NOT cloudwatch_POPULATED)
  FetchContent_Populate(cloudwatch)
  add_subdirectory(${cloudwatch_SOURCE_DIR} ${cloudwatch_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()

include_directories(${cloudwatch_SOURCE_DIR}/aws-cpp-sdk-core/include)
include_directories(${cloudwatch_SOURCE_DIR}/aws-cpp-sdk-monitoring/include)
include_directories(${cloudwatch_SOURCE_DIR}/aws-cpp-sdk-logs/include)

target_link_libraries(app         
        aws-cpp-sdk-core
        aws-cpp-sdk-monitoring
        aws-cpp-sdk-logs)

Expected Behavior

The app should not segfault.

Current Behavior

When running the app, it segfaults.

Reproduction Steps

https://github.com/aws-samples/amazon-kinesis-video-streams-demos/tree/master/canary/producer-cpp.

I do not have a small reproducible sample, but this is the repo. This seems to be an issue which should be common, but cannot find the required details. Let me know if you still need a small sample and I can create one.

Possible Solution

No response

Additional Information/Context

No response

AWS CPP SDK version used

1.10.9

Compiler and Version used

11.4.0

Operating System and version

Ubuntu 22.04 EC2

@disa6302 disa6302 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 12, 2023
@yasminetalby yasminetalby self-assigned this Sep 13, 2023
@yasminetalby yasminetalby added investigating This issue is being investigated and/or work is in progress to resolve the issue. p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Sep 13, 2023
@yasminetalby
Copy link
Contributor

Hello @disa6302 ,

Thank you very much for your submission. I am assuming that you are installing libssl-dev and all header files (-dev packages) for libcurl, libopenssl, libuuid, zlib following the developer guide documentation for installing the packages on Debian/Ubuntu-based systems:

sudo apt-get install libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev libpulse-dev

Could you please share the Cmake command you are running?
I was also wondering if you could provide the aws-crt-cpp version used?

I also wanted to recommend to use the latest version of the SDK as best practice (1.10.9 is quite old and there has been plenty of changes implemented in the SDK since).

There was also a similar issue submitted a while back : #2359

My first assumption here is that there must be an issue in your environment set up.

Best,

Yasmine

@yasminetalby yasminetalby added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Sep 13, 2023
@disa6302
Copy link
Author

Hello @yasminetalby ,

Thank you for your response. I have installed the packages already. The same version used to work on Ubunut 18.04, but started failing when I moved to 22.04.

Could you please share the Cmake command you are running?
I am running cmake .. and as added in my original message using this project as a depedency in FetchContent (Snippet shared in my previous message)

I was also wondering if you could provide the aws-crt-cpp version used?
Is there a way for me to find the aws-crt-cpp version used? If it is being built, it should be built as part of this SDK and I do not do anything with it.

I also wanted to recommend to use the latest version of the SDK as best practice (1.10.9 is quite old and there has been plenty of changes implemented in the SDK since).

I tried moving to the latest, but I hit a segfault. Maybe something to do the AWSInitApi and moving to newer version will be some effort. So using the existing version.

I also tried setting USE_OPENSSL to OFF and it ended up building AWS-LC, however, when I run the application I hit a coredump in free(), which does not make sense since I do not explictly invoke it at the start of the application. Looking at the stack trace, it seemed to be happening in some curl calls.

A little more context:
My application has another dependency which installs openssl. I think this SDK uses system OpenSSL when USE_OPENSSL is set to ON (default), but the other dependency builds openssl 1.1.1 and that is where the problem is. Maybe having this SDK use custom openssl depedency paths would help the issue.

@yasminetalby
Copy link
Contributor

Hello @disa6302 ,

Thank you very much for providing more context.

Could you try passing -DCMAKE_PREFIX_PATH={path to openssl where lib and include dirs are found} and let me know if this resolves your issue?

Best regards,

Yasmine

@disa6302
Copy link
Author

@yasminetalby ,

That does not seem to fix it. I am installing in ${CMAKE_CURRENT_SOURCE_DIR} where I see the bin, lib and include directories. I use -DCMAKE_PREFIX_PATH=${CMAKE_CURRENT_SOURCE_DIR} and it still shows up this error.

@disa6302
Copy link
Author

@yasminetalby ,

It seems to work. I had to point to the lib directory specifically. Thank you for your quick responses!

@github-actions
Copy link

⚠️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. p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.
Projects
None yet
Development

No branches or pull requests

2 participants