On Sun, Oct 18, 2015 at 1:03 AM, Tom Lane <t...@sss.pgh.pa.us> wrote:
> Amit Kapila <amit.kapil...@gmail.com> writes:
>> On Sat, Oct 17, 2015 at 12:07 AM, Robert Haas <robertmh...@gmail.com> wrote:
>>> Maybe we need to be using PostmasterRandom() rather than random() for
>>> the control segment name.
>> +1.  Though I think it is better to investigate the actual cause before
>> doing this.
> BackendRun() deliberately prevents that from working.  And it also sets
> srandom() to a new value for each subprocess, so that AFAICS this idea
> would be a net negative.  If you are seeing duplicate key values getting
> selected, the problem is elsewhere.

Coming back to an old thread, recently I got a problem in starting two
PostgreSQL services with a user that is not an administrator. The error
message is as follows.

FATAL:  could not create shared memory segment
"Global/PostgreSQL.851401618": Permission denied

The issue is happening only with the processes that are running as service.
I observed that the handle received in creating the dynamic shared memory
is same for two services, because of which the Access denied error is thrown
by the operating system and thus it leads to failure.

The PG shared memory name is always includes the data directory path as
below, because of which it doesn't match with two services.


But whereas the dynamic shared memory is formed with a random number
and this number getting generated same for two service thus it leads to


I tried replacing the random() with PostmaterRandom() for a test and it worked.
This is generating different random values, so the issue is not occurring.


I feel, we should add the the data directory path + the random number to
generate the name for dynamic shared memory, this can fix problem.


Hari Babu
Fujitsu Australia

Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to