[rsyslog] Losing UDP packages

Dražen Kačar dave at fly.srk.fer.hr
Mon Dec 27 18:19:41 CET 2010


Rainer Gerhards wrote:
> I just committed the functionality:
> 
> http://git.adiscon.com/?p=rsyslog.git;a=commitdiff;h=cc8237736d11b54a3d6089d8
> 36da7ccb6972a29c

There is a serious flaw there. The pthread_setschedparam() function is
being called by the main thread before other threads are created, so all
threads will inherit the scheduling parameters, which we don't want. That
call has to be moved from willRun() function to the rcvMainLoop() which is
being executed by a new thread so it will afect the UDP thread only. You
can check this with:

   ps -eLo "cmd lwp policy rtprio"

I'm attaching a patch which does that, against rsyslog 5.6.2. (After
applying you need to call autoreconf). It also has improved validation.
Note that the allowed scheduling priority range is OS specific, so the
code shouldn't expect that it will be non-negative.

I think that the better way to implement this feature would be to add
pthread_attr_t * as an argument to the willRun() functions in order to
allow them to change the thread properties. Scheduling properties can be
set with pthread_attr_setschedpolicy() and pthread_attr_setschedparam(),
for example.

> Note that I am far from being an autotools expert, so I would appreciate if
> you could provide proper configure checks. I did only a very rough test of
> the functionality.

Included in the patch.

-- 
 .-.   .-.    Yes, I am an agent of Satan, but my duties are largely
(_  \ /  _)   ceremonial.
     |
     |        dave at fly.srk.fer.hr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rsyslog-imudp-setschedparam.diff
Type: text/x-diff
Size: 7315 bytes
Desc: not available
URL: <http://lists.adiscon.net/pipermail/rsyslog/attachments/20101227/6e89052f/attachment.diff>


More information about the rsyslog mailing list