seg fault on dsm_create call

From: Max Fomichev <max(dot)fomitchev(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: seg fault on dsm_create call
Date: 2016-06-28 16:07:16
Message-ID: e31fe65a-a6f6-11ca-37f1-1e66ba097240@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Some debug info related to my previous post -

* thread #1: tid = 0x2601e9, 0x0000000100313e5e
postgres`ResourceOwnerEnlargeDSMs + 10, queue = 'com.apple.main-thread',
stop reason = EXC_BAD_ACCESS (code=1, address=0x130)
* frame #0: 0x0000000100313e5e postgres`ResourceOwnerEnlargeDSMs + 10
frame #1: 0x0000000100202a5f postgres`dsm_create_descriptor + 22
frame #2: 0x0000000100202853 postgres`dsm_create + 43
frame #3: 0x0000000101a17717 pg_mystem.so`_PG_init + 39

Hello,
sorry for my repost from psql-novice, probably it was not a right place
for my question.

I'm trying to understand how to work with dynamic shared memory, message
queues and workers.
The problem is I can not initialize any dsm segment -

void _PG_init() {
...
dsm_segment *seg = dsm_create(32768, 0); // Segmentation fault
here
...
BackgroundWorker worker;
sprintf(worker.bgw_name, "mystem wrapper process");
worker.bgw_flags = BGWORKER_SHMEM_ACCESS;
worker.bgw_start_time = BgWorkerStart_RecoveryFinished;
worker.bgw_restart_time = BGW_NEVER_RESTART;
worker.bgw_main = mainProc;
worker.bgw_notify_pid = 0;
RegisterBackgroundWorker(&worker);
}

Also I was trying to move dsm_create call to a worker, but with the same
result -

static void mainProc(Datum) {
...
dsm_segment *seg = dsm_create(32768, 0); // Segmentation fault
here
...
pqsignal(SIGTERM, mystemSigterm);
BackgroundWorkerUnblockSignals();
...

What could be a reason and what am I doing wrong?

PS
test/modules/test_shm_mq works fine...
dynamic_shared_memory_type = posix
OSX 10.11.5
PostgreSQL 9.5.3

--
Best regards,
Max Fomichev

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2016-06-28 16:16:49 Re: primary_conninfo missing from pg_stat_wal_receiver
Previous Message Oleg Bartunov 2016-06-28 16:00:05 Re: Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?