0

When running GridGain nodes on different Linux/Unix versions I get Failed to allocate shared memory segment errors.

How to fix it?

gridgain
  • 109
  • 5

1 Answers1

0

GridGain nodes started on the same machine on Linux or Mac OS will try to connect to each other using high throughput shared memory protocol instead of TCP. However, default limits for system resources in Mac OS are extremely low to use shared memory IPC communication between multiple nodes on the same box. To increase shared memory limits, run the following commands in terminal:

ulimit -n 4096
launchctl limit maxfiles 100000 100000
sudo sysctl -w kern.sysv.shmmax=33554432
sudo sysctl -w kern.sysv.shmall=33554432
sudo sysctl -w kern.sysv.shmseg=1024
sudo sysctl -w kern.sysv.shmmni=32

These values should be enough to run up to 5 nodes with shared memory communication. If you need to start more nodes, alter values accordingly. For example, to be able to start 10 nodes, every value above should be doubled.

The above changes will be effective only until restart. To make them persistent, add the following content to /etc/launchd.conf (you may have to create it):

limit maxfiles 100000 100000

, and the following content to /etc/sysctl.conf (you may also have to create it):

kern.maxfiles=40000
kern.maxfilesperproc=20000
kern.sysv.shmmax=33554432
kern.sysv.shmall=33554432
kern.sysv.shmseg=1024
kern.sysv.shmmni=32

After that your changes will survive restart.

TCP Fallback

Note that when a node fails to allocate shared memory segment, it will transparently switch to TCP communication.

gridgain
  • 109
  • 5