You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by GitBox <gi...@apache.org> on 2022/08/28 15:29:26 UTC

[GitHub] [incubator-kvrocks] PragmaTwice opened a new pull request, #796: Show function name in backtrace

PragmaTwice opened a new pull request, #796:
URL: https://github.com/apache/incubator-kvrocks/pull/796

   before this PR:
   
   ```
   W20220828 22:03:53.151856 739033 main.cc:107] ======= Ooops! kvrocks 999.999.999 got signal: 11 =======
   W20220828 22:03:53.152230 739033 main.cc:117] ./kvrocks(+0x6a5a6a) [0x555bc2a1da6a]
   W20220828 22:03:53.152393 739033 main.cc:117] ./kvrocks(+0x6a5a6a) [0x555bc2a1da6a]
   W20220828 22:03:53.152709 739033 main.cc:117] ./kvrocks(+0x212193) [0x555bc258a193]
   W20220828 22:03:53.152808 739033 main.cc:117] ./kvrocks(+0x6a06d9) [0x555bc2a186d9]
   W20220828 22:03:53.152905 739033 main.cc:117] ./kvrocks(+0x69861e) [0x555bc2a1061e]
   W20220828 22:03:53.153121 739033 main.cc:117] ./kvrocks(+0x698dd7) [0x555bc2a10dd7]
   W20220828 22:03:53.153307 739033 main.cc:117] ./kvrocks(+0x20e77a) [0x555bc258677a]
   W20220828 22:03:53.153399 739033 main.cc:117] ./kvrocks(+0x7ba234) [0x555bc2b32234]
   W20220828 22:03:53.153468 739033 main.cc:117] /usr/lib/libc.so.6(+0x8d5c2) [0x7ff06e9915c2]
   W20220828 22:03:53.153565 739033 main.cc:117] /usr/lib/libc.so.6(clone+0x44) [0x7ff06ea16584]
   [1]    738933 segmentation fault (core dumped)  ./kvrocks -c kvrocks-ssl.conf
   ````
   
   after this PR:
   
   ```
   W20220828 22:03:53.151856 739033 main.cc:107] ======= Ooops! kvrocks 999.999.999 @xxxxxxx got signal 11 =======
   W20220828 22:03:53.152393 739033 main.cc:117] ./kvrocks(+0x6a5a6a) [0x555bc2a1da6a]: bufferevent_get_openssl_error
   W20220828 22:03:53.152709 739033 main.cc:117] ./kvrocks(+0x212193) [0x555bc258a193]: Worker::newTCPConnection()
   W20220828 22:03:53.152808 739033 main.cc:117] ./kvrocks(+0x6a06d9) [0x555bc2a186d9]: listener_read_cb
   W20220828 22:03:53.152905 739033 main.cc:117] ./kvrocks(+0x69861e) [0x555bc2a1061e]: event_process_active_single_queue
   W20220828 22:03:53.153121 739033 main.cc:117] ./kvrocks(+0x698dd7) [0x555bc2a10dd7]: event_base_loop
   W20220828 22:03:53.153307 739033 main.cc:117] ./kvrocks(+0x20e77a) [0x555bc258677a]: Worker::Run()
   W20220828 22:03:53.153399 739033 main.cc:117] ./kvrocks(+0x7ba234) [0x555bc2b32234]: execute_native_thread_routine
   W20220828 22:03:53.153468 739033 main.cc:117] /usr/lib/libc.so.6(+0x8d5c2) [0x7ff06e9915c2]: start_thread
   W20220828 22:03:53.153565 739033 main.cc:117] /usr/lib/libc.so.6(clone+0x44) [0x7ff06ea16584]: __GI___clone
   [1]    738933 segmentation fault (core dumped)  ./kvrocks -c kvrocks-ssl.conf
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] PragmaTwice commented on a diff in pull request #796: Show function name in backtrace

Posted by GitBox <gi...@apache.org>.
PragmaTwice commented on code in PR #796:
URL: https://github.com/apache/incubator-kvrocks/pull/796#discussion_r956939870


##########
src/main.cc:
##########
@@ -96,20 +100,25 @@ void *getMcontextEip(ucontext_t *uc) {
 
 extern "C" void segvHandler(int sig, siginfo_t *info, void *secret) {
   void *trace[100];
-  char **messages = nullptr;
-  struct sigaction act;
   auto uc = reinterpret_cast<ucontext_t*>(secret);
 
-  LOG(WARNING) << "======= Ooops! kvrocks "<< VERSION << " got signal: "  << sig << " =======";
-  int trace_size = backtrace(trace, 100);
+  LOG(WARNING) << "======= Ooops! kvrocks "<< VERSION << " @" << GIT_COMMIT << " got signal "  << sig << " =======";
+  int trace_size = backtrace(trace, sizeof(trace) / sizeof(void *));
   /* overwrite sigaction with caller's address */
   if (getMcontextEip(uc) != nullptr) {
     trace[1] = getMcontextEip(uc);
   }
-  messages = backtrace_symbols(trace, trace_size);
-  for (int i = 1; i < trace_size; ++i) {
-    LOG(WARNING) << messages[i];
+  char **messages = backtrace_symbols(trace, trace_size);
+  for (int i = 2; i < trace_size; ++i) {
+    char func_info[1024] = {};
+    if (google::Symbolize(trace[i], func_info, sizeof(func_info) - 1)) {
+      LOG(WARNING) << messages[i] << ": " << func_info;

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] PragmaTwice merged pull request #796: Show function name in backtrace

Posted by GitBox <gi...@apache.org>.
PragmaTwice merged PR #796:
URL: https://github.com/apache/incubator-kvrocks/pull/796


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] PragmaTwice commented on pull request #796: Show function name in backtrace

Posted by GitBox <gi...@apache.org>.
PragmaTwice commented on PR #796:
URL: https://github.com/apache/incubator-kvrocks/pull/796#issuecomment-1230307696

   Thanks all. Merging...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] ShooterIT commented on a diff in pull request #796: Show function name in backtrace

Posted by GitBox <gi...@apache.org>.
ShooterIT commented on code in PR #796:
URL: https://github.com/apache/incubator-kvrocks/pull/796#discussion_r956856112


##########
src/main.cc:
##########
@@ -96,20 +100,25 @@ void *getMcontextEip(ucontext_t *uc) {
 
 extern "C" void segvHandler(int sig, siginfo_t *info, void *secret) {
   void *trace[100];
-  char **messages = nullptr;
-  struct sigaction act;
   auto uc = reinterpret_cast<ucontext_t*>(secret);
 
-  LOG(WARNING) << "======= Ooops! kvrocks "<< VERSION << " got signal: "  << sig << " =======";
-  int trace_size = backtrace(trace, 100);
+  LOG(WARNING) << "======= Ooops! kvrocks "<< VERSION << " @" << GIT_COMMIT << " got signal "  << sig << " =======";
+  int trace_size = backtrace(trace, sizeof(trace) / sizeof(void *));
   /* overwrite sigaction with caller's address */
   if (getMcontextEip(uc) != nullptr) {
     trace[1] = getMcontextEip(uc);
   }
-  messages = backtrace_symbols(trace, trace_size);
-  for (int i = 1; i < trace_size; ++i) {
-    LOG(WARNING) << messages[i];
+  char **messages = backtrace_symbols(trace, trace_size);
+  for (int i = 2; i < trace_size; ++i) {
+    char func_info[1024] = {};
+    if (google::Symbolize(trace[i], func_info, sizeof(func_info) - 1)) {
+      LOG(WARNING) << messages[i] << ": " << func_info;

Review Comment:
   how about `LOG(ERROR)`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org