seg fault on dsm_create call

From: Max Fomichev <max(dot)fomitchev(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: seg fault on dsm_create call
Date: 2016-06-28 12:47:12
Message-ID: 54c511f5-4073-ce40-c4fc-5649fd8c966d@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hello.
I'm trying to understand how to work with dynamic shared memory, message
queues and workers.
The problem is I can not initialize a 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...

--
Best regards,
Max Fomichev

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Andrej 2016-06-29 03:01:32 Re: seg fault on dsm_create call
Previous Message marc rassbach 2016-06-27 08:25:03 Re: failing to make LATIN1 on locale C system - what am I doing wrong?