From: Will Storey <will@summercat.com>
To: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Unexpected "canceling statement due to user request" error
Date: Sat, 17 Aug 2019 11:13:35 -0700
Message-ID: <20190817181335.wc7t3z3tfs7taiqo@dev.null> (raw)
In-Reply-To: <34a5ea6d-8dbb-e46a-0c08-fbbea4d4bcd7@aklaver.com>
References: <20190816210243.tohrx52bnbxx5zra@dev.null>
<34a5ea6d-8dbb-e46a-0c08-fbbea4d4bcd7@aklaver.com>
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: will@summercat.com, adrian.klaver@aklaver.com
Subject: Re: Unexpected "canceling statement due to user request" error
In-Reply-To: <20190817181335.wc7t3z3tfs7taiqo@dev.null>
References: <20190816210243.tohrx52bnbxx5zra@dev.null> <34a5ea6d-8dbb-e46a-0c08-fbbea4d4bcd7@aklaver.com> <20190817181335.wc7t3z3tfs7taiqo@dev.null>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox