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

provide a little more information before calling std::terminate #2630

Open
willie opened this issue Apr 5, 2024 · 3 comments
Open

provide a little more information before calling std::terminate #2630

willie opened this issue Apr 5, 2024 · 3 comments
Assignees
Labels
Stale triage/unresolved Indicates an issue that can not or will not be resolved.

Comments

@willie
Copy link
Contributor

willie commented Apr 5, 2024

I've incorporated OpenTelemetry into my program and on certain execution paths, especially on Linux, I get terminate called without an active exception or similar kinds of messages.

If I take out my OpenTelemetry initialization/cleanup functions and leave the null Otel spans and logs in there, nothing crashes. I have exception handlers defined, but there are a few cases where a raw std::terminate is called from the library.

For example:

I have no idea if this is the bug or not, but it makes it harder. I would expect a library to log something if it's going to call terminate.

@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Apr 5, 2024
@esigo esigo added triage/unresolved Indicates an issue that can not or will not be resolved. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Apr 8, 2024
@willie
Copy link
Contributor Author

willie commented Apr 15, 2024

I commented out my logging initialization today and logging calls on Linux now:

  1. do nothing (expected)
  2. no longer crash with terminate

Logging calls on Mac work just fine before/after.

This is the init call I commented out:

void InitLogger() {
	// Create ostream log exporter instance
	auto exporter = std::unique_ptr<logs_sdk::LogRecordExporter>(new otlp_exporter::OtlpHttpLogRecordExporter);

        auto processor = logs_sdk::SimpleLogRecordProcessorFactory::Create(std::move(exporter));
	std::shared_ptr<logs_api::LoggerProvider> provider =
			logs_sdk::LoggerProviderFactory::Create(std::move(processor), GetResource());

	// Set the global logger provider
	logs_api::Provider::SetLoggerProvider(provider);
}

@willie
Copy link
Contributor Author

willie commented Apr 16, 2024

I have a stacktrace now for the termination call:

