Re: Unexpected "canceling statement due to user request" error - Mailing list pgsql-general

From Will Storey
Subject Re: Unexpected "canceling statement due to user request" error
Date
Msg-id 20190817181335.wc7t3z3tfs7taiqo@dev.null
Whole thread Raw
In response to Re: Unexpected "canceling statement due to user request" error  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: Unexpected "canceling statement due to user request" error  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Sat 2019-08-17 10:32:40 -0700, Adrian Klaver wrote:
> > I know this query can time out, and it does, resulting in the error I
> > expect: "canceling statement due to statement timeout". The problem is
> > occasionally I see this other error: "canceling statement due to user
> > request".
> > 
> > Looking at the query logs, when the query fails with the user request
> > error, the query reached the statement timeout (at least in cases I
> > checked). In one instance the duration shows as 1283ms for example.
> > 
> > Could there be any situation where a query getting cancelled due to a
> > statement timeout be reported as cancelled due to user request? Or do you
> > have any ideas about what might be going on?
> 
> Here is the relevant source:
> 
> https://doxygen.postgresql.org/postgres_8c.html#ab7af3ee6ad40efb8454c6f2f790d9588
> 
> Start at around line 3078.

Thanks for the pointer!

It looks like we'd have to be entering that section and finding the
statement timeout not set, otherwise we'd not fall through to the "user
request" case.

But as far as I can tell, the only reason my query would be cancelled is
because of the statement timeout. I wonder if there is some way the
statement timeout flag is being lost/cleared. I see there's situations
where we clear timeout flags.

Something I forgot to mention: The queries are against a hot standby
server.



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Unexpected "canceling statement due to user request" error
Next
From: Begin Daniel
Date:
Subject: RE: Error message restarting a database