Crash in Sparksee::Open(...)

174 views
Skip to first unread message

Александр Богданов

unread,
Mar 1, 2014, 7:58:36 AM3/1/14
to
Hello.

Using evaluation copy of Sparksee C++ (last one from official site) under 64-bit Arch Linux in Oracle VM VirtualBox (1775 MB RAM).

Running simple test code:

#include <iostream>

#include "gdb/Sparksee.h"
#include "gdb/Database.h"
#include "gdb/Session.h"
#include "gdb/Graph.h"
#include "gdb/Objects.h"
#include "gdb/ObjectsIterator.h"

using namespace sparksee::gdb;

int main(int argc, char* argv[]) {
 
SparkseeConfig cfg;

 cfg
.SetLogFile(L"/home/lnkr-a/Logs/Sparksee.log");
 
Sparksee *sprksee = new Sparksee(cfg);
 
Database *db = NULL;
 
try {
 db
= sprksee->Open(L"TestDB.gdb", false);
 
}
 
catch(FileNotFoundException &exc) {
 db
= sprksee->Create(L"TestDB.gdb", L"TestDB");
 
}
 
catch(Exception &e) {
 std
::cout << "Error!";
 
}

 
return 0;
}


If there no TestDB.gdb file, then all is ok. After catching FileNotFoundException files will be created.
But if i running this code when files already exist, then program terminating with output:

terminate called after throwing an instance of 'std::bad_alloc'
  what
():  std::bad_alloc
**** CRITICAL ERROR (SIGNAL NUM 6)
------- Begin of call stack ------
/usr/local/lib/libsparksee.so(_ZN13sparksee_core21CallStackTraceHandler13SignalHandlerEi+0x28) [0x7f18cd1f1328]
/usr/lib/libc.so.6(+0x353e0) [0x7f18cc5413e0]
/usr/lib/libc.so.6(gsignal+0x39) [0x7f18cc541369]
/usr/lib/libc.so.6(abort+0x148) [0x7f18cc542768]
/usr/lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x155) [0x7f18cce2f635]
/usr/lib/libstdc++.so.6(+0x5e7a6) [0x7f18cce2d7a6]
/usr/lib/libstdc++.so.6(+0x5e7d3) [0x7f18cce2d7d3]
/usr/lib/libstdc++.so.6(+0x5e7e6) [0x7f18cce2d7e6]
/usr/lib/libstdc++.so.6(__cxa_call_unexpected+0x32) [0x7f18cce2d462]
/usr/local/lib/libsparksee.so(_ZN8sparksee3gdb8Sparksee4OpenERKSbIwSt11char_traitsIwESaIwEEb+0x127) [0x7f18cd1b30f7]
/home/lnkr-a/Sources/SparkseeTrain/SparkseeTest/Debug/SparkseeTest() [0x4011d0]
/usr/lib/libc.so.6(__libc_start_main+0xf5) [0x7f18cc52db05]
/home/lnkr-a/Sources/SparkseeTrain/SparkseeTest/Debug/SparkseeTest() [0x401009]
-------- End of call stack -------

What can be wrong? Maybe configs or so?

Thanx for the answer.

PS: sorry for my english



sparkseegdb

unread,
Mar 3, 2014, 7:03:42 AM3/3/14
to spar...@googlegroups.com
Hello,

With Sparksee you need to close the database when not using it anymore, that is an important task to avoid the database to get corrupted. Therefore you should add the following before the return 0:

delete db;
delete sprksee;

Also, please take into consideration that you must close Sessions, Objects and ObjectsIterators as well if you are eventually using them.

You can see an example in the HelloSparksee C++ code available in Sparksee website: http://sparsity-technologies.com/StartingGuide/sources/HelloSparksee.cpp

In addition to the former best practices you can activate the recovery functionality to avoid major crashes:

cfg.SetRecoveryEnabled(true);

Hope this helps!

Sparksee team

Александр Богданов

unread,
Mar 3, 2014, 8:22:52 AM3/3/14
to spar...@googlegroups.com
Thak you.
That helped.

суббота, 1 марта 2014 г., 13:59:47 UTC+4 пользователь Александр Богданов написал:
Reply all
Reply to author
Forward
0 new messages