You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
git checkout v15 docker compose up --build --detach curl http://localhost:5135
What is expected?
The blogs and posts should be added to the database without any exceptions being thrown.
What is actually happening?
The blogs and posts are not being completely added to the database (some are failing).
Relevant log output
A second operation was started on this context instance before a previous operation completed. This is usually caused by different threads concurrently using the same instance of DbContext. For more information on how to avoid threading issues with DbContext, see https://go.microsoft.com/fwlink/?linkid=2097913.","stackTrace":" at Microsoft.EntityFrameworkCore.Infrastructure.Internal.ConcurrencyDetector.EnterCriticalSection()\n at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()\n at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)\n at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)\n at Server.Mutation.AddPostAsync(BloggingContext context, ILogger`1 logger, Guid id, String title, Guid blogId, CancellationToken cancellationToken) in /src/Server/Types.cs:line 86\n at HotChocolate.Resolvers.Expressions.ExpressionHelper.AwaitTaskHelper[T](Task`1 task)\n at HotChocolate.Types.Helpers.FieldMiddlewareCompiler.<>c__DisplayClass9_0.<<CreateResolverMiddleware>b__0>d.MoveNext()\n--- End of stack trace from previous location ---\n at HotChocolate.Types.MutationConventionTypeInterceptor.<>c__DisplayClass16_0.<<ApplyResultMiddleware>b__1>d.MoveNext()\n--- End of stack trace from previous location ---\n at HotChocolate.Types.MutationConventionMiddleware.InvokeAsync(IMiddlewareContext context)\n at HotChocolate.Types.ErrorMiddleware.InvokeAsync(IMiddlewareContext context)\n at HotChocolate.Execution.Processing.Tasks.ResolverTask.ExecuteResolverPipelineAsync(CancellationToken cancellationToken)\n at HotChocolate.Execution.Processing.Tasks.ResolverTask.TryExecuteAsync(CancellationToken cancellationToken)
Additional context
The v13 branch works as expected however the v14 branch and the v15 branch have issues with multiple operations being performed concurrently using the same database context when batching requests.
The text was updated successfully, but these errors were encountered:
That is by design .... Batching will execute operations in parallel and share between these requests a DataLoader context ...
Each async field has its own DI context that can work in isolation. We have a series about the new Data APIs here: https://www.youtube.com/@chillicreamtv
Product
Hot Chocolate
Version
15.1.3
Link to minimal reproduction
https://github.com/tnc1997/hot-chocolate-request-batching
Steps to reproduce
git checkout v15
docker compose up --build --detach
curl http://localhost:5135
What is expected?
The blogs and posts should be added to the database without any exceptions being thrown.
What is actually happening?
The blogs and posts are not being completely added to the database (some are failing).
Relevant log output
Additional context
The
v13
branch works as expected however thev14
branch and thev15
branch have issues with multiple operations being performed concurrently using the same database context when batching requests.The text was updated successfully, but these errors were encountered: