Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

PostgresException: '40P01: deadlock detected' #185

Open
HGinnerup opened this issue Apr 12, 2022 · 0 comments
Open

PostgresException: '40P01: deadlock detected' #185

HGinnerup opened this issue Apr 12, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@HGinnerup
Copy link
Collaborator

Query executed:

EXPLAIN SELECT
       happiness_poorer.country AS poorer_name,
       happiness_poorer.happiness_score AS poorer_happy,
       gdp_less.gdp AS poorer_gdp,
       happiness_richer.country AS richer_name,
       happiness_richer.happiness_score AS richer_happy,
       gdp_more.gdp AS richer_gdp
    FROM yearly_gdp gdp_more
    JOIN yearly_gdp gdp_less
        ON gdp_less.gdp < gdp_more.gdp AND
           gdp_less.year = gdp_more.year
    JOIN countries country_poorer ON
        country_poorer.code = gdp_less.country_code
    JOIN countries country_richer ON
        country_richer.code = gdp_more.country_code
    JOIN world_happiness_2022 happiness_poorer ON
        happiness_poorer.country = country_poorer.name
    JOIN world_happiness_2022 happiness_richer ON
        happiness_richer.country = country_richer.name
    WHERE
          gdp_less.year = 2020 AND
          happiness_poorer.happiness_score > happiness_richer.happiness_score;

Exception

Npgsql.PostgresException
  HResult=0x80004005
  Message=40P01: deadlock detected

POSITION: 639
DETAIL: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.
  Source=Npgsql
  StackTrace:
   at Npgsql.Internal.NpgsqlConnector.<<ReadMessage>g__ReadMessageLong|211_0>d.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Npgsql.NpgsqlDataReader.<NextResult>d__47.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Npgsql.NpgsqlDataReader.NextResult()
   at Npgsql.NpgsqlCommand.<ExecuteReader>d__116.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Npgsql.NpgsqlCommand.<ExecuteReader>d__116.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
   at DatabaseConnector.Connectors.BaseDbConnector`3.<>c__DisplayClass12_1.<CallQueryAsync>b__0() in C:\Users\Henrik\source\repos\P6\Jantimizer\DatabaseConnector\Connectors\BaseDbConnector.cs:line 67
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)

  This exception was originally thrown at this call stack:
    [External Code]
    DatabaseConnector.Connectors.BaseDbConnector<Connector, Command, Adapter>.CallQueryAsync.AnonymousMethod__0() in BaseDbConnector.cs
    [External Code]`
@HGinnerup HGinnerup added the bug Something isn't working label Apr 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant