TerraME / terrame

TerraME is a programming environment for spatial dynamical modelling
www.terrame.org
GNU Lesser General Public License v3.0
36 stars 13 forks source link

Map observing dieing agents #695

Closed pedro-andrade-inpe closed 6 years ago

pedro-andrade-inpe commented 9 years ago

TerraME crashes when observing a Society of dying agents. Add a test for this.


Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   terrame                         0x0000000101298608 TerraMEObserver::AgentObserverMap::draw(QDataStream&) + 264
1   terrame                         0x00000001012cede2 ObserverImpl::update(double) + 146
2   terrame                         0x00000001012cf661 SubjectImpl::notifyObservers(double) + 97
3   terrame                         0x00000001011cd8d5 luaCellularSpace::notify(lua_State*) + 37
4   liblua.dylib                    0x0000000102a3d171 luaD_precall + 426
5   liblua.dylib                    0x0000000102a47c6e luaV_execute + 1862
6   liblua.dylib                    0x0000000102a3d467 luaD_call + 66
7   liblua.dylib                    0x0000000102a39e80 lua_callk + 73
8   terrame                         0x0000000101246e65 luaMessage::execute(Event&) + 1061
9   terrame                         0x00000001012324ce SchedulerImpl::execute(double&) + 766
10  terrame                         0x000000010122c65b luaTimer::execute(lua_State*) + 43
11  liblua.dylib                    0x0000000102a3d171 luaD_precall + 426
12  liblua.dylib                    0x0000000102a47c6e luaV_execute + 1862
13  liblua.dylib                    0x0000000102a3d467 luaD_call + 66
14  liblua.dylib                    0x0000000102a3ccc5 luaD_rawrunprotected + 86
15  liblua.dylib                    0x0000000102a3d84e luaD_pcall + 51
16  liblua.dylib                    0x0000000102a39f13 lua_pcallk + 118
17  liblua.dylib                    0x0000000102a4ae00 luaB_pcall + 76
18  liblua.dylib                    0x0000000102a3d171 luaD_precall + 426
19  liblua.dylib                    0x0000000102a47c6e luaV_execute + 1862
20  liblua.dylib                    0x0000000102a3d467 luaD_call + 66
21  liblua.dylib                    0x0000000102a3ccc5 luaD_rawrunprotected + 86
22  liblua.dylib                    0x0000000102a3d84e luaD_pcall + 51
23  liblua.dylib                    0x0000000102a39f13 lua_pcallk + 118
24  libqtlua.dylib                  0x000000010b1552c3 QtLua::ValueBase::call(QtLua::ValueBase::List const&) const + 995
25  libqtlua.dylib                  0x000000010b11a7ec QtLua::QObjectWrapper::qt_metacall(QMetaObject::Call, int, void**) + 1452
26  libqtlua.dylib                  0x000000010b11a99b non-virtual thunk to QtLua::QObjectWrapper::qt_metacall(QMetaObject::Call, int, void**) + 59
27  org.qt-project.QtCore           0x0000000102ff1ec0 QMetaObject::activate(QObject*, int, int, void**) + 2816
28  org.qt-project.QtWidgets        0x0000000103d1af50 QAbstractButton::clicked(bool) + 64
29  org.qt-project.QtWidgets        0x0000000103a7053a QAbstractButtonPrivate::emitClicked() + 58
30  org.qt-project.QtWidgets        0x0000000103a703a7 QAbstractButtonPrivate::click() + 263
31  org.qt-project.QtWidgets        0x0000000103a713de QAbstractButton::mouseReleaseEvent(QMouseEvent*) + 270
32  org.qt-project.QtWidgets        0x00000001039cb85b QWidget::event(QEvent*) + 1675
33  org.qt-project.QtWidgets        0x0000000103a71133 QAbstractButton::event(QEvent*) + 179
34  org.qt-project.QtWidgets        0x000000010398b713 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 307
35  org.qt-project.QtWidgets        0x000000010398eec1 QApplication::notify(QObject*, QEvent*) + 9233
36  org.qt-project.QtCore           0x0000000102fbf253 QCoreApplication::notifyInternal(QObject*, QEvent*) + 115
37  org.qt-project.QtWidgets        0x000000010398c0c4 QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) + 1012
38  org.qt-project.QtWidgets        0x00000001039e6906 QWidgetWindow::handleMouseEvent(QMouseEvent*) + 1190
39  org.qt-project.QtWidgets        0x00000001039e5b5f QWidgetWindow::event(QEvent*) + 111
40  org.qt-project.QtWidgets        0x000000010398b713 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 307
41  org.qt-project.QtWidgets        0x000000010398eb15 QApplication::notify(QObject*, QEvent*) + 8293
42  org.qt-project.QtCore           0x0000000102fbf253 QCoreApplication::notifyInternal(QObject*, QEvent*) + 115
43  org.qt-project.QtGui            0x00000001033a5260 QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) + 2032
44  org.qt-project.QtGui            0x00000001033914ba QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 346
45  libqcocoa.dylib                 0x000000010777c941 QCocoaEventDispatcherPrivate::postedEventsSourceCallback(void*) + 33
46  com.apple.CoreFoundation        0x00007fff9538ea01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
47  com.apple.CoreFoundation        0x00007fff95380b8d __CFRunLoopDoSources0 + 269
48  com.apple.CoreFoundation        0x00007fff953801bf __CFRunLoopRun + 927
49  com.apple.CoreFoundation        0x00007fff9537fbd8 CFRunLoopRunSpecific + 296
50  com.apple.HIToolbox             0x00007fff8c0a656f RunCurrentEventLoopInMode + 235
51  com.apple.HIToolbox             0x00007fff8c0a61ee ReceiveNextEventCommon + 179
52  com.apple.HIToolbox             0x00007fff8c0a612b _BlockUntilNextEventMatchingListInModeWithFilter + 71
53  com.apple.AppKit                0x00007fff8ed9a9bb _DPSNextEvent + 978
54  com.apple.AppKit                0x00007fff8ed99f68 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 346
55  com.apple.AppKit                0x00007fff8ed8fbf3 -[NSApplication run] + 594
56  libqcocoa.dylib                 0x000000010777b89a QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 2266
57  org.qt-project.QtCore           0x0000000102fbca3c QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 396
58  org.qt-project.QtWidgets        0x0000000103b72d1a QDialog::exec() + 522
59  org.qt-project.QtWidgets        0x0000000103b74608 QDialog::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) + 360
60  org.qt-project.QtWidgets        0x0000000103b74775 QDialog::qt_metacall(QMetaObject::Call, int, void**) + 85
61  libqtlua.dylib                  0x000000010b1050db QtLua::Method::meta_call(QtLua::State*, QtLua::ValueBase::List const&) + 2379
62  libqtlua.dylib                  0x000000010b13b4e2 QtLua::State::lua_meta_item_call(lua_State*) + 562
63  liblua.dylib                    0x0000000102a3d171 luaD_precall + 426
64  liblua.dylib                    0x0000000102a47c6e luaV_execute + 1862
65  liblua.dylib                    0x0000000102a3d467 luaD_call + 66
66  liblua.dylib                    0x0000000102a39e80 lua_callk + 73
67  terrame                         0x0000000101240f2a main + 1082
68  libdyld.dylib                   0x00007fff8b96f5c9 start + 1
avancinirodrigo commented 6 years ago

@pedro-andrade-inpe, Please, add a code to reproduce that.

pedro-andrade-inpe commented 6 years ago
singleFooAgent = Agent{
    execute = function(self)
        if Random{p = 0.05}:sample() then
            self:reproduce()
            self:die()
        end
    end
}

soc = Society{
    instance = singleFooAgent,
    quantity = 100
}

cs = CellularSpace{
    xdim = 20
}

e = Environment{cs, soc}

e:createPlacement{max = 5}

m = Map{target = soc}

t = Timer{
    Event{action = soc},
    Event{action = m}
}

t:run(100)