Stack trace (most recent call first):
#0  0x00005571f9f5bc71 in handler(int) at /myapp/src/myapp.cpp:197:29
#1  0x00005571f9f5bcfc in operator() at /myapp/src/myapp.cpp:262:10
#2  0x00005571f9f5bd11 in _FUN at /myapp/src/myapp.cpp:264:5
#3  0x00007f103420620b at /lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007f10342051e8 at /lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007f1034205958 at /lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007f1034825fe8 at /lib/x86_64-linux-gnu/libunwind.so.8
#7  0x00005571fa78da90 in google::protobuf::internal::ArenaStringPtr::Set(char const*, unsigned long, google::protobuf::Arena*) at /myapp/build/vcpkg_installed/x64-linux/include/google/protobuf/arenastring.h:413:28
#8           (inlined) in void opentelemetry::proto::common::v1::KeyValue::set_key<char const*, unsigned long>(char const*&&, unsigned long) at /myapp/vcpkg/buildtrees/opentelemetry-cpp/x64-linux-dbg/generated/third_party/opentelemetry-proto/opentelemetry/proto/common/v1/common.pb.h:1600:17
#9  0x00005571fa78f8ac in opentelemetry::v1::exporter::otlp::OtlpPopulateAttributeUtils::PopulateAttribute(opentelemetry::proto::common::v1::KeyValue*, opentelemetry::v1::nostd::string_view, std::variant<bool, int, long, unsigned int, double, char const*, opentelemetry::v1::nostd::string_view, opentelemetry::v1::nostd::span<bool const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<double const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<opentelemetry::v1::nostd::string_view const, 18446744073709551615ul>, unsigned long, opentelemetry::v1::nostd::span<unsigned long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned char const, 18446744073709551615ul> > const&) at /myapp/vcpkg/buildtrees/opentelemetry-cpp/src/v1.14.2-8c1c1d9b6b.clean/exporters/otlp/src/otlp_populate_attribute_utils.cc:251:21
#10 0x00005571fa78be0a in opentelemetry::v1::exporter::otlp::OtlpLogRecordable::SetAttribute(opentelemetry::v1::nostd::string_view, std::variant<bool, int, long, unsigned int, double, char const*, opentelemetry::v1::nostd::string_view, opentelemetry::v1::nostd::span<bool const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<double const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<opentelemetry::v1::nostd::string_view const, 18446744073709551615ul>, unsigned long, opentelemetry::v1::nostd::span<unsigned long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned char const, 18446744073709551615ul> > const&) at /myapp/vcpkg/buildtrees/opentelemetry-cpp/src/v1.14.2-8c1c1d9b6b.clean/exporters/otlp/src/otlp_log_recordable.cc:216:48
#11 0x00005571fa94de77 in opentelemetry::v1::sdk::logs::MultiRecordable::SetAttribute(opentelemetry::v1::nostd::string_view, std::variant<bool, int, long, unsigned int, double, char const*, opentelemetry::v1::nostd::string_view, opentelemetry::v1::nostd::span<bool const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<double const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<opentelemetry::v1::nostd::string_view const, 18446744073709551615ul>, unsigned long, opentelemetry::v1::nostd::span<unsigned long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned char const, 18446744073709551615ul> > const&) at /myapp/vcpkg/buildtrees/opentelemetry-cpp/src/v1.14.2-8c1c1d9b6b.clean/sdk/src/logs/multi_recordable.cc:153:38
#12 0x00005571f9f04bb8 in opentelemetry::v1::logs::LogRecord* opentelemetry::v1::logs::detail::LogRecordSetterTrait<opentelemetry::v1::nostd::span<std::pair<opentelemetry::v1::nostd::string_view, std::variant<bool, int, long, unsigned int, double, char const*, opentelemetry::v1::nostd::string_view, opentelemetry::v1::nostd::span<bool const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<double const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<opentelemetry::v1::nostd::string_view const, 18446744073709551615ul>, unsigned long, opentelemetry::v1::nostd::span<unsigned long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned char const, 18446744073709551615ul> > > const, 18446744073709551615ul> >::Set<opentelemetry::v1::nostd::span<std::pair<opentelemetry::v1::nostd::string_view, std::variant<bool, int, long, unsigned int, double, char const*, opentelemetry::v1::nostd::string_view, opentelemetry::v1::nostd::span<bool const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<double const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<opentelemetry::v1::nostd::string_view const, 18446744073709551615ul>, unsigned long, opentelemetry::v1::nostd::span<unsigned long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned char const, 18446744073709551615ul> > > const, 18446744073709551615ul>&, (int*)0>(opentelemetry::v1::logs::LogRecord*, opentelemetry::v1::nostd::span<std::pair<opentelemetry::v1::nostd::string_view, std::variant<bool, int, long, unsigned int, double, char const*, opentelemetry::v1::nostd::string_view, opentelemetry::v1::nostd::span<bool const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<double const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<opentelemetry::v1::nostd::string_view const, 18446744073709551615ul>, unsigned long, opentelemetry::v1::nostd::span<unsigned long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned char const, 18446744073709551615ul> > > const, 18446744073709551615ul>&) at /myapp/build/vcpkg_installed/x64-linux/include/opentelemetry/logs/logger_type_traits.h:175:31
#13 0x00005571f9efa19a in void opentelemetry::v1::logs::Logger::EmitLogRecord<opentelemetry::v1::logs::Severity, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, opentelemetry::v1::trace::TraceId const&, opentelemetry::v1::trace::SpanId const&, opentelemetry::v1::trace::TraceFlags const&, opentelemetry::v1::nostd::span<std::pair<opentelemetry::v1::nostd::string_view, std::variant<bool, int, long, unsigned int, double, char const*, opentelemetry::v1::nostd::string_view, opentelemetry::v1::nostd::span<bool const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<double const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<opentelemetry::v1::nostd::string_view const, 18446744073709551615ul>, unsigned long, opentelemetry::v1::nostd::span<unsigned long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned char const, 18446744073709551615ul> > > const, 18446744073709551615ul>&>(opentelemetry::v1::nostd::unique_ptr<opentelemetry::v1::logs::LogRecord>&&, opentelemetry::v1::logs::Severity&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, opentelemetry::v1::trace::TraceId const&, opentelemetry::v1::trace::SpanId const&, opentelemetry::v1::trace::TraceFlags const&, opentelemetry::v1::nostd::span<std::pair<opentelemetry::v1::nostd::string_view, std::variant<bool, int, long, unsigned int, double, char const*, opentelemetry::v1::nostd::string_view, opentelemetry::v1::nostd::span<bool const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<double const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<opentelemetry::v1::nostd::string_view const, 18446744073709551615ul>, unsigned long, opentelemetry::v1::nostd::span<unsigned long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned char const, 18446744073709551615ul> > > const, 18446744073709551615ul>&) at /myapp/build/vcpkg_installed/x64-linux/include/opentelemetry/logs/logger.h:76:92
#14 0x00005571f9eedef6 in void opentelemetry::v1::logs::Logger::EmitLogRecord<opentelemetry::v1::logs::Severity, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, opentelemetry::v1::trace::TraceId const&, opentelemetry::v1::trace::SpanId const&, opentelemetry::v1::trace::TraceFlags const&, opentelemetry::v1::nostd::span<std::pair<opentelemetry::v1::nostd::string_view, std::variant<bool, int, long, unsigned int, double, char const*, opentelemetry::v1::nostd::string_view, opentelemetry::v1::nostd::span<bool const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<double const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<opentelemetry::v1::nostd::string_view const, 18446744073709551615ul>, unsigned long, opentelemetry::v1::nostd::span<unsigned long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned char const, 18446744073709551615ul> > > const, 18446744073709551615ul>&>(opentelemetry::v1::logs::Severity&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, opentelemetry::v1::trace::TraceId const&, opentelemetry::v1::trace::SpanId const&, opentelemetry::v1::trace::TraceFlags const&, opentelemetry::v1::nostd::span<std::pair<opentelemetry::v1::nostd::string_view, std::variant<bool, int, long, unsigned int, double, char const*, opentelemetry::v1::nostd::string_view, opentelemetry::v1::nostd::span<bool const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<double const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<opentelemetry::v1::nostd::string_view const, 18446744073709551615ul>, unsigned long, opentelemetry::v1::nostd::span<unsigned long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned char const, 18446744073709551615ul> > > const, 18446744073709551615ul>&) at /myapp/build/vcpkg_installed/x64-linux/include/opentelemetry/logs/logger.h:108:18
#15 0x00005571f9ee11de in void opentelemetry::v1::logs::Logger::Error<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, opentelemetry::v1::trace::TraceId const&, opentelemetry::v1::trace::SpanId const&, opentelemetry::v1::trace::TraceFlags const&, opentelemetry::v1::nostd::span<std::pair<opentelemetry::v1::nostd::string_view, std::variant<bool, int, long, unsigned int, double, char const*, opentelemetry::v1::nostd::string_view, opentelemetry::v1::nostd::span<bool const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<double const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<opentelemetry::v1::nostd::string_view const, 18446744073709551615ul>, unsigned long, opentelemetry::v1::nostd::span<unsigned long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned char const, 18446744073709551615ul> > > const, 18446744073709551615ul>&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, opentelemetry::v1::trace::TraceId const&, opentelemetry::v1::trace::SpanId const&, opentelemetry::v1::trace::TraceFlags const&, opentelemetry::v1::nostd::span<std::pair<opentelemetry::v1::nostd::string_view, std::variant<bool, int, long, unsigned int, double, char const*, opentelemetry::v1::nostd::string_view, opentelemetry::v1::nostd::span<bool const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned int const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<double const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<opentelemetry::v1::nostd::string_view const, 18446744073709551615ul>, unsigned long, opentelemetry::v1::nostd::span<unsigned long const, 18446744073709551615ul>, opentelemetry::v1::nostd::span<unsigned char const, 18446744073709551615ul> > > const, 18446744073709551615ul>&) at /myapp/build/vcpkg_installed/x64-linux/include/opentelemetry/logs/logger.h:228:24

Copy link

This issue was marked as stale due to lack of activity.

@github-actions github-actions bot added the Stale label Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale triage/unresolved Indicates an issue that can not or will not be resolved.
Projects
None yet
Development

No branches or pull requests

3 participants