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

Bumped Weasel version to fix concurrency issue during Marten startup related to NpgsqlTypeMapping #2536

Merged
merged 2 commits into from
Mar 24, 2023

Conversation

oskardudycz
Copy link
Collaborator

@oskardudycz oskardudycz commented Mar 24, 2023

Per @Hawxy at Discord conversation, NpgsqlTypeMapping is causing the issue when starting multiple Marten instances in parallel:

Object reference not set to an instance of an object.
   at Weasel.Postgresql.PostgresqlProvider.<>c__DisplayClass15_0.<GetTypeMapping>b__0(NpgsqlTypeMapping mapping)
   at System.Linq.Enumerable.TryGetLast[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
   at System.Linq.Enumerable.LastOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at Weasel.Postgresql.PostgresqlProvider.GetTypeMapping(Type type)
   at Weasel.Postgresql.PostgresqlProvider.ResolveDatabaseType(Type type)
   at Weasel.Postgresql.PostgresqlProvider.GetDatabaseType(Type memberType, EnumStorage enumStyle)
   at Marten.Storage.Metadata.MetadataColumn`1..ctor(String name, Expression`1 property) in C:\Source\marten\src\Marten\Storage\Metadata\MetadataColumn.cs:line 100
   at Marten.Storage.Metadata.LastModifiedColumn..ctor() in C:\Source\marten\src\Marten\Storage\Metadata\LastModifiedColumn.cs:line 10
   at Marten.Schema.DocumentMetadataCollection..ctor(DocumentMapping parent) in C:\Source\marten\src\Marten\Schema\DocumentMetadataCollection.cs:line 14
   at Marten.Schema.DocumentMapping..ctor(Type documentType, StoreOptions storeOptions) in C:\Source\marten\src\Marten\Schema\DocumentMapping.cs:line 81
   at Marten.Schema.DocumentMapping`1..ctor(StoreOptions storeOptions) in C:\Source\marten\src\Marten\Schema\DocumentMapping.cs:line 665
   at Marten.DocumentMappingBuilder`1.Build(StoreOptions options) in C:\Source\marten\src\Marten\MartenRegistry.cs:line 47
   at Marten.Storage.StorageFeatures.Build(Type type, StoreOptions options) in C:\Source\marten\src\Marten\Storage\StorageFeatures.cs:line 93
   at Marten.Storage.StorageFeatures.MappingFor(Type documentType) in C:\Source\marten\src\Marten\Storage\StorageFeatures.cs:line 175
   at Marten.Storage.StorageFeatures.FindMapping(Type documentType) in C:\Source\marten\src\Marten\Storage\StorageFeatures.cs:line 194
   at Marten.Storage.StorageFeatures.BuildAllMappings() in C:\Source\marten\src\Marten\Storage\StorageFeatures.cs:line 128

Changed NpgsqlTypeMapping to use ImHashMap for thread-safe usage.

See the fix in Weasel: JasperFx/weasel#84

Besides that:

  • Adjusted StorageFeatures to not use IDictionary but thread-safe collections
  • Updated also other Criter stack dependencies

@jeremydmiller @babuannamalai FYI

…related to NpgsqlTypeMapping

Updated also other Criter stack dependencies
@oskardudycz oskardudycz added bug dependencies Pull requests that update a dependency file 6.x concurrency labels Mar 24, 2023
@oskardudycz oskardudycz added this to the 6.0.0 milestone Mar 24, 2023
@oskardudycz oskardudycz merged commit 42de427 into master Mar 24, 2023
@oskardudycz oskardudycz deleted the npgsqltypemapping_imhashmap branch March 24, 2023 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.x bug concurrency dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant