Meta-data refresh is failed with error Failed to synchronize meta-data to local cache: constraint failed UNIQUE constraint failed: Device.NodeID, Device.Acronym

Hi,
When updating meta-data from publisher, failed with below error message, so we are not able to see all devices.
Exception Type: System.InvalidOperationException
Exception Message: Failed to synchronize meta-data to local cache: constraint failed
UNIQUE constraint failed: Device.NodeID, Device.Acronym

My query is, can we delete any partial record, which is not meeting UINQUE constrain in database?
Or
Do we have any way to recover from this problem?

Thanks & Regards
Logu

Looks like there’s already a local device with the same acronym, you can change the name of the local device. Can also try enabling prefixes in the STTP stream to help ensure unique names.

Ritchie

Hi Ritchie,
Please see the below scenario or environment.

Publisher: openHistorian 2.6
Subscriber: openHistorian 2.6

This version, I could not see STTP settings to update prefix. Updating prefix, will it create any new device with new point ID for its measurements? Because, if we change the name then old history data will not work right?

Please clarify and if you could provide screen that would be great.

Thanks & Regards
Logu

I keep forgetting you are using 2.6 - FYI, there have been several bug fixes to STTP, including one for the exception you are seeing:

Hi Ritchie,

Thanks for your information.
Currently, I’m facing this issue at my customer location. But I’m not able to replicate at my development environment.

Do we have any steps to replicate this issue? like adding or creating Acronym manually, so it will be helpful to replicate and give hot fix to customer.

Logu

I think the update to the code sample I showed you is fairly trivial, do you think you can do a new build of STTP with that fix?

I think we would need the pull the STTP version that you’re using that’s associated with the GSF version you’re using, the produce a build. Or we could take the latest version of STTP and build it with your GSF version, that way you would get all the latest bug fixes

I remember this bug fix being difficult to replicate as well, but using the logs from the customer location we were able to fix the issue.

Is it possible that we can get some of the log files out of the Logs folder to verify that this is the same issue?

Thanks,
Ritchie

The log files also might help us to create a replicatable condition.

Hi Ritchie,

Yes, I will share the log file soon.

My understanding was applying your code change at my local code (only for DataSubscriber.cs), but looks lot of code changes are done in new code base and totally different.

Is it possible to replace this new code or any way to give fix to our customer for time being? because soon we are going to roll out 2.8 once you provided.

Thanks & Regards
Logu

Yes I think we can help with that. Also, I’ve been assuming that you’re talking about STTP but is it possible that you could be using GEP?

Hi Ritchie,
Please see the below logs.

[4/19/2021 12:49:43 PM] (Inner Exception)
Date and Time: 4/19/2021 12:49:43 PM
Machine Name: OPENHIST-F1
Machine IP: 10.69.130.73
Machine OS: Microsoft Windows NT 6.2.9200.0

Application Domain: openHistorian.exe
Assembly Codebase: C:/Program Files/openHistorian/openHistorian.exe
Assembly Full Name: openHistorian, Version=2.6.30.2, Culture=neutral, PublicKeyToken=null
Assembly Version: 2.6.30.2
Assembly Build Date: 9/16/2019 1:14:56 PM
.Net Runtime Version: 4.0.30319.42000

Exception Source: System.Data.SQLite
Exception Type: System.Data.SQLite.SQLiteException
Exception Message: constraint failed
UNIQUE constraint failed: Device.NodeID, Device.Acronym
Exception Target Site: Reset

---- Stack Trace ----
System.Data.SQLite.SQLite3.Reset(stmt As SQLiteStatement)
openHistorian.exe: N 00452
System.Data.SQLite.SQLite3.Step(stmt As SQLiteStatement)
openHistorian.exe: N 00225
System.Data.SQLite.SQLiteDataReader.NextResult()
openHistorian.exe: N 00228
System.Data.SQLite.SQLiteDataReader…ctor(cmd As SQLiteCommand, behave As CommandBehavior)
openHistorian.exe: N 00317
System.Data.SQLite.SQLiteCommand.ExecuteReader(behavior As CommandBehavior)
openHistorian.exe: N 00060
System.Data.SQLite.SQLiteCommand.ExecuteNonQuery(behavior As CommandBehavior)
openHistorian.exe: N 00050
GSF.TimeSeries.Transport.DataSubscriber.SynchronizeMetadata()
openHistorian.exe: N 08117

(Outer Exception)
Date and Time: 4/19/2021 12:49:43 PM
Machine Name: OPENHIST-F1
Machine IP: 10.69.130.73
Machine OS: Microsoft Windows NT 6.2.9200.0

