1

I am getting random SIGABRT signals terminating my program.

I have looked at what causes these but found no matching error I have performed as well as finding a cause, but this has also been fruitless. See the first example of how this cannot be a cause.

please note: I added to of a few SIGABRT error, since I am unsure of what might cause it, thus giving the reader a beter understanding of the code

I have 2 occurences of these SIGABRT's (of a number, most are not mentioned).

First Occurence: an example:

CONF_FILE_LINUX = QString("a;string;here");

and

QStringList opts = CONF_FILE_LINUX.split(delim);

The above code should take a string of contents separated by delim = ; with no spaces and create a QStringList from this.

Sometimes it passes without a SIGABRT error, sometimes it does not.

Full backtrace of the signal (see #10):

1   __GI_raise                                                               raise.c               58   0x7ffff586e7ef 
2   __GI_abort                                                               abort.c               89   0x7ffff58703ea 
3   __libc_message                                                           libc_fatal.c          175  0x7ffff58b20d0 
4   malloc_printerr                                                          malloc.c              5046 0x7ffff58be58c 
5   _int_realloc                                                             malloc.c              4333 0x7ffff58be58c 
6   __GI___libc_realloc                                                      malloc.c              3080 0x7ffff58bf4b6 
7   QListData::realloc_grow(int)                                                                        0x7ffff67cdc75 
8   QListData::append(int)                                                                              0x7ffff67cdd0e 
9   ??                                                                                                  0x7ffff675d545 
10  QString::split(QChar, QString::SplitBehavior, Qt::CaseSensitivity) const                            0x7ffff6801805 
11  OpenVPN_Interface::createConfigFile                                      openvpn_interface.cpp 181  0x555555578bfe 
12  OpenVPN_Interface::connect                                               openvpn_interface.cpp 80   0x555555577fc7 
13  MainWindow::on_btnState_clicked                                          mainwindow.cpp        301  0x55555555f6de 
14  MainWindow::qt_static_metacall                                           moc_mainwindow.cpp    105  0x55555557cb48 
15  MainWindow::qt_metacall                                                  moc_mainwindow.cpp    138  0x55555557cc40 
16  QMetaObject::activate(QObject *, int, int, void * *)                                                0x7ffff695f700 
17  QAbstractButton::clicked(bool)                                                                      0x7ffff77c0682 

Second Occurrence:

Code:

QFile vpn_config(conf_path);
QTextStream fout(&vpn_config)

Same symptoms of previous error. The conf_path is a predefined non empty string.

Full backtrace:

1   malloc_consolidate                                                                                      malloc.c              4204 0x7ffff58b9e8b 
2   _int_malloc                                                                                             malloc.c              3485 0x7ffff58bcd7f 
3   __GI___libc_malloc                                                                                      malloc.c              2925 0x7ffff58bede4 
4   QArrayData::allocate(unsigned long, unsigned long, unsigned long, QFlags<QArrayData::AllocationOption>)                            0x7ffff6772510 
5   QByteArray::resize(int)                                                                                                            0x7ffff67750b3 
6   QRingBuffer::reserve(long long)                                                                                                    0x7ffff67ed2be 
7   QRingBuffer::append(const char *, long long)                                                                                       0x7ffff67ed3e4 
8   QFileDevice::writeData(const char *, long long)                                                                                    0x7ffff6867ab2 
9   QIODevice::write(const char *, long long)                                                                                          0x7ffff686ff9e 
10  ??                                                                                                                                 0x7ffff68802d7 
11  QTextStream::~QTextStream()                                                                                                        0x7ffff6880438 
12  dataManager::FILE_writeOVPNConfig                                                                       datamanager.cpp       333  0x555555574cfb 
13  OpenVPN_Interface::createConfigFile                                                                     openvpn_interface.cpp 221  0x55555557910c 
14  OpenVPN_Interface::connect                                                                              openvpn_interface.cpp 80   0x555555577fc7 
15  MainWindow::on_btnState_clicked                                                                         mainwindow.cpp        301  0x55555555f6de   

On each new debugging session, the "code takes turns" throwing a SIGABRT error and I am completely lost!

Any advice on how to proceed?

Community
  • 1
  • 1
CybeX
  • 2,060
  • 3
  • 48
  • 115
  • `MainWindow::on_btnState_clicked` is common between the two, perhaps start by looking there. – OMGtechy Nov 02 '16 at 16:19
  • `malloc_printerr` in your backtrace suggests that you've got some sort of memory corruption somewhere. `realloc` should be printing an error message (hopefully informative). You might want to run your code under Valgrind to track it down.You might also want to try running your program with the `MALLOC_CHECK_` environment variable set to 2, to hopefully make it abort earlier, closer to the code causing the issue. – Hasturkun Nov 02 '16 at 16:20
  • 1
    Maybe also use `valgrind` to search for memory problems more thoroughly. – m8mble Nov 02 '16 at 18:04
  • You're facing fallout from bugs elsewhere in your code. By the time the aborting code runs, the state of your process has already been corrupted. This question is off-topic as there's no self-contained test case that reproduces it. – Kuba hasn't forgotten Monica Nov 03 '16 at 13:19
  • Pass `-fsanitize=` to your compiler (`address` or `memory` would be good starts) or learn to use valgrind. You have a memory corruption, and it might be painful... – Matthieu M. Nov 03 '16 at 13:39

0 Answers0