Partial registration of external component

Hi there,

An external component of ours was unable to register after restart of the server, and repeatedly produced the message:

2006.11.27 11:39:58 Starting registration of new external component for domain: voice.nimbuzz.com

2006.11.27 11:39:58 Another component is already using domain: voice.nimbuzz.com

in our logs. In other words, the domain requested was already taken. This is written by ComponentSession.java if InternalComponentManager.java contains the requested component name.

These requested component names are only written in the method addComponent(). Now, in this method an exception is caught, then thrown, but the name is not removed. This seems a bit like a bug, since it will allow a halfway registration to occur, where InternalComponentManager thinks a subdomain is taken, while there is no component session active.

Any thoughts?

Frank

Hey Frank,

Thanks much for pointing that out. I heard about that error but was never able to reproduce it. Good catch. JM-902

Regards,

– Gato

Hi Dombiak,

Thanks!

Two related issues:

  • I have also noticed this problem with an internal component that threw exceptions in its initialization routines (in this case it was in the Component’‘s .start() method, a nullpointer, d’'oh). Right now the check only happens on catching a ComponentException. While I dislike the idea, should that be a catch-all?

  • Lastly, I’‘ve also managed to track down a problem where a component we use tries to register for one second, then closes the socket and tries again. We’‘ve beaten the developer with a stick and he’‘s reduced the reconnect time and upped the waiting time to something more realistic. What happened, though, was that we first got the message that the domain was already taken (twice, in fact) from later attempts, and a little later Wildfire realized that the component session hadn’'t connected (IIRC, “Connection closed before session established”). The domain remained taken.

Possible solutions to avoid the latter that I’'ve seen looking at the code:

  • Do not open the external component connection socket until Wildfire is mostly started up.

  • If the socket of a component session, even an unestablished one, closes, removeComponent().

Hey Gato,

The issue with components registering has not yet been resolved. After upgrading our Wildfire installation two components went into the infinite ‘‘domain already in use’’ loop.

The cause is that the component session attempts to initialize before the start() method of InternalComponentManager has run. This causes the “serviceAddress” attribute to still be null, which causes any service discovery request to throw an Exception, which causes all the rest of our grief.

Full stack traces of two exceptions we get. The first one indicates that InternalComponentManager hasn’‘t initialized yet, and results in the domain still being registered. The second one shows that the socket doesn’'t close, which may also be problematic.

2006.11.30 14:09:22 [org.jivesoftware.wildfire.component.ComponentSession.createSession(ComponentSession.java:189)] An error occured while creating a ComponentSession
java.lang.IllegalArgumentException: Packet with no FROM address was received from component.
        at org.jivesoftware.wildfire.component.InternalComponentManager.sendPacket(InternalComponentManager.java:161)
        at org.jivesoftware.wildfire.component.InternalComponentManager.checkDiscoSupport(InternalComponentManager.java:365)
        at org.jivesoftware.wildfire.component.InternalComponentManager.addComponent(InternalComponentManager.java:128)
        at org.jivesoftware.wildfire.component.ComponentSession.createSession(ComponentSession.java:182)
        at org.jivesoftware.wildfire.net.ComponentSocketReader.createSession(ComponentSocketReader.java:116)
        at org.jivesoftware.wildfire.net.SocketReader.createSession(SocketReader.java:469)
        at org.jivesoftware.wildfire.net.BlockingReadingMode.run(BlockingReadingMode.java:53)
        at org.jivesoftware.wildfire.net.SocketReader.run(SocketReader.java:123)
        at java.lang.Thread.run(Thread.java:595)
2006.11.30 14:09:22 [org.jivesoftware.wildfire.SessionManager$ComponentSessionListener.onConnectionClose(SessionManager.java:1
502)] Could not close socket
java.lang.StringIndexOutOfBoundsException: String index out of range: -2
        at java.lang.String.substring(String.java:1768)
        at org.jivesoftware.wildfire.SessionManager$ComponentSessionListener.onConnectionClose(SessionManager.java:1496)
        at org.jivesoftware.wildfire.net.SocketConnection.notifyCloseListeners(SocketConnection.java:637)
        at org.jivesoftware.wildfire.net.SocketConnection.close(SocketConnection.java:453)
        at org.jivesoftware.wildfire.component.ComponentSession.createSession(ComponentSession.java:191)
        at org.jivesoftware.wildfire.net.ComponentSocketReader.createSession(ComponentSocketReader.java:116)
        at org.jivesoftware.wildfire.net.SocketReader.createSession(SocketReader.java:469)
        at org.jivesoftware.wildfire.net.BlockingReadingMode.run(BlockingReadingMode.java:53)
        at org.jivesoftware.wildfire.net.SocketReader.run(SocketReader.java:123)
        at java.lang.Thread.run(Thread.java:595)

Message was edited by: fvschie

Hi,

I know gato was looking into this problem a while back. Anything interesting turn up?

Frank

(last bump for this thead. Plan B: Stalking mercilessly)

Hey Frank,

I changed InternalComponentManager to be a Module. It will now be started, initialized and stopped as the rest of the modules. That means that it will be initialized and started before the socket acceptor for external components is started. I also improved the #addComponent logic so that in the case of any exception that might happen after the component was added to the registered list the component will be removed.

I still need to check in the code. It may happen later today or probably tomorrow.

Thanks,

– Gato