> Yes.

That's weird, it sounds like sessions are accumulating in the database, but not
printed out. This shouldn't happen, since sessions in the failed state should be
automatically removed when executing this program (and also indirectly through
this mechanism by x2gocleansessions.)

Probably not something you are likely to run into a hard limit with, but we
should keep that mind.

On another server that works OK I just killed an X2Go session from August!
student    21855  0.0  0.0 151456   632 ?        S    Aug31   0:23 /usr/lib64/nx/../x2go/bin/x2goagent -extension XFIXES -nolisten tcp -nolisten tcp -dpi 120 -D -auth /home/students/student/.Xauthority -geometry 800x600 -name X2GO-student-50-1504212607_stDKDE_dp32 :50
 
The issue should be gone in the current nightly build:
https://code.x2go.org/releases/X2GoClient_nightly_macosx/x2goclient-4.1.1.1.git20171103.1695.heuler.OSX_10_10.dmg

I'm having a colleague test and I'll do the same this weekend. 
 
It's very difficult for me to debug it that way, though. It would really help to
be able to reproduce that issue.

Can I provide anything else? Could NIS be contributing to this?
 
It looks like your $HOME path is a bit unusual, is that also the case on the
machine that works? I assume $HOME is set correctly? (Given from your
interactive shell examples, I assume that to be true.)

It fails with NIS users and local users. On the working and non-working machine, I try with a local user and both $HOME are set as follows:
echo $HOME
/home/localguy

We've also tried to use a plain-vanilla .bashrc and .bash_profile, no difference.

Could there be any other installed package causing a conflict?

This also fails from a PC 4.1.0.0 client, BTW some logs:

config.pa:
load-module module-native-protocol-tcp port=4713 auth-cookie=C:\\Users\\me\\X2GO~1\\pulse\\.pulse-cookie
load-module module-esound-protocol-tcp port=4714
load-module module-waveout record=1 playback=1

session.log:
NXPROXY - Version 3.5.0
Copyright (C) 2001, 2010 NoMachine.
See http://www.nomachine.com/ for more information.
Info: Proxy running in client mode with pid '12300'.
Session: Starting session at 'Fri Nov  3 14:53:23 2017'.
Info: Connecting to remote host 'localhost:62126'.
Info: Connection to remote proxy 'localhost:62126' established.
Info: Connection with remote proxy completed.
Warning: Unrecognized session type 'unix-kde-depth_32'. Assuming agent session.
Warning: Failed to read data from the X auth command.
Warning: Generated a fake cookie for X authentication.
Info: Using ADSL link parameters 512/24/1/0.
Info: Using cache parameters 4/4096KB/8192KB/8192KB.
Info: Using pack method '16m-jpeg-9' with session 'unix-kde-depth_32'.
Info: Using ZLIB data compression 1/1/32.
Info: Using ZLIB stream compression 4/4.
Info: No suitable cache file found.
Info: Forwarding X11 connections to display 'localhost:1'.
Session: Session started at 'Fri Nov  3 14:53:23 2017'.
Warning: Protocol mismatch or no X authentication data.
Session: Terminating session at 'Fri Nov  3 14:53:28 2017'.
Info: Your session was closed before reaching a usable state.
Info: This can be due to the local X server refusing access to the client.
Info: Please check authorization provided by the remote X application.
Session: Session terminated at 'Fri Nov  3 14:53:28 2017'.

