diff --git a/plugins/inputs/opcua/opcua_client.go b/plugins/inputs/opcua/opcua_client.go index 7654887387ef2..8a5d8a58bc97b 100644 --- a/plugins/inputs/opcua/opcua_client.go +++ b/plugins/inputs/opcua/opcua_client.go @@ -407,7 +407,9 @@ func Connect(o *OpcUA) error { if o.client != nil { if err := o.client.CloseSession(); err != nil { - return err + // Only log the error but to not bail-out here as this prevents + // reconnections for multiple parties (see e.g. #9523). + o.Log.Errorf("Closing session failed: %v", err) } } diff --git a/plugins/inputs/opcua/opcua_client_test.go b/plugins/inputs/opcua/opcua_client_test.go index b509d2eaf67a3..4c7805578b114 100644 --- a/plugins/inputs/opcua/opcua_client_test.go +++ b/plugins/inputs/opcua/opcua_client_test.go @@ -8,6 +8,7 @@ import ( "github.com/influxdata/telegraf/config" "github.com/influxdata/telegraf/testutil" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -44,7 +45,6 @@ func TestClient1Integration(t *testing.T) { o.SecurityPolicy = "None" o.SecurityMode = "None" o.Log = testutil.Logger{} - for _, tags := range testopctags { o.RootNodes = append(o.RootNodes, MapOPCTag(tags)) }