Problem description
Simple program build with Pistache library build on aarch64 platform shows:
Computer: mac mini M1
OS: VoidLinux: Linux mini 6.17.12+1-asahi_1 Pistache work on mac? #1 SMP PREEMPT_DYNAMIC Thu Jan 1 01:25:36 UTC 2026 aarch64 GNU/Linux
Pistache version: 0.5.9.20250824
Tested using following compilers:
g++ (GCC) 14.2.1 20250405
clang version 21.1.7 (Target: aarch64-unknown-linux-gnu, Thread model: posix)
Pistache build options
option('PISTACHE_BUILD_TESTS', type: 'boolean', value: false, description: 'build tests alongside the project')
option('PISTACHE_BUILD_EXAMPLES', type: 'boolean', value: false, description: 'build examples alongside the project')
option('PISTACHE_BUILD_DOCS', type: 'boolean', value: false, description: 'build docs alongside the project')
option('PISTACHE_INSTALL', type: 'boolean', value: true, description: 'add pistache as install target (recommended)')
option('PISTACHE_USE_SSL', type: 'boolean', value: false, description: 'add support for SSL server')
option('PISTACHE_USE_RAPIDJSON', type: 'boolean', value: true, description: 'add support for rapidjson')
option('PISTACHE_USE_CONTENT_ENCODING_BROTLI', type: 'boolean', value: false, description: 'add support for Brotli compressed content encoding')
option('PISTACHE_USE_CONTENT_ENCODING_ZSTD', type: 'boolean', value: false, description: 'add support for Zstandard compressed content encoding')
option('PISTACHE_USE_CONTENT_ENCODING_DEFLATE', type: 'boolean', value: false, description: 'add support for deflate compressed content encoding')
option('PISTACHE_DEBUG', type: 'boolean', value: false, description: 'with debugging code')
option('PISTACHE_LOG_AND_STDOUT', type: 'boolean', value: false, description: 'send log msgs to stdout too')
option('PISTACHE_FORCE_LIBEVENT', type: 'boolean', value: false, description: 'force use of libevent')
Program buid command
g++ -g -std=c++17 -o svc main.cc -I/home/mp/opt/include -L/home/mp/opt/lib -lpistache
Expected behaviour
svc service called from a browser with http://localhost:8080/api or using curl should returns
Curl command:
curl -X GET -m 5 http://localhost:8080/api
Complete code
#include <iostream>
#include <stdexcept>
#include <pistache/endpoint.h>
#include <pistache/router.h>
using namespace Pistache ;
using Request = Rest ::Request ;
using Response = Http ::ResponseWriter ;
class Service
{
uint16_t m_port ;
std ::string m_host ;
unsigned int m_nthreads ;
std ::shared_ptr < Http ::Endpoint > m_endpoint ;
Rest ::Router m_router ;
public :
Service (uint16_t port , const char * host = "0.0.0.0" )
: m_port (port ), m_host (host ), m_nthreads (1 )
{}
~Service () {}
void run ()
{
std ::cout << "Svc running on port: " << m_port << std ::endl ;
try {
Address svc_address (m_host , m_port );
m_endpoint = std ::make_shared < Http ::Endpoint > (svc_address );
auto opts = Http ::Endpoint ::options ().threads (m_nthreads );
opts .flags (Tcp ::Options ::ReuseAddr );
m_endpoint -> init (opts );
Rest ::Routes ::Get (m_router , "/api" , Rest ::Routes ::bind (& Service ::do_something , this ));
m_endpoint -> setHandler (m_router .handler ());
m_endpoint -> serve ();
} catch (const std ::runtime_error & e ) {
std ::cerr << "Svc exception: " << e .what () << std ::endl ;
}
}
private :
void do_something (const Request & request , Response response )
{
try {
response .send (Http ::Code ::Ok , "{\"abc\":123}" , MIME (Text , Json ));
} catch (...) {
response .send (Http ::Code ::Internal_Server_Error , "Internal error" , MIME (Text , Plain ));
}
}
};
int main (int argc , char * * argv )
{
int port = 8080 ;
const char * host = "0.0.0.0" ;
try {
Service service (port , host );
service .run ();
} catch (const std ::exception & e ) {
std ::cerr << e .what () << std ::endl ;
return 1 ;
}
return 0 ;
}
lldb backtrace output
*** stack smashing detected ***: terminated
Process 3291 stopped
* thread #2, name = 'svc', stop reason = signal SIGABRT
frame #0: 0x0000fffff7919d78 libc.so.6`__pthread_kill_implementation(threadid=281474825646432, signo=6, no_tid=<unavailable>) at pthread_kill.c:44:76
(lldb) bt
error: svc 0x000420d0: DW_TAG_member '_M_local_buf' refers to type 0x0000000000079808 which extends beyond the bounds of 0x000420c8
* thread #2, name = 'svc', stop reason = signal SIGABRT
* frame #0: 0x0000fffff7919d78 libc.so.6`__pthread_kill_implementation(threadid=281474825646432, signo=6, no_tid=<unavailable>) at pthread_kill.c:44:76
frame #1: 0x0000fffff78ca5dc libc.so.6`__GI_raise(sig=6) at raise.c:26:13
frame #2: 0x0000fffff78b59f8 libc.so.6`__GI_abort at abort.c:73:3
frame #3: 0x0000fffff790db08 libc.so.6`__libc_message_impl(fmt="") at libc_fatal.c:134:3
frame #4: 0x0000fffff7988ed8 libc.so.6`__GI___fortify_fail(msg="") at fortify_fail.c:24:3
frame #5: 0x0000fffff7989f14 libc.so.6`__stack_chk_fail at stack_chk_fail.c:24:3
frame #6: 0x0000aaaaaaaa8508 svc`std::function<Pistache::Rest::Route::Result (Pistache::Rest::Request, Pistache::Http::ResponseWriter)> Pistache::Rest::Routes::bind<void, Service, Pistache::Rest::Request const&, Pistache::Http::ResponseWriter, Service*>(void (Service::*)(Pistache::Rest::Request const&, Pistache::Http::ResponseWriter), Service*)::'lambda'(Pistache::Rest::Request const&, Pistache::Http::ResponseWriter)::operator()(__closure=0x0000aaaaaaae89d0, request=0x0000fffff6fecdb0, response=ResponseWriter @ 0x0000fffff6fec120) const at router.h:412:20
frame #7: 0x0000aaaaaaaaa98c svc`void std::__invoke_impl<Pistache::Rest::Route::Result, std::function<Pistache::Rest::Route::Result (Pistache::Rest::Request, Pistache::Http::ResponseWriter)> Pistache::Rest::Routes::bind<void, Service, Pistache::Rest::Request const&, Pistache::Http::ResponseWriter, Service*>(void (Service::*)(Pistache::Rest::Request const&, Pistache::Http::ResponseWriter), Service*)::'lambda'(Pistache::Rest::Request const&, Pistache::Http::ResponseWriter)&, Pistache::Rest::Request, Pistache::Http::ResponseWriter>((null)=__invoke_other @ 0x0000fffff6fec118, __f=0x0000aaaaaaae89d0, (null)=0x0000fffff6fecdb0, (null)=0x0000fffff6fec630) at invoke.h:61:36
frame #8: 0x0000aaaaaaaaa31c svc`std::enable_if<is_invocable_r_v<void, Service, Pistache::Rest::Request const&, Pistache::Http::ResponseWriter>, void>::type std::__invoke_r<Pistache::Rest::Route::Result, std::function<Pistache::Rest::Route::Result (Pistache::Rest::Request, Pistache::Http::ResponseWriter)> Pistache::Rest::Routes::bind<void, Service, Pistache::Rest::Request const&, Pistache::Http::ResponseWriter, Service*>(void (Service::*)(Pistache::Rest::Request const&, Pistache::Http::ResponseWriter), Service*)::'lambda'(Pistache::Rest::Request const&, Pistache::Http::ResponseWriter)&, Pistache::Rest::Request, Pistache::Http::ResponseWriter>(__fn=0x0000aaaaaaae89d0, (null)=0x0000fffff6fecdb0, (null)=0x0000fffff6fec630) at invoke.h:114:35
frame #9: 0x0000aaaaaaaa98a0 svc`std::_Function_handler<Pistache::Rest::Route::Result (Pistache::Rest::Request, Pistache::Http::ResponseWriter), std::function<Pistache::Rest::Route::Result (Pistache::Rest::Request, Pistache::Http::ResponseWriter)> Pistache::Rest::Routes::bind<void, Service, Pistache::Rest::Request const&, Pistache::Http::ResponseWriter, Service*>(void (Service::*)(Pistache::Rest::Request const&, Pistache::Http::ResponseWriter), Service*)::'lambda'(Pistache::Rest::Request const&, Pistache::Http::ResponseWriter)>::_M_invoke(__functor=0x0000aaaaaaae89a0, __args#0=0x0000fffff6fecdb0, __args#1=0x0000fffff6fec630) at std_function.h:290:30
frame #10: 0x0000fffff7f4c5dc libpistache.so.0.5`Pistache::Rest::Router::route(Pistache::Http::Request const&, Pistache::Http::ResponseWriter) const + 3516
frame #11: 0x0000fffff7f4cc98 libpistache.so.0.5`Pistache::Rest::Private::RouterHandler::onRequest(Pistache::Http::Request const&, Pistache::Http::ResponseWriter) + 80
frame #12: 0x0000fffff7eebba8 libpistache.so.0.5`Pistache::Http::Handler::onInput(char const*, unsigned long, std::shared_ptr<Pistache::Tcp::Peer> const&) + 736
frame #13: 0x0000fffff7f277c0 libpistache.so.0.5`Pistache::Tcp::Transport::handleIncoming(std::shared_ptr<Pistache::Tcp::Peer> const&) + 160
frame #14: 0x0000fffff7f2c3d8 libpistache.so.0.5`Pistache::Tcp::Transport::onReady(Pistache::Aio::FdSet const&) + 332
frame #15: 0x0000fffff7f20308 libpistache.so.0.5`Pistache::Aio::SyncImpl::handleFds(std::vector<Pistache::Polling::Event, std::allocator<Pistache::Polling::Event>>) const + 1416
frame #16: 0x0000fffff7f21064 libpistache.so.0.5`std::thread::_State_impl<std::thread::_Invoker<std::tuple<Pistache::Aio::AsyncImpl::Worker::run()::'lambda'()>>>::_M_run() + 548
frame #17: 0x0000fffff7c56f50 libstdc++.so.6`___lldb_unnamed_symbol_106f20 + 48
frame #18: 0x0000fffff7917ff0 libc.so.6`start_thread(arg=0x0000fffff6fef160) at pthread_create.c:448:8
frame #19: 0x0000fffff797d6cc libc.so.6`thread_start at clone3.S:76
Additional information
On intel platform works well :-)
Problem description
Simple program build with Pistache library build on aarch64 platform shows:
Pistache build options
Program buid command
Expected behaviour
svc service called from a browser with http://localhost:8080/api or using curl should returns
Curl command:
Complete code
lldb backtrace output
Additional information
On intel platform works well :-)