News:

We really need your input in this questionnaire

Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - tolimanjo

#1
Hi there,

I'm getting a segfault on server 4.3.3 (Debian) when using PushDCIData() in a transform script. If the DCI I'm pushing to has 'Save only changed values' enabled, then a segfault occurs.

I haven't been able to reproduce this behavior on a test platform, so can't rule out something else being the cause of the problem. Curiously, the fault only occurs after a restart of the server.

Thread 33 "$DATACOLL/WRK" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff04b0700 (LWP 8118)]
DCItem::processNewValue (this=0x7ffe2f3a7410, tmTimeStamp=tmTimeStamp@entry=1680668319, originalValue=originalValue@entry=0x7ffc8bcad844 L"20", updateStatus=0x7ffff04a9b97) at dcitem.cpp:698
698    dcitem.cpp: No such file or directory.
(gdb) bt
#0  DCItem::processNewValue (this=0x7ffe2f3a7410, tmTimeStamp=tmTimeStamp@entry=1680668319, originalValue=originalValue@entry=0x7ffc8bcad844 L"20", updateStatus=0x7ffff04a9b97) at dcitem.cpp:698
#1  0x00007ffff7c18dee in DataCollectionTarget::processNewDCValue (this=this@entry=0x7ffe2ef49010, dcObject=std::shared_ptr<DCObject> (use count 2, weak count 0) = {...}, currTime=currTime@entry=1680668319,
    itemValue=0x7ffc8bcad844 L"20", tableValue=std::shared_ptr<Table> (empty) = {...}) at /usr/include/c++/8/bits/shared_ptr_base.h:1018
#2  0x00007ffff7beb450 in F_PushDCIData (argc=<optimized out>, argv=0x7ffc8bc15400, ppResult=0x7ffff04a9c50, vm=0x7ffc8bc42000) at /usr/include/c++/8/bits/shared_ptr_base.h:614
#3  0x00007ffff7a20547 in NXSL_VM::callExternalFunction (stackItems=3, function=<optimized out>, this=0x7ffc8bc42000) at ../../include/nxsl_classes.h:201
#4  NXSL_VM::callExternalFunction (this=0x7ffc8bc42000, function=<optimized out>, stackItems=3) at vm.cpp:2675
#5  0x00007ffff7a24ea7 in NXSL_VM::execute (this=0x7ffc8bc42000) at vm.cpp:1411
#6  0x00007ffff7a297c8 in NXSL_VM::run (this=this@entry=0x7ffc8bc42000, args=..., globals=globals@entry=0x0, expressionVariables=expressionVariables@entry=0x0, constants=constants@entry=0x0, entryPoint=entryPoint@entry=0x0)
    at vm.cpp:391
#7  0x00007ffff7a29c42 in NXSL_VM::run (this=this@entry=0x7ffc8bc42000, argc=argc@entry=1, argv=argv@entry=0x7ffff04aa040, globals=globals@entry=0x0, expressionVariables=expressionVariables@entry=0x0, constants=constants@entry=0x0,
    entryPoint=0x0) at vm.cpp:321
#8  0x00007ffff7c10dca in DCTable::transform (this=this@entry=0x7ffe2f140610, value=std::shared_ptr<Table> (use count 2, weak count 0) = {...}) at ../../../include/nxsl_classes.h:1427
#9  0x00007ffff7c116e9 in DCTable::processNewValue (this=0x7ffe2f140610, timestamp=timestamp@entry=1680668319, value=std::shared_ptr<Table> (use count 2, weak count 0) = {...}, updateStatus=updateStatus@entry=0x7ffff04aa527)
    at dctable.cpp:357
#10 0x00007ffff7c18d9c in DataCollectionTarget::processNewDCValue (this=0x7ffe2ef49010, dcObject=std::shared_ptr<DCObject> (use count 2, weak count 0) = {...}, currTime=currTime@entry=1680668319,
    itemValue=itemValue@entry=0x7ffff04aad60 L"", tableValue=std::shared_ptr<Table> (use count 2, weak count 0) = {...}) at /usr/include/c++/8/bits/shared_ptr_base.h:1018
#11 0x00007ffff7be49c8 in DataCollector (dcObject=std::shared_ptr<DCObject> (use count 2, weak count 0) = {...}) at /usr/include/c++/8/bits/shared_ptr_base.h:762
#12 0x00007ffff7c22afa in __ThreadPoolExecute_SharedPtr_Wrapper<DCObject> (arg=0x7ffc8c000020) at ../../../include/nms_threads.h:990
#13 0x00007ffff794c21e in ProcessSerializedRequests (data=0x7ffc8c00b050) at tp.cpp:487
#14 0x00007ffff794c066 in WorkerThread (threadInfo=0x7fffeb5b15b0) at tp.cpp:199
#15 0x00007ffff794de4a in ThreadCreate_Wrapper_1<WorkerThreadInfo*> (context=0x7fffeb5b15c0) at ../../include/nms_threads.h:536
#16 0x00007ffff779ffa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
#17 0x00007ffff6ec206f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb)
#2
Trying to do a transformation on a trap parameter. Have tried doing it this way:

oid = $1;
status = $2;
newStatus = "unknown";

switch (status)
{
   case "1"
      newStatus = "up";
      break;
   case "2":
      newStatus = "down";
      break;
}

return %(oid, newStatus);


It doesn't appear to work though, so how should I reference (and return) the parameter values?

Thanks.