Re: Non working timeout detection in logical worker

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Julien Rouhaud <rjuju123(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Jehan Guillaume De Rorthais ioguix <ioguix(at)free(dot)fr>
Subject: Re: Non working timeout detection in logical worker
Date: 2019-10-18 05:32:15
Message-ID: 20191018053215.GK17439@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 17, 2019 at 08:00:15PM +0200, Julien Rouhaud wrote:
> Jehan-Guillaume (in Cc) reported me today a problem with logical
> replication, where in case of network issue the walsender is correctly
> terminating at the given wal_sender_timeout but the logical worker
> kept waiting indefinitely.
>
> The issue is apparently a simple thinko, the timestamp of the last
> received activity being unconditionally set at the beginning of the
> main processing loop, making any reasonable timeout setting
> ineffective. Trivial patch to fix the problem attached.

Right, good catch. That's indeed incorrect. The current code would
just keep resetting the timeout if walrcv_receive() returns 0 roughly
once per NAPTIME_PER_CYCLE. The ping sent to the server once reaching
half of wal_receiver_timeout was also broken because of that.

In short, applied and back-patched down to 10.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2019-10-18 05:47:13 Re: Non working timeout detection in logical worker
Previous Message Amit Kapila 2019-10-18 05:25:18 Re: Questions/Observations related to Gist vacuum