2016-12-23 16:14 GMT+01:00 Bob Gregory <[email protected]>:

> Hey all,
>
> I'm working on the riemann module, and I've hit a problem.
>
> I'm trying to use MsgGetProp to fetch data from the incoming message, in
> the same way as ommongodb, but I'm getting a segfault during the obj_type
> check.
>
>
> BEGINdoAction_NoStrings
> CODESTARTdoAction
>   uchar* propVal;
>   msgPropDescr_t propinfo;
>
>   short unsigned fieldfree;
>   rs_size_t fieldlen;
>
>   pthread_mutex_lock(&mutDoAct);
>
>   propinfo.id = PROP_HOSTNAME;
>
>   dbgprintf("ho ho. reproduce\n");
>   // explodes here.
>   propVal = MsgGetProp(pMsgData, NULL, &propinfo, &fieldlen, &fieldfree,
> NULL);
>
>   dbgprintf("got it\n");
>   finalize_it:
> pthread_mutex_unlock(&mutDoAct);
> ENDdoAction
>
>
> Narrowing it down further:
>
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib64/libthread_db.so.1".
> Core was generated by `rsyslogd -dn -f test-conf/rsyslog-segfault.conf'.
> Program terminated with signal 11, Segmentation fault.
> #0  0x000000000043b263 in GetString (pThis=0x69d3ac <Debug>,
> ppsz=0x7fdf7ef3b898, plen=0x7fdf7ef3b894) at prop.c:108
> 108 ISOBJ_TYPE_assert(pThis, prop);
>
>
> (gdb) backtrace
> #0  0x000000000043b263 in GetString (pThis=0x69d3ac <Debug>,
> ppsz=0x7fdf7ef3b898, plen=0x7fdf7ef3b894) at prop.c:108
> #1  0x000000000041a454 in getHOSTNAME (pM=0x7fdf7ef3b9f0) at msg.c:2489
> #2  0x000000000041c7b8 in MsgGetProp (pMsg=pMsg@entry=0x7fdf7ef3b9f0,
> pTpe=pTpe@entry=0x0, pProp=pProp@entry=0x7fdf7ef3b9b0,
> pPropLen=pPropLen@entry=0x7fdf7ef3b9ac,
> pbMustBeFreed=pbMustBeFreed@entry=0x7fdf7ef3b9aa,
> ttNow=ttNow@entry=0x0)
>     at msg.c:3408
> #3  0x00007fdf828c97f9 in doAction (pMsgData=0x7fdf7ef3b9f0,
> pWrkrData=0x7fdf70002080) at omriemann.c:179
> #4  0x0000000000440c54 in actionCallDoAction (pWti=0x8644d0,
> iparams=<optimized out>, pThis=0x861d30) at ../action.c:1131
>
>
> Any idea how I can start debugging this? It seems like the prop_t that's
> setup by resolvedns is not properly initialized?
>

I am almost out for holiday break. I tried to check the code and also think
this has something to do with the hostname property. However, I wonder why
this occurs. Does the same problem occur if you write a file? I ask because
the property is obviously the same. This should be one of the best-tested
areas of rsyslog, so I am really puzzled...

oh wait, I see you do not dereference pMsgData. That's an array, and you
need to access the proper message pointers. This is what ommongodb does:

doc = getDefaultBSON(*(smsg_t**)pMsgData);

Rainer
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of 
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE 
THAT.

Reply via email to