Re: shared memory message queues

From: Thom Brown <thom(at)linux(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Andres Freund <andres(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: shared memory message queues
Date: 2014-01-14 17:43:20
Message-ID: CAA-aLv6bwJRxKgtypSMTE+wzUtS1EeTyf8ZsRzRg3H1dk5gtfA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 14 January 2014 17:29, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Mon, Dec 23, 2013 at 12:46 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> Oh, dear. That's rather embarrassing.
>>
>> Incremental (incremental-shm-mq.patch) and full (shm-mq-v3.patch)
>> patches attached.
>
> OK, I have pushed the patches in this stack. I'm not sure we quite
> concluded the review back-and-forth but nobody really seems to have
> had serious objections to this line of attack, other than wanting some
> more comments which I have added. I don't doubt that there will be
> more things to tweak and tune here, and a whole lot more stuff that
> needs to be built using this infrastructure, but I don't think the
> code that's here is going to get better for remaining outside the tree
> longer.
>
> I decided not to change the dsm_toc patch to use functions instead of
> macros as Andres suggested; the struct definition would still have
> needed to be public, so any change would still need a recompile, at
> least if the size of the struct changed. It could be changed to work
> with a palloc'd chunk, but then you need to worry about
> context-lifespan memory leaks and it so didn't seem worth it. I can't
> imagine this having a lot of churn, anyway.

postgres=# SELECT test_shm_mq(32768, (select
string_agg(chr(32+(random()*96)::int), '') from generate_series(1,3)),
1, 10);
ERROR: could not register background process
HINT: You may need to increase max_worker_processes.
STATEMENT: SELECT test_shm_mq(32768, (select
string_agg(chr(32+(random()*96)::int), '') from generate_series(1,3)),
1, 10);
LOG: registering background worker "test_shm_mq"
LOG: starting background worker process "test_shm_mq"
ERROR: could not register background process
HINT: You may need to increase max_worker_processes.
ERROR: unable to map dynamic shared memory segment
LOG: worker process: test_shm_mq (PID 21939) exited with exit code 1
LOG: unregistering background worker "test_shm_mq"

What's going on here? This occurs when starting Postgres and run as
the first statement.

I also noticed that everything exits with exit code 1:

postgres=# SELECT test_shm_mq(32768, (select
string_agg(chr(32+(random()*96)::int), '') from
generate_series(1,400)), 10000, 1);
LOG: registering background worker "test_shm_mq"
LOG: starting background worker process "test_shm_mq"
test_shm_mq
-------------

(1 row)

LOG: worker process: test_shm_mq (PID 22041) exited with exit code 1
LOG: unregistering background worker "test_shm_mq"

--
Thom

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-01-14 17:47:10 Re: [Lsf-pc] Linux kernel impact on PostgreSQL performance
Previous Message Robert Haas 2014-01-14 17:39:32 Re: [Lsf-pc] Linux kernel impact on PostgreSQL performance