Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bnPwI-0001Hd-CA for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Sep 2016 12:50:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bnPwH-0003Lr-SC for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Sep 2016 12:50:49 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bnPwH-0003Lk-2T for pgsql-hackers@postgresql.org; Fri, 23 Sep 2016 12:50:49 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bnPwE-0006aC-DO for pgsql-hackers@postgresql.org; Fri, 23 Sep 2016 12:50:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u8NCogus026482; Fri, 23 Sep 2016 08:50:42 -0400 From: Tom Lane To: Amit Kapila cc: Robert Haas , Dmitry Vasilyev , pgsql-hackers Subject: Re: =?UTF-8?Q?Re=3A_=5BHACKERS=5D_Re=3A_=5BHACKERS=5D_Re=3A_=5BHACKERS=5D_Re=3A_=5BHACKE?= =?UTF-8?Q?RS=5D_Windows_service_is_not_starting_so_there=E2=80=99s_message_in_?= =?UTF-8?Q?log=3A_FATAL=3A_=22could_not_create_shared_memory_segment_=E2=80=9CGloba?= =?UTF-8?Q?l=2FPostgreSQL=2E851401618=E2=80=9D=3A_Permission_denied=E2=80=9D?= In-reply-to: References: <1444920387.3661.7.camel@postgrespro.ru> <1444921511.3661.13.camel@postgrespro.ru> <20789.1474390434@sss.pgh.pa.us> <11822.1474573896@sss.pgh.pa.us> Comments: In-reply-to Amit Kapila message dated "Fri, 23 Sep 2016 11:50:12 +0530" Date: Fri, 23 Sep 2016 08:50:42 -0400 Message-ID: <26481.1474635042@sss.pgh.pa.us> X-Pg-Spam-Score: -5.0 (-----) 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 Amit Kapila writes: > On Fri, Sep 23, 2016 at 1:21 AM, Tom Lane wrote: >> Robert Haas writes: >>> So, we could have dsm_postmaster_startup() seed the random number >>> generator itself, and then let PostmasterRandom() override the seed >>> later. Like maybe: >> >> Works for me, at least as a temporary solution. > Isn't it better if we use the same technique in dsm_create() as well > which uses random() for handle? dsm_create() is executed in backends, not the postmaster, and they already have their own random seeds (cf BackendRun). Adding more srandom calls at random places will *not* make things better. However, it's certainly true that dsm_postmaster_startup() might not be the only place in postmaster startup that wants to use random(). What seems like the best thing after sleeping on it is to put "srandom(time(NULL))" somewhere early in PostmasterMain, so that one such call suffices for all uses during postmaster startup. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers