After some hours of activity connections refuse to start with message “The connection with the server was lost”
Under certain condition depending on the system configuration, NoMachine connections fail to start after some hours of normal activity. In similar cases a restart of nxserver helps, but the problem re-occurs later.
Users receive message “The connection with the server was lost” and the nxserver.log file reports:
Error is: 24, 'Too many open files'
Message "Too many open files" is generally not a NoMachine issue, but a topic of operating system configuration.
Both nxserver and nxnode have around 50 open files per session.
For one active session, lsof(8) tells:
# lsof | grep nxserver | wc -l
45
# lsof | grep nxnode | wc -l
49
The nx server runs under the UID of the nx user, nxnode runs under the UID of the user invoking the session.
For the nx user, the default limit of 1024 is surpassed with 23 sessions.
To increase the allowed number of open files, add the following lines to /etc/security/limits.conf:
nx soft nofile 65535
nx hard nofile 65535
Change 'nx' to '*' if you want to give the above limits to all users.
To view the number of overall open files on the system and their limits, use the following commands:
# lsof | wc -l
# cat /proc/sys/fs/file-max
To increase the system limits, run
# echo 16777216 > /proc/sys/fs/file-max
To make the changes permanent, edit /etc/sysctl.conf and add the line
fs.file-max = 16777216
To reload /etc/sysctl.conf, run the command
sysctl -p /etc/sysctl.conf
