Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Zn1Fh-0002sF-Iy for pgsql-hackers@arkaria.postgresql.org; Fri, 16 Oct 2015 09:24:41 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Zn1Fh-00065G-4Y for pgsql-hackers@arkaria.postgresql.org; Fri, 16 Oct 2015 09:24:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Zn1EO-0004bP-8r for pgsql-hackers@postgresql.org; Fri, 16 Oct 2015 09:23:20 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1Zn1EJ-0006eJ-B0 for pgsql-hackers@postgresql.org; Fri, 16 Oct 2015 09:23:19 +0000 Received: from bart (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPA id C910F21C3CAC; Fri, 16 Oct 2015 12:23:13 +0300 (MSK) Message-ID: <1444987393.14996.2.camel@postgrespro.ru> Subject: Re: Windows service is not starting so =?UTF-8?Q?there=E2=80=99s?= message in log: FATAL: "could not create shared memory segment =?UTF-8?Q?=E2=80=9CGlobal=2FPostgreSQL=2E851401618=E2=80=9D=3A?= Permission =?UTF-8?Q?denied=E2=80=9D?= From: Dmitry Vasilyev To: Amit Kapila , Kyotaro HORIGUCHI Cc: pgsql-hackers In-Reply-To: References: <1444920387.3661.7.camel@postgrespro.ru> <1444921511.3661.13.camel@postgrespro.ru> Content-Type: multipart/mixed; boundary="=-BdHqKjO06WHriAJG/wX5" Date: Fri, 16 Oct 2015 12:23:13 +0300 Mime-Version: 1.0 X-Mailer: Evolution 3.18.1 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --=-BdHqKjO06WHriAJG/wX5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit On Пт, 2015-10-16 at 09:02 +0530, Amit Kapila wrote: > On Thu, Oct 15, 2015 at 8:35 PM, Dmitry Vasilyev pro.ru> wrote: > > I think that function dsm_impl_windows() with EACCES error should > > not > > do ereport() with FATAL level. It works, but it is likely to make > > an > > infinite loop if the user will receive EACCES error. > > > > > Currently we are using error level as ERROR for creating dsm during > postmaster startup which is not right and rather we should use error > level as LOG.  Can you please try with the attached patch and see > if the issue is fixed for you. > > Another some what related point is currently we are using random() > function to ensure a unique name for dsm and it seems to me that > it is always going to generate same number on first invocation (at > least > thats what happening on windows) due to which you are seeing the > error.  Another options could be to append current pid or data > directory > path as we are doing in win32_shmem.c.  I think this could be an > optimization which can be done in addition to the fix attached (we > can > do this as a separate patch as well, if we agreed to do anything). > > > With Regards, > Amit Kapila. > EnterpriseDB: http://www.enterprisedb.com In that case your patch is working. There was LOG level message with Permission denied (from the operation point it’s not clear how to respond to message like this). But as I understand if operating system can’t create shared memory we will try to distinguish that chunk up to infinity. As I see it’s better to stop instance in this case. So I guess it’s a good idea to remain all as it is now (FATAL level) but add PostmasterPid to name (as you suggest). There’s patch in attachments. ---- Dmitry Vasilyev Postgres Professional: http://www.postgrespro.com Russian Postgres Company --=-BdHqKjO06WHriAJG/wX5 Content-Disposition: attachment; filename="win_dsm_v2.patch" Content-Type: text/x-patch; name="win_dsm_v2.patch"; charset="UTF-8" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL3NyYy9iYWNrZW5kL3N0b3JhZ2UvaXBjL2RzbV9pbXBs LmMgYi9zcmMvYmFja2VuZC9zdG9yYWdlL2lwYy9kc21faW1wbC5jCmluZGV4 IDkyMWYwMjkuLjU1MzM1YmYgMTAwNjQ0Ci0tLSBhL3NyYy9iYWNrZW5kL3N0 b3JhZ2UvaXBjL2RzbV9pbXBsLmMKKysrIGIvc3JjL2JhY2tlbmQvc3RvcmFn ZS9pcGMvZHNtX2ltcGwuYwpAQCAtNjgsNiArNjgsNyBAQAogI2luY2x1ZGUg InV0aWxzL2d1Yy5oIgogI2luY2x1ZGUgInV0aWxzL21lbXV0aWxzLmgiCiAj aW5jbHVkZSAicG9zdG1hc3Rlci9wb3N0bWFzdGVyLmgiCisjaW5jbHVkZSAi bWlzY2FkbWluLmgiCiAKICNpZmRlZiBVU0VfRFNNX1BPU0lYCiBzdGF0aWMg Ym9vbCBkc21faW1wbF9wb3NpeChkc21fb3Agb3AsIGRzbV9oYW5kbGUgaGFu ZGxlLCBTaXplIHJlcXVlc3Rfc2l6ZSwKQEAgLTYzMSw3ICs2MzIsNyBAQCBk c21faW1wbF93aW5kb3dzKGRzbV9vcCBvcCwgZHNtX2hhbmRsZSBoYW5kbGUs IFNpemUgcmVxdWVzdF9zaXplLAogCSAqIHNpbWlsYXIgdG8gbWFpbiBzaGFy ZWQgbWVtb3J5LiBXZSBjYW4gY2hhbmdlIGhlcmUgb25jZSBpc3N1ZSBtZW50 aW9uZWQKIAkgKiBpbiBHZXRTaGFyZWRNZW1OYW1lIGlzIHJlc29sdmVkLgog CSAqLwotCXNucHJpbnRmKG5hbWUsIDY0LCAiJXMuJXUiLCBTRUdNRU5UX05B TUVfUFJFRklYLCBoYW5kbGUpOworCXNucHJpbnRmKG5hbWUsIDY0LCAiJXMu JWQuJXUiLCBTRUdNRU5UX05BTUVfUFJFRklYLCBQb3N0bWFzdGVyUGlkLCBo YW5kbGUpOwogCiAJLyoKIAkgKiBIYW5kbGUgdGVhcmRvd24gY2FzZXMuICBT aW5jZSBXaW5kb3dzIGF1dG9tYXRpY2FsbHkgZGVzdHJveXMgdGhlIG9iamVj dAo= --=-BdHqKjO06WHriAJG/wX5 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --=-BdHqKjO06WHriAJG/wX5--