Application Domain: openHistorian.exe
Assembly Codebase: C:/Program Files/openHistorian/openHistorian.exe
Assembly Full Name: openHistorian, Version=2.6.30.2, Culture=neutral, PublicKeyToken=null
Assembly Version: 2.6.30.2
Assembly Build Date: 9/16/2019 1:14:56 PM
.Net Runtime Version: 4.0.30319.42000

Exception Source:
Exception Type: System.InvalidOperationException
Exception Message: Failed to synchronize meta-data to local cache: constraint failed
UNIQUE constraint failed: Device.NodeID, Device.Acronym

---- Stack Trace ----

[4/19/2021 12:52:54 PM] (Inner Exception)
Date and Time: 4/19/2021 12:52:54 PM
Machine Name: OPENHIST-F1
Machine IP: 10.69.130.73
Machine OS: Microsoft Windows NT 6.2.9200.0

Application Domain: openHistorian.exe
Assembly Codebase: C:/Program Files/openHistorian/openHistorian.exe
Assembly Full Name: openHistorian, Version=2.6.30.2, Culture=neutral, PublicKeyToken=null
Assembly Version: 2.6.30.2
Assembly Build Date: 9/16/2019 1:14:56 PM
.Net Runtime Version: 4.0.30319.42000

Exception Source: System.Data.SQLite
Exception Type: System.Data.SQLite.SQLiteException
Exception Message: constraint failed
UNIQUE constraint failed: Device.NodeID, Device.Acronym
Exception Target Site: Reset

---- Stack Trace ----
System.Data.SQLite.SQLite3.Reset(stmt As SQLiteStatement)
openHistorian.exe: N 00452
System.Data.SQLite.SQLite3.Step(stmt As SQLiteStatement)
openHistorian.exe: N 00225
System.Data.SQLite.SQLiteDataReader.NextResult()
openHistorian.exe: N 00228
System.Data.SQLite.SQLiteDataReader…ctor(cmd As SQLiteCommand, behave As CommandBehavior)
openHistorian.exe: N 00317
System.Data.SQLite.SQLiteCommand.ExecuteReader(behavior As CommandBehavior)
openHistorian.exe: N 00060
System.Data.SQLite.SQLiteCommand.ExecuteNonQuery(behavior As CommandBehavior)
openHistorian.exe: N 00050
GSF.TimeSeries.Transport.DataSubscriber.SynchronizeMetadata()
openHistorian.exe: N 08117

(Outer Exception)
Date and Time: 4/19/2021 12:52:54 PM
Machine Name: OPENHIST-F1
Machine IP: 10.69.130.73
Machine OS: Microsoft Windows NT 6.2.9200.0

Application Domain: openHistorian.exe
Assembly Codebase: C:/Program Files/openHistorian/openHistorian.exe
Assembly Full Name: openHistorian, Version=2.6.30.2, Culture=neutral, PublicKeyToken=null
Assembly Version: 2.6.30.2
Assembly Build Date: 9/16/2019 1:14:56 PM
.Net Runtime Version: 4.0.30319.42000

Exception Source:
Exception Type: System.InvalidOperationException
Exception Message: Failed to synchronize meta-data to local cache: constraint failed
UNIQUE constraint failed: Device.NodeID, Device.Acronym

---- Stack Trace ----

[4/19/2021 1:06:32 PM] Date and Time: 4/19/2021 1:06:32 PM
Machine Name: OPENHIST-F1
Machine IP: 10.69.130.73
Machine OS: Microsoft Windows NT 6.2.9200.0

Application Domain: openHistorian.exe
Assembly Codebase: C:/Program Files/openHistorian/openHistorian.exe
Assembly Full Name: openHistorian, Version=2.6.30.2, Culture=neutral, PublicKeyToken=null
Assembly Version: 2.6.30.2
Assembly Build Date: 9/16/2019 1:14:56 PM
.Net Runtime Version: 4.0.30319.42000

Exception Source: GSF.TimeSeries
Exception Type: System.InvalidOperationException
Exception Message: Could not parse input measurement definition “X1065925-Ia” as a filter expression, measurement key, point tag or Guid
Exception Target Site: ParseInputMeasurementKeys

