简体   繁体   English

C ++调试:以SIGABRT终止

[英]C++ debugging: Terminated with SIGABRT

I am trying to write a program, in C++, which runs on a cluster of machines, and all machines are talking to each other over TCP sockets. 我正在尝试用C ++编写一个程序,该程序在一组计算机上运行,​​并且所有计算机都通过TCP套接字相互通信。 Program crashes randomly at one of the machines. 程序在其中一台计算机上随机崩溃。 I did an analysis of core-dump with gdb. 我用gdb分析了核心转储。 Following are the output: 以下是输出:

$ gdb executable dump

  Core was generated by `/home/user/experiments/files/executable 2 /home/user/'.
  Program terminated with signal SIGABRT, Aborted.
  0 0x00007fb76a084c37 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
  56    ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.

  (gdb) backtrace
  0 0x00007fb76a084c37 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
  1 0x00007fb76a088028 in __GI_abort () at abort.c:89
  2 0x00007fb76a0c12a4 in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x7fb76a1cd113 "*** %s ***: %s terminated\n") at ../sysdeps/posix/libc_fatal.c:175
  3 0x00007fb76a158bbc in __GI___fortify_fail (msg=<optimized out>, msg@entry=0x7fb76a1cd0aa "buffer overflow detected") at fortify_fail.c:38
  4 0x00007fb76a157a90 in __GI___chk_fail () at chk_fail.c:28
  5 0x00007fb76a158b07 in __fdelt_chk (d=<optimized out>) at fdelt_chk.c:25
  6 0x000000000040a918 in LocalSenderPort::run() ()
  7 0x000000000040ae70 in LocalSenderPort::LocalSenderPort(unsigned int, std::string, std::vector<std::string, std::allocator<std::string> >, char*) ()
  8 0x00000000004033d5 in main ()

Any suggestions for what should I look? 有什么建议我应该看什么? How should I proceed? 我应该如何进行? Any help is really appreciated. 任何帮助都非常感谢。

I am not sharing code right now, as its a large code spread across files. 我现在不共享代码,因为它的大代码分布在文件中。 But I can share if needed. 但如有需要,我可以分享。

This error: __fdelt_chk (d=<optimized out>) at fdelt_chk.c:25 means that your program violated precondition of one of the FD_* macros. 此错误: __fdelt_chk (d=<optimized out>) at fdelt_chk.c:25意味着您的程序违反了FD_*宏之一的前提条件。

The source of fdelt_chk is quite simple, and there are only two conditions under which it fails: you pass in negative file descriptor, or you pass in a file descriptor greater than 1023. fdelt_chk的源非常简单,并且在两种情况下失败:您传递的是负文件描述符,或者传递的文件描述符大于1023。

In this day and age, using select and/or FD_SET in any program that can have more than 1024 simultaneous connections (which Linux easily allows) can only end in tears. 在当今时代,在任何可以同时具有1024个以上同时连接(Linux轻松允许)的程序中使用select和/或FD_SET只能以失败告终。 Use epoll instead. 请改用epoll

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM