If an OPC tag within a UDT, is referenced else where within same UDT via an Expression Tag, when the UDT is deleted the OPC subscription remains and can only be removed by resting the gateway, if the Expression references two other OPC Tags, the OPC subscription for both are abandoned.
The expression in this case is just a test of quality and value before returning the value or zero.
I can provide a small example project if needed.
What version of Ignition did you test this on?
I tested this in the latest 8.0.7 Nightly just before posting, we get the same results in 8.0.5 too.
I have attached is a link to a gateway backup of small project to demonstrate the issue, basically there is a UDT and a window with couple of buttons that create and delete an instance of the UDT, if you watch the device status page whist clicking the create button you will see three tags added to the device tag count, when the delete button clicked only two of the tags will be removed from the tag count, the remaining one is referenced by an Expression tag and cannot be removed, I have tried restarting the OPC UA module, disabling the tag provider and even restarting the OPC module whilst the tag provider is disabled, but nothing short of restarting the gateway seems to get rid of the abandoned item.