---- Stack Trace ----
GSF.TimeSeries.Adapters.AdapterBase.ParseInputMeasurementKeys(dataSource As DataSet, allowSelect As Boolean, value As String, measurementTable As String)
openHistorian.exe: N 02765
GrafanaAdapters.<>c__DisplayClass26_3.b__5()
openHistorian.exe: N 00060
System.Lazy1.CreateValue() openHistorian.exe: N 00708 System.Lazy1.LazyInitValue()
openHistorian.exe: N 00184
GrafanaAdapters.TargetCache1.GetOrAdd(target As String, valueFactory As Func1)
openHistorian.exe: N 00390
GrafanaAdapters.d__26.MoveNext()
openHistorian.exe: N 02152
System.Linq.d__172.MoveNext() openHistorian.exe: N 00391 System.Linq.Buffer1…ctor(source As IEnumerable1) openHistorian.exe: N 00152 System.Linq.Enumerable.ToArray(source As IEnumerable1)
openHistorian.exe: N 00091
GrafanaAdapters.<>c__DisplayClass22_0.b__0()
openHistorian.exe: N 00529
System.Threading.Tasks.Task1.InnerInvoke() openHistorian.exe: N 00076 System.Threading.Tasks.Task.Execute() openHistorian.exe: N 00070 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() openHistorian.exe: N 00031 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(task As Task) openHistorian.exe: N 00060 System.Threading.Tasks.<CastToObject>d__11.MoveNext()
openHistorian.exe: N 00234
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
openHistorian.exe: N 00031
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(task As Task)
openHistorian.exe: N 00060
System.Web.Http.Controllers.d__1.MoveNext()
openHistorian.exe: N 00300
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
openHistorian.exe: N 00031
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(task As Task)
openHistorian.exe: N 00060
System.Web.Http.Filters.d__6.MoveNext()
openHistorian.exe: N 00307
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
openHistorian.exe: N 00031
System.Web.Http.Filters.d__6.MoveNext()
openHistorian.exe: N 00729
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
openHistorian.exe: N 00031
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(task As Task)
openHistorian.exe: N 00060
System.Web.Http.Filters.d__5.MoveNext()
openHistorian.exe: N 00435
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
openHistorian.exe: N 00031
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(task As Task)
openHistorian.exe: N 00060
System.Web.Http.Controllers.d__5.MoveNext()
openHistorian.exe: N 00877
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
openHistorian.exe: N 00031
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(task As Task)
openHistorian.exe: N 00060
System.Web.Http.Dispatcher.d__15.MoveNext()
openHistorian.exe: N 00651
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
openHistorian.exe: N 00031
System.Web.Http.Dispatcher.d__15.MoveNext()
openHistorian.exe: N 01163
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
openHistorian.exe: N 00031
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(task As Task)
openHistorian.exe: N 00060
GSF.Web.Security.d__13.MoveNext()
openHistorian.exe: N 00553
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
openHistorian.exe: N 00031
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(task As Task)
openHistorian.exe: N 00060
System.Web.Http.d__24.MoveNext()
openHistorian.exe: N 00554

[4/19/2021 11:20:17 PM] (Inner Exception)
(Inner Exception)
Date and Time: 4/19/2021 11:20:16 PM
Machine Name: OPENHIST-F1
Machine IP: 10.69.130.73
Machine OS: Microsoft Windows NT 6.2.9200.0

Application Domain: openHistorian.exe
Assembly Codebase: C:/Program Files/openHistorian/openHistorian.exe
Assembly Full Name: openHistorian, Version=2.6.30.2, Culture=neutral, PublicKeyToken=null
Assembly Version: 2.6.30.2
Assembly Build Date: 9/16/2019 1:14:56 PM
.Net Runtime Version: 4.0.30319.42000

Exception Source: System
Exception Type: System.IO.IOException
Exception Message: The handshake failed due to an unexpected packet format.
Exception Target Site: InternalEndProcessAuthentication

---- Stack Trace ----
System.Net.Security.SslState.InternalEndProcessAuthentication(lazyResult As LazyAsyncResult)
openHistorian.exe: N 8347585
System.Net.Security.SslState.EndProcessAuthentication(result As IAsyncResult)
openHistorian.exe: N 00076
GSF.Communication.TlsServer.ProcessTlsAuthentication(asyncResult As IAsyncResult)
openHistorian.exe: N 00177

(Outer Exception)
Date and Time: 4/19/2021 11:20:16 PM
Machine Name: OPENHIST-F1
Machine IP: 10.69.130.73
Machine OS: Microsoft Windows NT 6.2.9200.0

Application Domain: openHistorian.exe
Assembly Codebase: C:/Program Files/openHistorian/openHistorian.exe
Assembly Full Name: openHistorian, Version=2.6.30.2, Culture=neutral, PublicKeyToken=null
Assembly Version: 2.6.30.2
Assembly Build Date: 9/16/2019 1:14:56 PM
.Net Runtime Version: 4.0.30319.42000

Exception Source:
Exception Type: System.Exception
Exception Message: Unable to authenticate connection to client [10.128.165.36]: No matching certificate found in the list of trusted certificates.

---- Stack Trace ----

Hi Logu, here are the two fixes to GSF.TimeSeries\DataSubscriber.cs you should apply:

Thanks,
Ritchie

Hi Ritchie,

Thanks for your fix, its working fine.
Regards
Logu