Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jiBU4-0005BP-Pe for pgsql-general@arkaria.postgresql.org; Mon, 08 Jun 2020 06:42:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jiBTX-0001t4-U9 for pgsql-general@arkaria.postgresql.org; Mon, 08 Jun 2020 06:41:39 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jiBTX-0001sx-Ku for pgsql-general@lists.postgresql.org; Mon, 08 Jun 2020 06:41:39 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jiBTV-0006Ij-Mr for pgsql-general@lists.postgresql.org; Mon, 08 Jun 2020 06:41:38 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 095D039F; Mon, 8 Jun 2020 02:41:35 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 08 Jun 2020 02:41:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=l29dIosZp7ULrXGhYTn1Px0G9Xc gRtiYLbZFU3URZgM=; b=TMx1EAS9aV74LFGoKQM4SZfnq1/ciXrC7f6vlXCubVu yAlocKGrWAcWi72iG9aaaRpguGd25HIofwgmvCE4DphhcK8MZ3uJimBk7P4WxHrP Lz1kltss/Y7yDdNGjO978/qHfL8zazcrIQzOXMd0UdYA0hJSI5vHj9lIoW3AAfxA ZSu7v/0IuDUH459riwF56EQmm+k8AU+Dcu6BAHAbaeGKJ3YCx58xdUKH1Oy0hZi4 gjES6vpvAIP6BQyO9cnf28enW5r7ta9+pD8sjgE/pXinE2ME7VZGDa812mj7zwmY 2NV+ttmQYe6vTuAmxyyWUKZboxyybW2nMCqaY5uBJEg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=l29dIo sZp7ULrXGhYTn1Px0G9XcgRtiYLbZFU3URZgM=; b=llxg0LWi8QDGzG9DGWQ93k aQP5O41bn3SKdxfbb1DfTMdSjIE4MvydJd1AoqJ613bbizYFxvcBLL+TTgXHMz0G RxveC1Q8ioXbtbY2G+xv+GvJq1dlDRv+VTZaUt70IxalPc7OI7TmCb3vmDjTE4CU bjRyHuQqhLGswJ782zTCRRCTjip1e88+P4CGYqoT8/jTYcmd3Vj4+uDXZGLIbhIp XwsBUtxzVjzpEhkog4W5FlNJ6uHtPPwFKxYKfOCZtbtHdFB2RT4pZJUIntFYsKYd UxqvC3EHP67KVIGxC0WR2aZdUrplHZYOOIWbZGGKbyyrFg4nixnIOEZktegZQovA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudehtddgudduvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enfghrlhcuvffnffculdejtddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredt tdejnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepveefgfeugedvjeefjeffkefh feetkeelvdegvdefgeefudejuedtkeehiefgleeunecukfhppeduuddurddutddvrdduke dtrddukeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihii X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 4FBDF30618C1; Mon, 8 Jun 2020 02:41:34 -0400 (EDT) Date: Mon, 8 Jun 2020 15:41:31 +0900 From: Michael Paquier To: =?utf-8?B?QWxlxaEgWmVsZW7DvQ==?= Cc: pgsql-general@lists.postgresql.org Subject: Re: Logical replication - ERROR: could not send data to WAL stream: cannot allocate memory for input buffer Message-ID: <20200608064131.GD2589@paquier.xyz> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="DqhR8hV3EnoxUkKN" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --DqhR8hV3EnoxUkKN Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 05, 2020 at 10:57:46PM +0200, Ale=C5=A1 Zelen=C3=BD wrote: > we are using logical replication for more than 2 years and today I've fou= nd > new not yet know error message from wal receiver. The replication was in > catchup mode (on publisher side some new tables were created and added to > publication, on subscriber side they were missing). This comes from pqCheckInBufferSpace() in libpq when realloc() fails, most probably because this host ran out of memory. > Repeated several times, finally it proceeded and switch into streaming > state. The OS has 64GB RAM, OS + database instance are using usually 20GB > rest is used as OS buffers. I've checked monitoring (sampled every 10 > seconds) and no memory usage peak was visible, so unless it was a very > short memory usage peak, I'd not expect the system running out of memory. > > Is there something I can do to diagnose and avoid this issue? Does the memory usage increase slowly over time? Perhaps it was not a peak and the memory usage was not steady? One thing that could always be tried if you are able to get a rather reproducible case would be to use valgrind and check if it is able to detect any leaks. And I am afraid that it is hard to act on this report without more information. -- Michael --DqhR8hV3EnoxUkKN Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl7d3ZsACgkQnvQgOdby QH36LA/+Po70vbJOMM+DlBAZSmhlp8a1j68O+9ClhYVR4pZht4/oNOhyyBgxuHs4 uLvpGnL/RTVsLrxjo6K5xMIdQa3YgOgOcGYN/sd1ji8EyIQh9DQIoQrcBp+R2jpx RsbfKkGKeCyWykWRMT39DPkNqYbVgEze6mM3ZE97rPSOku4/5H080YpF4HV4UKZN mRZ2zb1Ukua86y0wwIHI+3t5C7vuc46mCYbWMef6ZDqCLsgHmT6vjUIzRX16oOFe quvAE8Akvk8LBGlxcm8Tk5LLsD23kHOJKgphIrBGslNbEqXqLzU2dgP3s/2I5ift hjZUPYISoDg1v1Sr0zKouyU9fbv9LGg5WW1/WFv5xOczbNHWbgDKHZMVfZYAgd8e /22a+gliCaKj7D7tFLUwFElnsyJ5yz9hfHAcRiOyw3xlq054EmaBjYg723O2+MSL AqxVqfs7ERuyWgWBb4vPZuQDNoQhhRoXAoFJBK363tUzhqcknoro4CjsR+QVmTcC NXzg0j2x9pHJ+4SXKnitLTvh2So+rdaOPjhgPWh3eJsE8c++LJgTJUdzCXgd4fAS ulOHOzDWZgKEPfdPf32egFS2HX7N+vLfWAyC4DIKiG+kzBdIYey3XBbx7EdUfoY1 LcQDhDe6VPFn0rm+sK1JYBDvkWngXmZTQPjnMh9RHAb+0XWx4js= =NEN7 -----END PGP SIGNATURE----- --DqhR8hV3EnoxUkKN--