pulse.log:
I: [(null)] pulsecore/core-util.c: Successfully gained high priority class.
I: [(null)] daemon/main.c: This is PulseAudio 7.1
D: [(null)] daemon/main.c: Compilation host: i686-w64-mingw32
D: [(null)] daemon/main.c: Compilation CFLAGS: -O2 -g -pipe -Wall -fexceptions --param=ssp-buffer-size=4 -mms-bitfields -W -Wextra -Wno-long-long -Wno-overlength-strings -Wunsafe-loop-optimizations -Wundef -Wformat=2 -Wlogical-op -Wsign-compare -Wformat-security -Wmissing-include-dirs -Wformat-nonliteral -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-align -Wstrict-aliasing -Wwrite-strings -Wno-unused-parameter -ffast-math -fno-common -fdiagnostics-show-option -fdiagnostics-color=auto
D: [(null)] daemon/main.c: Running on host: Windows 6.2 (9200) 
D: [(null)] daemon/main.c: Found 1 CPUs.
I: [(null)] daemon/main.c: Page size is 4096 bytes
D: [(null)] daemon/main.c: Compiled with Valgrind support: no
D: [(null)] daemon/main.c: Running in valgrind mode: no
D: [(null)] daemon/main.c: Running in VM: no
D: [(null)] daemon/main.c: Optimized build: yes
D: [(null)] daemon/main.c: FASTPATH defined, only fast path asserts disabled.
I: [(null)] daemon/main.c: Machine ID is WIN-D6332QZL.
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on this platform.
I: [(null)] daemon/main.c: Using runtime directory C:\Users\me\.x2go\pulse\.pulse\WIN-D6332QZL-runtime.
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on this platform.
I: [(null)] daemon/main.c: Using state directory C:\Users\me\.x2go\pulse\.pulse.
I: [(null)] daemon/main.c: Using modules directory C:\Program Files (x86)\x2goclient\pulse\lib\pulse-7.1\modules.
I: [(null)] daemon/main.c: Running in system mode: no
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on this platform.
I: [(null)] daemon/main.c: Fresh high-resolution timers available! Bon appetit.
W: [(null)] pulsecore/core.c: Failed to allocate shared memory pool. Falling back to a normal memory pool.
D: [(null)] pulsecore/memblock.c: Using private memory pool with 1024 slots of size 64.0 KiB each, total size is 64.0 MiB, maximum usable slot size is 65496
I: [(null)] pulsecore/cpu-x86.c: CPU flags: CMOV MMX SSE SSE2 SSE3 SSSE3 SSE4_1 SSE4_2 
I: [(null)] pulsecore/svolume_mmx.c: Initialising MMX optimized volume functions.
I: [(null)] pulsecore/remap_mmx.c: Initialising MMX optimized remappers.
I: [(null)] pulsecore/svolume_sse.c: Initialising SSE2 optimized volume functions.
I: [(null)] pulsecore/remap_sse.c: Initialising SSE2 optimized remappers.
I: [(null)] pulsecore/sconv_sse.c: Initialising SSE2 optimized conversions.
I: [(null)] pulsecore/svolume_orc.c: Initialising ORC optimized volume functions.
D: [(null)] pulsecore/cli-command.c: Parsing script 'C:\Users\rkudyba\.x2go\pulse\config.pa'
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on this platform.
I: [(null)] pulsecore/module.c: Loaded "module-native-protocol-tcp" (index: #0; argument: "port=4713 auth-cookie=C:\\Users\\me\\X2GO~1\\pulse\\.pulse-cookie").
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on this platform.
I: [(null)] pulsecore/module.c: Loaded "module-esound-protocol-tcp" (index: #1; argument: "port=4714").
W: [(null)] modules/module-waveout.c: Sample spec not supported by WaveIn, falling back to default sample rate.
E: [(null)] modules/module-waveout.c: Failed to open WaveIn.
E: [(null)] modules/module-waveout.c: Error: A device ID has been used that is out of range for your system.
E: [(null)] pulsecore/module.c: Failed to load module "module-waveout" (argument: "record=1 playback=1"): initialization failed.
E: [(null)] daemon/main.c: Module load failed.
E: [(null)] daemon/main.c: Failed to initialize daemon.
I: [(null)] pulsecore/module.c: Unloading "module-esound-protocol-tcp" (index: #1).
I: [(null)] pulsecore/module.c: Unloaded "module-esound-protocol-tcp" (index: #1).
I: [(null)] pulsecore/module.c: Unloading "module-native-protocol-tcp" (index: #0).
I: [(null)] pulsecore/module.c: Unloaded "module-native-protocol-tcp" (index: #0).
I: [(null)] daemon/main.c: Daemon terminated.
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on this platform.

sshLogs:
debug1: Bind to port 7022 on ::.
Server listening on :: port 7022.
debug1: Bind to port 7022 on 0.0.0.0.
Server listening on 0.0.0.0 port 7022.
debug1: fd 6 clearing O_NONBLOCK
debug1: Forked child 1432.
debug1: rexec start in 6 out 6 newsock 6 pipe 8 sock 9
debug1: fd 6 clearing O_NONBLOCK
debug1: inetd sockets after dupping: 5, 5
debug1: Forked child 11432.
debug1: rexec start in 6 out 6 newsock 6 pipe 9 sock 10
Connection from 127.0.0.1 port 65288 on 127.0.0.1 port 7022
Did not receive identification string from 127.0.0.1
debug1: inetd sockets after dupping: 5, 5
Connection from 127.0.0.1 port 65289 on 127.0.0.1 port 7022
Did not receive identification string from 127.0.0.1