Too many open files
The embedded Derby database, which can be used instead of the H2 database, opens several file handles and may run over the maximum limit set by the system. This issue can occur on some Linux and OS X systems such as Macbook Air.
The solution is to increase the system-wide limit on the number of open files. The exact procedure, however, varies from one OS to another.
Ubuntu Linux
-
Find the current maximum number of open files per user in a single session:
ulimit -n
The number is
1024
by default, which is too small.A value higher than 1048576
(from Ubuntu LTS 24.01) is recommended. -
Edit the
limits.conf
file:sudo gedit /etc/security/limits.conf
-
Add the following lines to the file:
* soft nofile 10000 * hard nofile 50000
This sets for all users a soft limit of 10000 open files and a hard limit of
50000
. These are just examples. Set the limit according to your needs.The wildcard option applies only to regular users, not to superuser
. If you run Magnolia assuperuser
, replace the asterisk withroot
. -
Save the file.
-
Edit the configuration file for session-related modules:
sudo gedit /etc/pam.d/common-session
-
Add the following line to the file:
session required pam_limits.so
You may need to add the following line to
/etc/systemd/system.conf
and/etc/systemd/user.conf
:DefaultLimitNOFILE=65535
-
Save the file.
-
Restart Ubuntu.
-
Verify the new maximum number of open files:
ulimit -n
The command should now return
10000
.
OS X 14.x
-
Find the current maximum number of open files per user in a single session:
ulimit -n
The number is 256 by default, which is too small.
To check the current limits on your Mac OS X system, run the following:
launchctl limit maxfiles
The last two columns are the soft and hard limits, respectively.
-
Add
ulimit -n 65536
to your~/.profile
file. This increases the limit for the shell. -
Create a
/etc/sysctl.conf
file if it does not exist. -
Add the following lines to
/etc/sysctl.conf
:kern.maxfiles=65536 kern.maxfilesperproc=65536
This increases the limit for the kernel.
-
Open a terminal and type:
sudo sysctl -w kern.maxfiles=65536 sudo sysctl -w kern.maxfilesperproc=65536 sudo ulimit -n 65536
Or restart your system to read the settings from the files you edited.
-
Type
ulimit -n
. The response should be65536
(if not, restart your system). -
Install Magnolia
See Shell session limit and this thread for information on previous Mac OS versions.
The instructions above apply to Bash shell, not Zsh. |