Closed varma08420 closed 1 year ago
sorry , i have not provided sufficient info. i have implemented simple Http server
uWS::SSLApp* mp_app = new uWS::SSLApp(); char l_li_vip[RT_MAX_IP_LEN]; strncpy(l_li_vip,m_li_vip,RT_MAX_IP_LEN);
mp_app->listen(m_li_port,&f1);
mp_app->post("/LI_REQUEST",&rtProcessHttpPOSTRequest);
mp_app->del("/LI_REQUEST",&rtProcessHttpPOSTRequest);
mp_app->get("/*",&rtProcessHttpGETRequest);
mp_app->run();
void rtProcessHttpPOSTRequest(uWS::HttpResponse
at third_party/uWS/include/AsyncSocket.h:144
at third_party/uWS/include/HttpResponse.h:187
at third_party/uWS/include/HttpResponse.h:226
at RtLIX1Handler.cpp:2044
but GET works without any problem in which i am sending data to client in response with sequence number. processing time between request and response is less than 1 sec. any suggestions to avoid crashing ?? am i doing anything wrong by using different threads ?? should i use single thread??
@uNetworkingAB anything??
Pro tip: when you write C++, always use AddressSanitizer and ThreadSanitizer. These tools would show you the UB very clear. The lib is single threaded, you can't just jump threads like that
@uNetworkingAB thanks for your tip, i have used lib asan and got the following output..
==108692==ERROR: AddressSanitizer: heap-use-after-free on address 0x6110001800e4 at pc 0x0000004ced53 bp 0x7f0b96dd9d70 sp 0x7f0b96dd9d60 READ of size 4 at 0x6110001800e4 thread T42
0x6110001800e4 is located 228 bytes inside of 240-byte region [0x611000180000,0x6110001800f0) freed by thread T46 here:
previously allocated by thread T46 here:
Thread T42 created by T0 here:
Thread T46 created by T0 here:
SUMMARY: AddressSanitizer: heap-use-after-free third_party/uWS/include/HttpResponse.h:180 in uWS::HttpResponse::writeStatus(std::basic_string_view<char, std::char_traits >) Shadow bytes around the buggy address: 0x0c2280027fc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2280027fd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2280027fe0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2280027ff0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2280028000: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd =>0x0c2280028010: fd fd fd fd fd fd fd fd fd fd fd fd[fd]fd fa fa 0x0c2280028020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2280028030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2280028040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2280028050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2280028060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==108692==ABORTING
Hi, I have been using uWebSockets for long time on RHEL Linux 7XX but currently moved to RHEL 8XX, i have compiled code on 8XX platform started the http server, but my process getting crashes while sending response through write method. i am using /uWebSockets-0.16.0b1/src/App.h. this case was not seen when i used RHEL 7XX compiled library.
thanks!