Subject: PG-15.6: timeout parameters erroring out

From: Mukesh Tanuku <[email-masked]>
Date: Mon, 10 Feb 2025 10:04:17 +0530

Hello team,

We unabled the postgres timeout parameters in the postgresql.conf file

*idle_in_transaction_session_timeout = '1min'idle_session_timeout = '5min'*

other way also, like below

*idle_in_transaction_session_timeout = 60000idle_session_timeout = 300000*

we see these errors reporting in the logs after we enabled those parameters
*log:*
2025-02-10 04:17:19.156 GMT [2467573] ERROR:  trailing junk after numeric
literal at or near "1m" at character 43
2025-02-10 04:17:19.156 GMT [2467573] STATEMENT:  SET
idle_in_transaction_session_timeout = 1min
2025-02-10 04:17:19.845 GMT [2467575] ERROR:  trailing junk after numeric
literal at or near "1m" at character 43
2025-02-10 04:17:19.845 GMT [2467575] STATEMENT:  SET
idle_in_transaction_session_timeout = 1min
...
...
...

2025-02-10 04:22:00.823 GMT [2468337] ERROR:  trailing junk after numeric
literal at or near "5m" at character 28
2025-02-10 04:22:00.823 GMT [2468337] STATEMENT:  SET idle_session_timeout
= 5min
2025-02-10 04:22:03.487 GMT [2468342] ERROR:  trailing junk after numeric
literal at or near "5m" at character 28
2025-02-10 04:22:03.487 GMT [2468342] STATEMENT:  SET idle_session_timeout
= 5min
2025-02-10 04:22:04.470 GMT [2468345] ERROR:  trailing junk after numeric
literal at or near "5m" at character 28

Is there any know issue/bug with these paramters, can someone help me to
get this worked since our app idle connections are getting pilled up and
reaching max connections.

I really appreciate your help. Thank you.

Regards
Mukesh Tanuku

---

From: David Rowley <[email-masked]>
Date: Mon, 10 Feb 2025 17:54:06 +1300

On Mon, 10 Feb 2025 at 17:34, Mukesh Tanuku <[email-masked]> wrote:
> 2025-02-10 04:22:00.823 GMT [2468337] ERROR:  trailing junk after numeric literal at or near "5m" at character 28
> 2025-02-10 04:22:00.823 GMT [2468337] STATEMENT:  SET idle_session_timeout = 5min
> 2025-02-10 04:22:03.487 GMT [2468342] ERROR:  trailing junk after numeric literal at or near "5m" at character 28
> 2025-02-10 04:22:03.487 GMT [2468342] STATEMENT:  SET idle_session_timeout = 5min
> 2025-02-10 04:22:04.470 GMT [2468345] ERROR:  trailing junk after numeric literal at or near "5m" at character 28
>
> Is there any know issue/bug with these paramters, can someone help me to get this worked since our app idle connections are getting pilled up and reaching max connections.

I don't see any issues with the postgresql.conf, but it looks like
you're just missing single quotes in your SET statements. See [1],
where it says:

"New value of parameter. Values can be specified as string constants,
identifiers, numbers, or comma-separated lists of these, as
appropriate for the particular parameter."

String constants [2] require single quotes or the dollar quoting
format and 5min isn't a valid number.

David

[1] https://www.postgresql.org/docs/17/sql-set.html
[2] https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS

---

From: Tom Lane <[email-masked]>
Date: Mon, 10 Feb 2025 00:02:13 -0500

> *idle_in_transaction_session_timeout = '1min'idle_session_timeout = '5min'*

Did you actually run them together on one line like that?  The normal
thing is one setting per line.  It might be that the config file
parser will let you get away with just spaces rather than a newline
between settings, but I'm not terribly surprised if it fails without
any whitespace at all.  However, since you showed us neither the exact
config file contents nor the error message you got, this is all just
speculation.

> idle_in_transaction_session_timeout = 1min

This case however is pretty clear: you need single quotes around the
value '1min', and you didn't provide them.

			regards, tom lane

---

From: "David G. Johnston" <[email-masked]>
Date: Sun, 9 Feb 2025 22:08:52 -0700

> > *idle_in_transaction_session_timeout = '1min'idle_session_timeout =
Did you actually run them together on one line like that?

I think that is an email client artifact, dealing with RTF or something.

I do agree too much is missing here.  The only known errors involve SET
which configuration file settings don’t use.  And those errors are indeed
the lack of quoting.

The lack of space I mentioned earlier, in the config text literal, is fine.

David J.