powered by Jive Software

Race condition on Whack/Tinder startup


#1

Hi,

I’m using Whack & Tinder to create an external component and have discovered a race condition on initial startup.

It appears that the packet processing executor pool is actually started before the AbstractComponent’s ‘preComponentStart()’ method is called.

I’ve tracked this back to here:

/**
           * Initialize the abstract component.
           *            * @see org.xmpp.component.Component#initialize(org.xmpp.packet.JID,
           *      org.xmpp.component.ComponentManager)
           */
          public final void initialize(final JID jid, final ComponentManager componentManager)
                              throws ComponentException {
                    compMan = componentManager;
                    this.jid = jid;
    // start the executor service.
                    startExecutor();
          }

I’m thinking that this should simply call ‘start()’, which would in turn start the executor; here:

/**
           * Default implementation of the start() method of the {@link Component}
           * interface. Unless overridden, this method doesn't do anything. We get
           * called once for each host that we connect to, so we have to take care to
           * avoid double initialization.
           */
          public void start() {
                    preComponentStart();   // reset the 'last activity' timestamp.
                    lastStartMillis = System.currentTimeMillis();
    // start the executor service.
                    startExecutor();
                      postComponentStart();
          }

Any thoughts? Possible to include with the next release?

Thanks,

DD