Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newer version of Akka than Akka.Persistence.Sql hides missing npgsql error #406

Closed
Lemorz56 opened this issue Jun 16, 2024 · 1 comment · Fixed by #418
Closed

Newer version of Akka than Akka.Persistence.Sql hides missing npgsql error #406

Lemorz56 opened this issue Jun 16, 2024 · 1 comment · Fixed by #418

Comments

@Lemorz56
Copy link

Lemorz56 commented Jun 16, 2024

Version Information

Package Version
Akka 1.5.24
Akka.Hosting 1.5.24
Akka.DependencyInjection 1.5.24
Akka.Persistence 1.5.24
Akka.Persistence.Hosting 1.5.24
Akka.Persistence.Sql 1.5.20
Akka.Persistence.Sql.Hosting 1.5.20

Describe the bug
Using a newer Akka.NET than Persistence.Sql, hides that npgsql NuGet/Assembly is missing. I'm not sure the issue lies in this library but it's the one reporting the error ones you downgrade version.

To Reproduce
I've created an MRE which can be accessed here: https://github.com/Lemorz56/AkkaMRE
Inside the CSPROJ file there are both the older Akka.NET NuGet's and the newer ones. Comment the older ones in and the newer ones out to switch and see the exception/error appear after first running it and see that

Expected behavior
Seeing this error:

[ERROR][06-16-2024 15:34:28.027Z][Thread 0008][akka://TEST/system/akka.persistence.snapshot-store.sql] Error during [akka://TEST/system/akka.persistence.snapshot-store.sql#1872995821] initialization
Cause: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.InvalidOperationException: Cannot load assembly Npgsql
   at LinqToDB.DataProvider.PostgreSQL.NpgsqlProviderAdapter.GetInstance()
   at LinqToDB.DataProvider.PostgreSQL.PostgreSQLMappingSchema.PostgreSQL15MappingSchema..ctor()
   at LinqToDB.DataProvider.PostgreSQL.PostgreSQLDataProvider.GetMappingSchema(PostgreSQLVersion version)
   at LinqToDB.DataProvider.PostgreSQL.PostgreSQLDataProvider..ctor(String name, PostgreSQLVersion version)
   at LinqToDB.DataProvider.PostgreSQL.PostgreSQLDataProvider15..ctor()
   at System.RuntimeType.CreateInstanceOfT()
   --- End of inner exception stack trace ---
   at System.RuntimeType.CreateInstanceOfT()
   at System.Activator.CreateInstance[T]()
   at LinqToDB.Data.DataConnection.<>c__43`1.<CreateDataProvider>b__43_0()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at LinqToDB.DataProvider.PostgreSQL.PostgreSQLProviderDetector.DetectProvider(ConnectionOptions options)
   at LinqToDB.Data.DataConnection.ConfigurationInfo.<>c__DisplayClass12_0.<GetDataProvider>b__0(Func`2 d)
   at System.Linq.Enumerable.SelectListIterator`2.MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at LinqToDB.Data.DataConnection.ConfigurationInfo.GetDataProvider(ConnectionOptions options, Boolean isGlobal)
   at LinqToDB.Data.DataConnection.GetDataProvider(String providerName, String connectionString)
   at LinqToDB.Data.DataConnection.GetDataProviderEx(String providerName, String connectionString)
   at LinqToDB.Data.DataConnection.ConfigurationApplier.Apply(DataConnection dataConnection, ConnectionOptions options)
   at LinqToDB.Data.ConnectionOptions.LinqToDB.Common.IApplicable<LinqToDB.Data.DataConnection>.Apply(DataConnection obj)
   at LinqToDB.DataOptions.Apply(DataConnection dataConnection)
   at LinqToDB.Data.DataConnection..ctor(DataOptions options)
   at Akka.Persistence.Sql.Db.AkkaPersistenceDataConnectionFactory.<>c__DisplayClass5_0.<.ctor>b__0()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at Akka.Persistence.Sql.Db.AkkaPersistenceDataConnectionFactory.GetConnection()
   at Akka.Persistence.Sql.Snapshot.ByteArraySnapshotDao.InitializeTables()
   at Akka.Persistence.Sql.Snapshot.SqlSnapshotStore.Initialize()

Actual behavior
Hiding the error:

Error during [akka://TEST/system/akka.persistence.snapshot-store.sql#259451586] initialization
Failure during [akka://TEST/system/akka.persistence.journal.sql#1422930194] initialization.
Message [LoadSnapshot] from [akka://TEST/user/test-actor#2090935664] to [akka://TEST/system/akka.persistence.snapshot-store.sql#259451586] was not delivered. [1] dead letters encountered. If this is not an expected behavior then [akka://TEST/system/akka.persistence.snapshot-store.sql#259451586] may have terminated unexpectedly. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'. Message content: LoadSnapshot<pid: example, toSeqNr: 9223372036854775807, criteria: SnapshotSelectionCriteria<maxSeqNr: 9223372036854775807, maxTimestamp: 9999-12-31, minSeqNr: 0, minTimestamp: 0001-01-01>>

Environment
Windows 11, dotnet 8 latest.

Additional context
Since Akka.Persistence.Postgresql seems to soon be deprecated (maybe)? I tried setting up a simple project with PostgreSQL as persistence.

I'm not sure what library is "hiding" the actual error.

@Arkatufus
Copy link
Contributor

Arkatufus commented Jul 9, 2024

This is a bug in Akka.NET core library, it should be fixed in the next release. In the mean time, you can fix this by explicitly referencing Akka.NET v1.5.25 or higher.
Thank you for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants