[Bro-Dev] [JIRA] (BIT-1547) broctl sets the same state variables over and over

Justin Azoff (JIRA) jira at bro-tracker.atlassian.net
Fri Mar 4 15:00:00 PST 2016


Justin Azoff created BIT-1547:
---------------------------------

             Summary: broctl sets the same state variables over and over
                 Key: BIT-1547
                 URL: https://bro-tracker.atlassian.net/browse/BIT-1547
             Project: Bro Issue Tracker
          Issue Type: Problem
          Components: BroControl
    Affects Versions: git/master
            Reporter: Justin Azoff
            Assignee: Daniel Thayer


I happened to notice broctl check on one of our test boxes was slow.  traced it to sqlite commits() being very slow.  Then noticed that broctl seems to call set_state() with the same key, val over and over again... once for each worker.. so a few thousand sets just to run broctl check.

Changing set_state to

{code}
    # Set a dynamic state variable.
    def set_state(self, key, val):
        key = key.lower()
        if self.state.get(key) == val:
            return
        self.state[key] = val
        self.state_store.set(key, val)
{code}

Seemed to mostly fix it, aside from this:

{code}
Set manager-port to 47760
Set manager-port to 47761
Set manager-port to 47760
Set manager-port to 47761
Set manager-port to 47760
Set manager-port to 47761
Set manager-port to 47760
Set manager-port to 47761
Set manager-port to 47760
Set manager-port to 47761
Set manager-port to 47760
Set manager-port to 47761
{code}

any idea why that is flipping around like that?

We should possibly add a way for broctl to update state vars without calling commit where it knows it will be setting a large number of state vars in a loop.



--
This message was sent by Atlassian JIRA
(v7.2.0-OD-03-010#72000)


More information about the bro-dev mailing list