[Bro-Dev] [JIRA] (BIT-1408) Broker I/O loop issue

Robin Sommer (JIRA) jira at bro-tracker.atlassian.net
Wed Jun 3 09:55:00 PDT 2015


    [ https://bro-tracker.atlassian.net/browse/BIT-1408?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20915#comment-20915 ] 

Robin Sommer commented on BIT-1408:
-----------------------------------

instead of moving the fd_set pieces into PktSrc, what do you think of this:

{code}
+++ b/src/iosource/Manager.cc
@@ -118,9 +118,17 @@ IOSource* Manager::FindSoonest(double* ts)

                src->Clear();
                src->src->GetFds(&src->fd_read, &src->fd_write, &src->fd_except);
-               if ( src->fd_read.Empty() ) src->fd_read.Insert(0);
-               if ( src->fd_write.Empty() ) src->fd_write.Insert(0);
-               if ( src->fd_except.Empty() ) src->fd_except.Insert(0);
+
+               if ( Size() )
+                       {
+                       // TODO: This seems like a hack that should be removed, but doing so
+                       // causes the main run loop to spin more frequently and increase cpu usage.
+                       // See also commit 9cd85be308.
+                       if ( src->fd_read.Empty() ) src->fd_read.Insert(0);
+                       if ( src->fd_write.Empty() ) src->fd_write.Insert(0);
+                       if ( src->fd_except.Empty() ) src->fd_except.Insert(0);
+                       };
+
{code}

That passes the test-suite as well as Johanna's script.

> Broker I/O loop issue
> ---------------------
>
>                 Key: BIT-1408
>                 URL: https://bro-tracker.atlassian.net/browse/BIT-1408
>             Project: Bro Issue Tracker
>          Issue Type: Problem
>          Components: Broker
>            Reporter: Robin Sommer
>             Fix For: 2.4
>
>         Attachments: patch.txt
>
>
> This script from Johanna doesn't terminate:
> {code}
> redef exit_only_after_terminate = T;
> event terminate_me() {
>         print "terminating";
>         terminate();
> }
> event bro_init() {
>         BrokerComm::enable();
>         schedule 1sec { terminate_me() };
> }
> {code}
> It works once the {{enable()}} call is removed.
> Attached patch seems solve the problem, but it might not be quite the right fix, not sure yet.



--
This message was sent by Atlassian JIRA
(v6.5-OD-05-041#65001)


More information about the bro-dev mailing list