tango-controls-hdbpp / hdbpp-configurator

HDB++ Configurator GUI and java device server. Moved to https://gitlab.com/tango-controls/hdbpp/hdbpp-configurator
1 stars 1 forks source link

hdbpp-configurator-3.5: Java Exception when removing archived attribute #2

Closed sblanchet closed 6 years ago

sblanchet commented 6 years ago

Java exception occurs when removing archived attribute.

How to reproduce?

Exception in thread "AWT-EventQueue-1" java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1927) at org.tango.hdb_configurator.common.TangoUtils.checkFQDN(TangoUtils.java:143) at org.tango.hdb_configurator.common.TangoUtils.fullName(TangoUtils.java:127) at org.tango.hdb_configurator.common.ArchiverUtils.getArchiver(ArchiverUtils.java:296) at org.tango.hdb_configurator.configurator.ManageAttributes.changeAttributeStates(ManageAttributes.java:272) at org.tango.hdb_configurator.configurator.ManageAttributes.pauseAttributes(ManageAttributes.java:239) at org.tango.hdb_configurator.configurator.HdbConfigurator$ListPopupMenu.menuActionPerformed(HdbConfigurator.java:1637) at org.tango.hdb_configurator.configurator.HdbConfigurator$ListPopupMenu.access$3100(HdbConfigurator.java:1519) at org.tango.hdb_configurator.configurator.HdbConfigurator$ListPopupMenu$1.actionPerformed(HdbConfigurator.java:1542) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.AbstractButton.doClick(AbstractButton.java:376) at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:842) at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:886) at java.awt.Component.processMouseEvent(Component.java:6533) at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) at java.awt.Component.processEvent(Component.java:6298) at java.awt.Container.processEvent(Container.java:2238) at java.awt.Component.dispatchEventImpl(Component.java:4889) at java.awt.Container.dispatchEventImpl(Container.java:2296) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4897) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4534) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4475) at java.awt.Container.dispatchEventImpl(Container.java:2282) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90) at java.awt.EventQueue$4.run(EventQueue.java:733) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.awt.EventQueue.dispatchEvent(EventQueue.java:730) at org.GNOME.Accessibility.AtkWrapper$5.dispatchEvent(AtkWrapper.java:700) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

bourtemb commented 6 years ago

This bug seems to occur with your current network configuration. When rapidly looking at the line where the problem occurs, it seems like the GUI is trying to get the FQDN of the HDB++ subscriber Tango device responsible for the attribute which needs to be removed. The method where the issue occurs is trying to find a '.' in the host name (obtained using InetAddress.getByName(host).getCanonicalHostName()) of the TANGO_HOST where this subscriber is exported and it looks like there is no '.' in this name. It looks like there is no domain name associated with the host where is running your tango database. Are you using something like localhost:10000 as TANGO_HOST? As a workaround, I would suggest to configure your network such as InetAddress.getByName(host).getCanonicalHostName()) can return something with a domain in it. It's probably a matter of configuring your operating system to get the domain name.

Something like that in /etc/hosts for instance (but there might be more to do, like services to restart or other configuration files to modify): 127.0.0.1 localhost.localdomain localhost 192.168.0.2 host1 host1.domain.com

Hoping this helps a bit, Reynald

sblanchet commented 6 years ago

You are right. I was using TANGO_HOST=localhost:10000 I have replaced with TANGO_HOST=localhost.localdomain:10000 and now it works without issue.

Ideally, hdbpp-configurator may print a warning when TANGO_HOST is not a FQDN to avoid this pitfall.

Pascal-Verdier commented 6 years ago

Hi This problem seems to be linked with a bad network configuration. The local domain is not supposed to come from your TANGO_HOST variable but from the InetAddress.getByName(host).getCanonicalHostName() system call. If this call does not return a FQDN host name, the event system is not fully working. Regards Pascal