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

GraphQL failed to retrieve more than one type in single request #17282

Open
AndreySurkov opened this issue Dec 26, 2024 · 0 comments
Open

GraphQL failed to retrieve more than one type in single request #17282

AndreySurkov opened this issue Dec 26, 2024 · 0 comments

Comments

@AndreySurkov
Copy link
Contributor

Describe the bug

When request more than one GraphQL command that require DB aceess they execute in parellel and result wih error.

GraphQL.Execution.UnhandledError: Error trying to resolve field 'typeA'.
 ---> Npgsql.NpgsqlOperationInProgressException (0x80004005): A command is already in progress: SELECT \"Document\".* FROM \"Document\" INNER JOIN (SELECT \"Document\".\"Id\", MAX(\"ContentItemIndex_a1\".\"CreatedUtc\") AS \"order_1\" FROM \"Document\" INNER JOIN \"ContentItemIndex\" AS \"ContentItemIndex_a1\" ON \"ContentItemIndex_a1\".\"DocumentId\" = \"Document\".\"Id\" WHERE \"Document\".\"Type\" = @Type AND  ((\"ContentItemIndex_a1\".\"Published\" = @p1) AND (\"ContentItemIndex_a1\".\"ContentType\" = @p2)) GROUP BY \"Document\".\"Id\" ORDER BY \"order_1\" DESC limit 100) AS \"IndexQuery\" ON \"IndexQuery\".\"Id\" = \"Document\".\"Id\" ORDER BY \"order_1\" DESC
   at Npgsql.ThrowHelper.ThrowNpgsqlOperationInProgressException(NpgsqlCommand command)
   at Npgsql.Internal.NpgsqlConnector.<StartUserAction>g__DoStartUserAction|279_0(ConnectorState newState, NpgsqlCommand command, CancellationToken cancellationToken, Boolean attemptPgCancellation)
   at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
   at Dapper.SqlMapper.QueryAsync[T](IDbConnection cnn, Type effectiveType, CommandDefinition command) in /_/Dapper/SqlMapper.Async.cs:line 434
   at YesSql.Store.<>c__DisplayClass44_0`2.<<ProduceAwaitedAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at YesSql.Data.WorkDispatcher`2.ScheduleAsync[TState](TKey key, TState state, Func`3 valueFactory)
   at YesSql.Store.ProduceAwaitedAsync[T,TState](WorkerQueryKey key, Func`3 work, TState state)
   at YesSql.Services.DefaultQuery.Query`1.ListImpl()
   at YesSql.Services.DefaultQuery.Query`1.ListImpl()
   at OrchardCore.ContentManagement.GraphQL.Queries.ContentItemsFieldType.ResolveAsync(IResolveFieldContext context) in C:\\Repo\\GitHub\\OrchardCore\\src\\OrchardCore\\OrchardCore.ContentManagement.GraphQL\\Queries\\ContentItemsFieldType.cs:line 116
   at GraphQL.Resolvers.FuncFieldResolver`1.<>c__DisplayClass2_0.<<-ctor>b__0>d.MoveNext() in /_/src/GraphQL/Resolvers/FuncFieldResolver.cs:line 36
--- End of stack trace from previous location ---
   at GraphQL.Execution.ExecutionStrategy.ExecuteNodeAsync(ExecutionContext context, ExecutionNode node) in /_/src/GraphQL/Execution/ExecutionStrategy.cs:line 516
   --- End of inner exception stack trace ---

Orchard Core version

2.1.0

To Reproduce

  1. Instantiate new Orchard Site using PostgreSQL
  2. Enable Content Types and GraphQL features
  3. Create two types (TypeA and TypeB for example)
  4. Go to GraphQL and execute request
 query MyQuery {
  typeB {
    displayText
  }
  typeA {
    displayText
  }
}

Logs and screenshots

Seems like during migration on GrapgQL v7 LockedAsyncFieldResolver was incorrectly refactored.
Method LockedAsyncFieldResolver was marked as 'new' and does not execute.

https://github.com/OrchardCMS/OrchardCore/blob/d8168f2cf03b7c986e757aaaa8b060a255eb8c5b/src/OrchardCore/OrchardCore.Apis.GraphQL.Abstractions/Resolvers/LockedAsyncFieldResolver.cs#L13C42-L13C43

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

No branches or pull requests

2 participants