You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tried integrating this repo into my application, just to test oatpp.
First of, if I do it exactly, I will get compilation warnings from gcc14:
include/ecmi/EcmiComponent.hpp:49:62: warning: declaration of ‘executor’ shadows a member of ‘AppComponent’ [-Wshadow]
If I rename the executor in in AppComponent.hpp (My code uses the ecmi prefix), it compiles without warnings, and application will start successfully, and bind to the socket.
BUT. Sending in curl -v -s http://127.0.0.1:7070/hello, will result in TWO responses, when tracing the connection with ngrep, as can be seen below.
I'd like to troubelshoot the callchains, but I havent been able to figure out how I can increase the logging/tracing of the oatpp library?
#####
T 127.0.0.1:45726 -> 127.0.0.1:7070 [AP] #307
GET /hello HTTP/1.1.
Host: 127.0.0.1:7070.
User-Agent: curl/8.12.1.
Accept: */*.
.
##
T 127.0.0.1:7070 -> 127.0.0.1:45726 [AP] #309
HTTP/1.1 200 OK.
Content-Length: 58.
Connection: keep-alive.
Server: oatpp/1.4.0.
Content-Type: application/json.
.
{"code":42,"message":"Hello World","result":"Really Good"}
###
T 127.0.0.1:7070 -> 127.0.0.1:45726 [AP] #312
HTTP/1.1 500 Internal Server Error.
Content-Length: 109.
Connection: close.
Server: oatpp/1.4.0.
.
server=oatpp/1.4.0
code=500
description=Internal Server Error
stacktrace:
- Error processing async request
###
The text was updated successfully, but these errors were encountered:
In my latest attempts in trying to understand the code, I have made some changes in how I start the server, so I'll add them here: My main creates an object of class EcmiServer, which looks like this. But regardless of my changes, I always get the same TWO responses.
I also tried creating a server without using the DI-mechanism (using a lot of ::createShared(), but the same results)
// Params not used yet
EcmiServer::EcmiServer(std::string address, std::uint16_t port)
: listenPort(port),
listenAddress(address)
{
NW_TRACE_ENTER(NwTrace::Ecmi, listenPort, listenAddress);
oatpp::Environment::init();
}
EcmiServer::~EcmiServer()
{
NW_TRACE_ENTER(NwTrace::Ecmi, listenPort, listenAddress);
oatpp::Environment::destroy();
}
void EcmiServer::run()
{
NW_TRACE_ENTER(NwTrace::Ecmi, listenPort, listenAddress);
// Not used right now...
const oatpp::network::Address bindSocket = {listenAddress, listenPort, oatpp::network::Address::IP_4};
AppComponent components;
/* Get router component */
OATPP_COMPONENT(std::shared_ptr<oatpp::web::server::HttpRouter>, router);
/* Create MyController and add all of its endpoints to router */
router->addController(std::make_shared<MyController>());
/* Get connection handler component */
OATPP_COMPONENT(std::shared_ptr<oatpp::network::ConnectionHandler>, connectionHandler);
/* Get connection provider component */
OATPP_COMPONENT(std::shared_ptr<oatpp::network::ServerConnectionProvider>, connectionProvider);
m_server = oatpp::network::Server::createShared(connectionProvider, connectionHandler);
std::string lPort = connectionProvider->getProperty("port").toString();
/* Priny info about server port */
OATPP_LOGi("MyApp", "Server running on port {}", connectionProvider->getProperty("port").toString())
/* Run server */
std::jthread oatThread(&EcmiServer::startServer, this);
oatThread.detach();
NW_TRACE_NOTICE(NwTrace::Ecmi, "Running", lPort);
}
void EcmiServer::startServer()
{
m_server->run();
}
I've tried integrating this repo into my application, just to test oatpp.
First of, if I do it exactly, I will get compilation warnings from gcc14:
If I rename the executor in in AppComponent.hpp (My code uses the ecmi prefix), it compiles without warnings, and application will start successfully, and bind to the socket.
BUT. Sending in
curl -v -s http://127.0.0.1:7070/hello
, will result in TWO responses, when tracing the connection with ngrep, as can be seen below.I'd like to troubelshoot the callchains, but I havent been able to figure out how I can increase the logging/tracing of the oatpp library?
The text was updated successfully, but these errors were encountered: