Memory allocation failed

Valentin V. Bartenev vbart at nginx.com
Tue Jan 2 13:44:56 UTC 2018


On Tuesday, 2 January 2018 10:12:11 MSK lhmwzy wrote:
> uname -a:
> DragonFly lhm.com 5.1-DEVELOPMENT DragonFly v5.1.0.467.gb76875-DEVELOPMENT #0: Wed Dec 20 20:37:51 CST 2017     root at lhm.com:/usr/obj/usr/src/sys/lhmwzy  x86_64
> 
> 
> ./configure php --module=php7 \
>                       --config=/usr/local/bin/php-config \
>                       --lib-path=/usr/local/lib
> When run :
>  curl -X PUT -d @config/blogs.json --unix-socket ./control.unit.sock http://10.66.23.99/
> 
> output:
> {
>         "error": "Memory allocation failed."
> }
> logs says:
>   1 2018/01/02 15:04:52 [info] 280908#34366357696 discovery started
>   2 2018/01/02 15:04:52 [notice] 280908#34366357696 module: php 7.0.26 "build/php7.unit.so"
>   3 2018/01/02 15:04:52 [notice] 280907#34366357696 process 280908 exited with code 0
>   4 2018/01/02 15:04:52 [info] 280909#34366357696 controller started
>   5 2018/01/02 15:04:52 [info] 280910#34366357696 router started
>   6 2018/01/02 15:05:00 [crit] 280909#34366357696 *3 shm_open(/unit.280909.e8bd919c) failed (13: Permission denied)
> 


It seems, DragonFly treats SHM segments as regular files
and doesn't create a separate namespace.

I assume, the "/tmp" directory should work for you.

Please, try the following patch:

diff -r 81d135e2f7c9 src/go/unit/nxt_go_port_memory.c
--- a/src/go/unit/nxt_go_port_memory.c  Mon Jan 01 20:50:57 2018 +0300
+++ b/src/go/unit/nxt_go_port_memory.c  Tue Jan 02 16:42:37 2018 +0300
@@ -49,7 +49,7 @@ nxt_go_new_port_mmap(nxt_go_process_t *p
         return NULL;
     }
 
-    name_len = snprintf(name, sizeof(name) - 1, "/unit.go.%p", name);
+    name_len = snprintf(name, sizeof(name) - 1, "/tmp/unit.go.%p", name);
 
 #if (NXT_HAVE_MEMFD_CREATE)
 
diff -r 81d135e2f7c9 src/nxt_port_memory.c
--- a/src/nxt_port_memory.c     Mon Jan 01 20:50:57 2018 +0300
+++ b/src/nxt_port_memory.c     Tue Jan 02 16:42:37 2018 +0300
@@ -280,7 +280,7 @@ nxt_port_new_port_mmap(nxt_task_t *task,
         return NULL;
     }
 
-    p = nxt_sprintf(name, name + sizeof(name), "/unit.%PI.%uxD",
+    p = nxt_sprintf(name, name + sizeof(name), "/tmp/unit.%PI.%uxD",
                     nxt_pid, nxt_random(&task->thread->random));
     *p = '\0';
 




More information about the unit mailing list