Menu

#156 Segfault when accessing `e1` and `e2` field of Msg

async13
open
nobody
None
5
2015-02-10
2015-02-10
dilawars
No

Following snippet loads a kinekit model and prints sources and destinations of each message:

~~~~~~~~~
import pylab
import moose
import numpy as np

Import all helper functions.

modelFile = './stargazin_synapse.g'
modelPathInMoose = 'model'
method = 'old_gssa'
modelId = moose.loadModel(modelFile, modelPathInMoose, method)
msgs = moose.wildcardFind('/##[TYPE=OneToAllMsg]')

for m in msgs:
try: print m.e1
except: pass
try: print m.e2
except: pass

This does not

for m in msgs:
print m.e1, m.e2
~~~~~~~

Function Msg::getE1 in Msg.cpp cause seg-fault because data-member e1_ is a garbage value (sometimes NULL).

1 Attachments

Discussion

  • dilawars

    dilawars - 2015-02-10

    Probably Eref::data() is returning NULL

    Breakpoint 1, GetOpFunc<Msg, Id>::returnOp (this=0xa9f2c0, e=...)
        at /public/dilawars/moose3.0.1/basecode/OpFunc.h:146
    146             return ( reinterpret_cast< T* >( e.data() )->*func_)();
    4: e = (const Eref &) @0x7fffffffd100: {
      e_ = 0xba55f0, 
      i_ = 17, 
      f_ = 0
    }
    3: e.data() = 0x14cc8d0 "\260?\242\365\377\177"
    (gdb) 
    Continuing.
    <moose.vec: class=CubeMesh, id=414, path=/model[0]/kinetics>
    
    Breakpoint 1, GetOpFunc<Msg, Id>::returnOp (this=0xa9f2c0, e=...)
        at /public/dilawars/moose3.0.1/basecode/OpFunc.h:146
    146             return ( reinterpret_cast< T* >( e.data() )->*func_)();
    4: e = (const Eref &) @0x7fffffffd100: {
      e_ = 0xba57f0, 
      i_ = 0, 
      f_ = 0
    }
    3: e.data() = 0x0
    (gdb) print e
    $4 = (const Eref &) @0x7fffffffd100: {
      e_ = 0xba57f0, 
      i_ = 0, 
      f_ = 0
    }
    
     
  • dilawars

    dilawars - 2015-02-10

    Seg-fault only on MsgType 'OneToAllMsg'. Msg 'OneToOne' are acting as expected.

     

Anonymous
Anonymous

Add attachments
Cancel