Skip to content

Alarm Tree breaks on duplicate PVs with slashes #3612

@kristjansoln

Description

@kristjansoln

The Alarm Tree view allows adding either nodes or PVs as components. When PV names include forward slashes / and duplicates, certain combinations can:

  • throw an IllegalStateException in Phoebus,
  • make the alarm server appear disconnected, and
  • sometimes cause an Unknown alarm tree node error on the alarm server.

How to reproduce

IllegalStateException in Phoebus

  1. Start with an empty alarm configuration, open the Alarm Tree view, and create a new node
  2. Create new PVs by right-clicking the node, selecting Add component, choosing type PV/s, and entering testpv //testpv in the name box.
Image

Instead of two, this adds just one PV: testpv.

Image

Closing and reopening the Alarm Tree view then throws an exception, and the alarm server appears disconnected:

Exception in thread "JavaFX Application Thread" java.lang.IllegalStateException: Found existing view item for /Accelerator/node1/testpv
	at org.phoebus.applications.alarm.ui.tree.AlarmTreeView.createViewItem(AlarmTreeView.java:308)
	at org.phoebus.applications.alarm.ui.tree.AlarmTreeView.createViewItem(AlarmTreeView.java:312)
	at org.phoebus.applications.alarm.ui.tree.AlarmTreeView.createViewItem(AlarmTreeView.java:312)
	at org.phoebus.applications.alarm.ui.tree.AlarmTreeView.lambda$startup$3(AlarmTreeView.java:214)
	at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:456)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:455)
	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
	at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$10(GtkApplication.java:263)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Image

Unknown alarm tree node exception in the alarm server

Following the same steps, but entering testpv ///testpv/ in the PV name box, adds three PVs: //testpv/, /testpv/ and testpv.

Image Image

Attempting to acknowledge the /testpv/ alarm causes an Unknown alarm tree node exception on the alarm server.

 2025-10-30 15:19:47 WARNING [org.phoebus.applications.alarm.server.AlarmServerMain handleCommand] Error for command. path: '/Accelerator/node1/testpv\/', JSON: '{"user":"user","host":"hostname","command":"acknowledge"}'
 java.lang.Exception: Unknown alarm tree node '/Accelerator/node1/testpv\/'
   at org.phoebus.applications.alarm.server.AlarmServerMain.handleCommand(AlarmServerMain.java:352)
   at org.phoebus.applications.alarm.server.ServerModel.checkUpdates(ServerModel.java:237)
   at org.phoebus.applications.alarm.server.ServerModel.run(ServerModel.java:146)
   at java.base/java.lang.Thread.run(Thread.java:1583)

Importing alarm server configuration directly

Identical results occur when importing the configuration directly, e.g.:

java -jar "service-alarm-server-5.0.3-SNAPSHOT.jar" -import $config_file -config "Accelerator"

<?xml version="1.0" encoding="UTF-8"?>
<config name="Accelerator">
  <component name="test">
    <pv name="//testpv">
      <description>desc1</description>
      <enabled>true</enabled>
      <latching>true</latching>
      <annunciating>true</annunciating>
    </pv>
    <pv name="testpv">
      <description>desc2</description>
      <enabled>true</enabled>
      <latching>true</latching>
      <annunciating>true</annunciating>
    </pv>
  </component>
</config>
<?xml version="1.0" encoding="UTF-8"?>
<config name="Accelerator">
  <component name="test">
    <pv name="///testpv/">
      <description>desc1</description>
      <enabled>true</enabled>
      <latching>true</latching>
      <annunciating>true</annunciating>
    </pv>
    <pv name="testpv">
      <description>desc2</description>
      <enabled>true</enabled>
      <latching>true</latching>
      <annunciating>true</annunciating>
    </pv>
  </component>
</config>

As expected, exporting the just-imported configuration with java -jar "service-alarm-server-5.0.3-SNAPSHOT.jar" -export $output_file produces output that does not match the input configuration.

<?xml version="1.0" encoding="UTF-8"?>
<config name="Accelerator">
  <component name="test">
    <pv name="/testpv">
      <description>desc1</description>
      <enabled>true</enabled>
      <latching>true</latching>
      <annunciating>true</annunciating>
    </pv>
    <pv name="testpv">
      <description>desc2</description>
      <enabled>true</enabled>
      <latching>true</latching>
      <annunciating>true</annunciating>
    </pv>
  </component>
</config>
<?xml version="1.0" encoding="UTF-8"?>
<config name="Accelerator">
  <component name="test">
    <pv name="//testpv/">
      <description>desc1</description>
      <enabled>true</enabled>
      <latching>true</latching>
      <annunciating>true</annunciating>
    </pv>
    <pv name="/testpv/">
      <description>/testpv/</description>
      <enabled>true</enabled>
      <latching>true</latching>
      <annunciating>true</annunciating>
    </pv>
    <pv name="testpv">
      <description>desc2</description>
      <enabled>true</enabled>
      <latching>true</latching>
      <annunciating>true</annunciating>
    </pv>
  </component>
</config>

Discussion

I am not exactly sure what breaks, and I'd appreciate some insight. Should alarm configuration inputs be sanitized more aggressively? While the malformed configuration seems to affect only the Alarm Tree UI, it can leave users unable to access or correct the components they created, which can make recovery difficult. Maybe it would be better to reject or normalize PV names at input time to avoid these failures. Can we even reject PV entries with slashes outright, due to them being used to access fields in PVA structures?

This was tested using commit 1a6e90f on the master branch, with Kafka 2.13-4.1.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions