# OTA binary coredump

**URL:** https://hub.mender.io/t/ota-binary-coredump/7737
**Category:** General Discussions
**Created:** [April 17, 2025, 11:42am UTC](https://hub.mender.io/t/ota-binary-coredump/7737 "2025-04-17T11:42:21Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![PrimeQH](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/primeqh/32/2120_2.png) [@PrimeQH](https://hub.mender.io/u/PrimeQH)
#### Post date: [April 17, 2025, 11:42am UTC](https://hub.mender.io/t/ota-binary-coredump/7737/1 "2025-04-17T11:42:21Z")

</div>

ubuntu@ubuntu:~/ota/datalink/ota-primary$ sudo gdb bin/ota-primary core.323786  
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04.2) 12.1  
Copyright (C) 2022 Free Software Foundation, Inc.  
License GPLv3+: GNU GPL version 3 or later [http://gnu.org/licenses/gpl.html](http://gnu.org/licenses/gpl.html)  
This is free software: you are free to change and redistribute it.  
There is NO WARRANTY, to the extent permitted by law.  
Type “show copying” and “show warranty” for details.  
This GDB was configured as “x86\_64-linux-gnu”.  
Type “show configuration” for configuration details.  
For bug reporting instructions, please see:  
[https://www.gnu.org/software/gdb/bugs/](https://www.gnu.org/software/gdb/bugs/).  
Find the GDB manual and other documentation resources online at:  
[http://www.gnu.org/software/gdb/documentation/](http://www.gnu.org/software/gdb/documentation/).

For help, type “help”.  
Type “apropos word” to search for commands related to “word”…  
Reading symbols from bin/ota-primary…  
[New LWP 323786]  
[Thread debugging using libthread\_db enabled]  
Using host libthread\_db library “/lib/x86\_64-linux-gnu/libthread\_db.so.1”.  
Core was generated by `/home/ubuntu/ota/datalink/ota-primary/bin/ota-primary -c /home/ubuntu/ota/datal’.  
Program terminated with signal SIGSEGV, Segmentation fault.  
#0 0x000055ddeed5b682 in boost::shared\_ptrboost::log::v2s\_mt\_posix::core::operator-\> (this=0x0) at /home/ubuntu/code/ota-test/ota-third-party/x86\_64\_output/include/boost/smart\_ptr/shared\_ptr.hpp:784  
784 /home/ubuntu/code/ota-test/ota-third-party/x86\_64\_output/include/boost/smart\_ptr/shared\_ptr.hpp: No such file or directory.  
(gdb) bt  
#0 0x000055ddeed5b682 in boost::shared\_ptrboost::log::v2s\_mt\_posix::core::operator-\> (this=0x0) at /home/ubuntu/code/ota-test/ota-third-party/x86\_64\_output/include/boost/smart\_ptr/shared\_ptr.hpp:784  
#1 0x000055ddeed5d567 in boost::log::v2s\_mt\_posix::sources::basic\_composite\_logger\<char, boost::log::v2s\_mt\_posix::sources::severity\_loggerota::common::log::LogLevel, boost::log::v2s\_mt\_posix::sources::single\_thread\_model, boost::log::v2s\_mt\_posix::sources::features\<boost::log::v2s\_mt\_posix::sources::severityota::common::log::LogLevel \> \>::open\_record\<boost::parameter::aux::tagged\_argument\_list\_of\_1\<boost::parameter::aux::tagged\_argument\<boost::log::v2s\_mt\_posix::keywords::tag::severity, ota::common::log::LogLevel\> \> \> (this=0x0, args=…) at /home/ubuntu/code/ota-test/ota-third-party/x86\_64\_output/include/boost/log/sources/basic\_logger.hpp:575  
#2 0x000055ddeed56f57 in ota::common::log::Logger::Log\_ (this=0x55ddef17be80 ota::common::log::global\_logger\_, level=ota::common::log::LogLevel::Debug, message=“Stream::DoCancel()”)  
at /mnt/hgfs/new-code/br\_datalink/ota-primary/src/common/log/platform/boost/boost\_log.cpp:159  
#3 0x000055ddeea3bd5c in ota::common::log::Logger::Log (this=0x55ddef17be80 ota::common::log::global\_logger\_, level=ota::common::log::LogLevel::Debug, message=“Stream::DoCancel()”)  
at /mnt/hgfs/new-code/br\_datalink/ota-primary/src/common/log.hpp:134  
#4 0x000055ddeed58025 in ota::common::log::Debug (message=“Stream::DoCancel()”) at /mnt/hgfs/new-code/br\_datalink/ota-primary/src/common/log/platform/boost/boost\_log.cpp:308  
#5 0x000055ddee8878e6 in ota::http::Stream::DoCancel (this=0x55de0fda3f50) at /mnt/hgfs/new-code/br\_datalink/ota-primary/src/common/http/platform/beast/http.cpp:1295  
#6 0x000055ddee88722e in ota::http::Stream::~Stream (this=0x55de0fda3f50, \_\_in\_chrg=) at /mnt/hgfs/new-code/br\_datalink/ota-primary/src/common/http/platform/beast/http.cpp:1249  
#7 0x000055ddeeaa6e4e in std::\_Sp\_counted\_ptr\<ota::http::Stream\*, (\_\_gnu\_cxx::\_Lock\_policy)2\>::\_M\_dispose (this=0x55de0fdc65d0) at /usr/include/c++/11/bits/shared\_ptr\_base.h:348  
#8 0x000055ddee75f5eb in std::\_Sp\_counted\_base\<(\_\_gnu\_cxx::\_Lock\_policy)2\>::\_M\_release (this=0x55de0fdc65d0) at /usr/include/c++/11/bits/shared\_ptr\_base.h:168  
#9 0x000055ddee75e819 in std::\_\_shared\_count\<(\_\_gnu\_cxx::\_Lock\_policy)2\>::~\_\_shared\_count (this=0x7fffcd626610, \_\_in\_chrg=) at /usr/include/c++/11/bits/shared\_ptr\_base.h:705  
#10 0x000055ddee878b22 in std::\_\_shared\_ptr\<ota::http::Stream, (\_\_gnu\_cxx::\_Lock\_policy)2\>::~\_\_shared\_ptr (this=0x7fffcd626608, \_\_in\_chrg=) at /usr/include/c++/11/bits/shared\_ptr\_base.h:1154  
#11 0x000055ddee878b42 in std::shared\_ptrota::http::Stream::~shared\_ptr (this=0x7fffcd626608, \_\_in\_chrg=) at /usr/include/c++/11/bits/shared\_ptr.h:122  
#12 0x000055ddee88efae in ~(void) (this=0x7fffcd626600, \_\_in\_chrg=) at /mnt/hgfs/new-code/br\_datalink/ota-primary/src/common/http/platform/beast/http.cpp:1923  
#13 0x000055ddee89f91e in boost::asio::detail::binder1\<ota::http::Server::AsyncAccept(ota::http::Server::StreamPtr)::\<lambda(const std::error\_code&)\>, boost::system::error\_code\>::~binder1(void) (this=0x7fffcd626600,  
_in\_chrg=) at /home/ubuntu/code/ota-test/ota-third-party/x86\_64\_output/include/boost/asio/detail/bind\_handler.hpp:139  
 #14 0x000055ddee89fa9d in boost::asio::detail::reactive\_socket\_accept\_op\<boost::asio::basic\_socket\<boost::asio::ip::tcp, boost::asio::any\_io\_executor\>, boost::asio::ip::tcp, ota::http::Server::AsyncAccept(ota::http::Server::StreamPtr)::\<lambda(const std::error\_code&)\>, boost::asio::any\_io\_executor\>::do\_complete(void \*, boost::asio::detail::operation \*, const boost::system::error\_code &, std::size\_t) (owner=0x0, base=0x55de0fda44d0)  
at /home/ubuntu/code/ota-test/ota-third-party/x86\_64\_output/include/boost/asio/detail/reactive\_socket\_accept\_op.hpp:158  
 #15 0x000055ddee771379 in boost::asio::detail::scheduler\_operation::destroy (this=0x55de0fda44d0) at /home/ubuntu/code/ota-test/ota-third-party/x86\_64\_output/include/boost/asio/detail/scheduler\_operation.hpp:45  
 #16 0x000055ddee7738a4 in boost::asio::detail::scheduler::shutdown (this=0x55de0fd99b60) at /home/ubuntu/code/ota-test/ota-third-party/x86\_64\_output/include/boost/asio/detail/impl/scheduler.ipp:176  
 #17 0x000055ddee770c57 in boost::asio::detail::service\_registry::shutdown\_services (this=0x55de0fd99b10) at /home/ubuntu/code/ota-test/ota-third-party/x86\_64\_output/include/boost/asio/detail/impl/service\_registry.ipp:44  
 #18 0x000055ddee771191 in boost::asio::execution\_context::shutdown (this=0x55ddef171ea8 \<ota::primary::Singletonota::primary::HttpServer::GetInstance()::instance+40\>)  
at /home/ubuntu/code/ota-test/ota-third-party/x86\_64\_output/include/boost/asio/impl/execution\_context.ipp:41  
 #19 0x000055ddee7741b6 in boost::asio::io\_context::~io\_context (this=0x55ddef171ea8 \<ota::primary::Singletonota::primary::HttpServer::GetInstance()::instance_+40\>, \_\_in\_chrg=)  
at /home/ubuntu/code/ota-test/ota-third-party/x86\_64\_output/include/boost/asio/impl/io\_context.ipp:58

---

<div class="post-metadata">

### Author: ![PrimeQH](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/primeqh/32/2120_2.png) [@PrimeQH](https://hub.mender.io/u/PrimeQH)
#### Post date: [April 17, 2025, 11:43am UTC](https://hub.mender.io/t/ota-binary-coredump/7737/2 "2025-04-17T11:43:13Z")

</div>

When I was using HTTPServer, the program exited and I encountered a bug in the log coredump。

---

<div class="post-metadata">

### Author: ![PrimeQH](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/primeqh/32/2120_2.png) [@PrimeQH](https://hub.mender.io/u/PrimeQH)
#### Post date: [April 17, 2025, 11:43am UTC](https://hub.mender.io/t/ota-binary-coredump/7737/3 "2025-04-17T11:43:52Z")

</div>

Hope this helps to solve this log bug.

---

<div class="post-metadata">

### Author: ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)
#### Post date: [April 17, 2025, 12:17pm UTC](https://hub.mender.io/t/ota-binary-coredump/7737/4 "2025-04-17T12:17:41Z")

</div>

Hi @PrimeQH,

Can you please share some context plus details, and how this possibly relates to Mender?

Greetz,  
Josef

---

<div class="post-metadata">

### Author: ![PrimeQH](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/primeqh/32/2120_2.png) [@PrimeQH](https://hub.mender.io/u/PrimeQH)
#### Post date: [April 17, 2025, 12:36pm UTC](https://hub.mender.io/t/ota-binary-coredump/7737/5 "2025-04-17T12:36:52Z")

</div>

HTTPServer was built using the common/http.hpp library. When HTTPServer exited, a log null pointer bug was found. In the function void Stream::DoCancel() {  
…  
log::Debug(“Stream::DoCancel()”);  
…  
}, a logger\_ null pointer appeared, and then in the function  
void Logger::Log\_(LogLevel level, const string &message) {  
if (this-\>logger\_ == nullptr) {  
std::cerr \<\< “Logger is not initialized or destroyed before use” \<\< std::endl;  
return;  
}  
BOOST\_LOG\_SEV(\*this-\>logger\_, level) \<\< message;  
}  
, a coredump was generated when writing the log.

---

<div class="post-metadata">

### Author: ![PrimeQH](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/primeqh/32/2120_2.png) [@PrimeQH](https://hub.mender.io/u/PrimeQH)
#### Post date: [April 17, 2025, 12:38pm UTC](https://hub.mender.io/t/ota-binary-coredump/7737/6 "2025-04-17T12:38:07Z")

</div>

I currently add a null pointer check before writing to avoid the generation of coredump。  
@TheYoctoJester

---

<div class="post-metadata">

### Author: ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)
#### Post date: [April 17, 2025, 1:12pm UTC](https://hub.mender.io/t/ota-binary-coredump/7737/7 "2025-04-17T13:12:38Z")

</div>

@PrimeQH okay… you’re writing a HTTPServer and are using boost, but that’s really the only thing I gather here.

Greetz,  
Josef

---

<div class="post-metadata">

### Author: ![PrimeQH](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/primeqh/32/2120_2.png) [@PrimeQH](https://hub.mender.io/u/PrimeQH)
#### Post date: [April 18, 2025, 6:10am UTC](https://hub.mender.io/t/ota-binary-coredump/7737/8 "2025-04-18T06:10:15Z")

</div>

HTTPServer has a logger object, and the global Logger object is used to write logs, and finally the program exits.

---

<div class="post-metadata">

### Author: ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)
#### Post date: [April 22, 2025, 9:55am UTC](https://hub.mender.io/t/ota-binary-coredump/7737/9 "2025-04-22T09:55:37Z")

</div>

Hi @PrimeQH,

I noticed you also filed [feat: Add User-Agent header to HTTP requests by jo-lund · Pull Request #1782 · mendersoftware/mender · GitHub](https://github.com/mendersoftware/mender/pull/1782#issuecomment-2812620518). Can you please give some context, and point us to the actual sources in question?

Greetz,  
Josef
