Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zombie sessions? #830

Closed
alex-p-uk opened this issue Jul 20, 2017 · 11 comments
Closed

zombie sessions? #830

alex-p-uk opened this issue Jul 20, 2017 · 11 comments
Labels
confirmed confirmed reproduction duplicate sesman

Comments

@alex-p-uk
Copy link

I'm running xrdp 0.9.2 on Ubuntu 14.04 with MaxSessions=50 and persistent sessions.

After a while clients can't connect any longer because: [20170720-14:50:35] [ERROR] X server -- no display in range is available . ps only shows around 20 Xorg sessions, but I can see some of them have display IDs above 50, which means xrdp for some reason didn't reuse lower numbers when clients disconnected and eventually reached the number that matches MaxSessions + X11DisplayOffset=10. I think this may be related to #812

Below is a log from freshly restarted xrdp. 2 things to note:

  • Xorg :11 and Xorg :12 were followed by Xorg :15 while :13 and :14 displays were free
  • it repeats that it closed more and more sockets, which may suggest those weren't real sockets or weren't actually closed

This requires to restart and drop sessions once in a while, which did not happen with xrdp-0.8. I'm happy to try any suggestions. Thank you!

[20170720-14:51:49] [DEBUG] libscp initialized
[20170720-14:51:49] [INFO ] starting xrdp-sesman with pid 8829
[20170720-14:51:49] [INFO ] listening to port 3350 on 127.0.0.1
[20170720-14:53:29] [INFO ] A connection received from 127.0.0.1 port 58417
[20170720-14:53:30] [INFO ] ++ created session (access granted): username USER1, ip 123.456.789.10:53635 - socket: 12
[20170720-14:53:30] [INFO ] starting Xorg session...
[20170720-14:53:30] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:5910)
[20170720-14:53:30] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6010)
[20170720-14:53:30] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6210)
[20170720-14:53:30] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:5911)
[20170720-14:53:30] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6011)
[20170720-14:53:30] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6211)
[20170720-14:53:31] [DEBUG] Closed socket 8 (AF_INET 127.0.0.1:3350)
[20170720-14:53:31] [DEBUG] Closed socket 9 (AF_INET 127.0.0.1:3350)
[20170720-14:53:31] [DEBUG] Closed socket 9 (AF_INET 127.0.0.1:3350)
[20170720-14:53:31] [INFO ] Xorg :11 -auth .Xauthority -config xrdp/xorg.conf -noreset -nolisten tcp -logfile .xorgxrdp.%s.log
[20170720-14:53:31] [CORE ] waiting for window manager (pid 9820) to exit
[20170720-14:54:14] [INFO ] A connection received from 127.0.0.1 port 58423
[20170720-14:54:15] [INFO ] ++ created session (access granted): username USER2, ip 123.456.789.10:12635 - socket: 12
[20170720-14:54:15] [INFO ] starting Xorg session...
[20170720-14:54:15] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:5910)
[20170720-14:54:15] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6010)
[20170720-14:54:15] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6210)
[20170720-14:54:15] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:5912)
[20170720-14:54:15] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6012)
[20170720-14:54:15] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6212)
[20170720-14:54:15] [DEBUG] Closed socket 8 (AF_INET 127.0.0.1:3350)
[20170720-14:54:15] [DEBUG] Closed socket 9 (AF_INET 127.0.0.1:3350)
[20170720-14:54:15] [DEBUG] Closed socket 9 (AF_INET 127.0.0.1:3350)
[20170720-14:54:15] [INFO ] Xorg :12 -auth .Xauthority -config xrdp/xorg.conf -noreset -nolisten tcp -logfile .xorgxrdp.%s.log
[20170720-14:54:15] [CORE ] waiting for window manager (pid 10169) to exit
[20170720-15:16:48] [INFO ] A connection received from 127.0.0.1 port 58513
[20170720-15:16:49] [INFO ] ++ created session (access granted): username USER3, ip 123.456.789.10:18603 - socket: 12
[20170720-15:16:49] [INFO ] starting Xorg session...
[20170720-15:16:49] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:5910)
[20170720-15:16:49] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6010)
[20170720-15:16:49] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6210)
[20170720-15:16:49] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:5913)
[20170720-15:16:49] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6013)
[20170720-15:16:49] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6213)
[20170720-15:16:49] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:5914)
[20170720-15:16:49] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6014)
[20170720-15:16:49] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6214)
[20170720-15:16:49] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:5915)
[20170720-15:16:49] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6015)
[20170720-15:16:49] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6215)
[20170720-15:16:49] [DEBUG] Closed socket 8 (AF_INET 127.0.0.1:3350)
[20170720-15:16:49] [DEBUG] Closed socket 9 (AF_INET 127.0.0.1:3350)
[20170720-15:16:49] [DEBUG] Closed socket 9 (AF_INET 127.0.0.1:3350)
[20170720-15:16:49] [INFO ] Xorg :15 -auth .Xauthority -config xrdp/xorg.conf -noreset -nolisten tcp -logfile .xorgxrdp.%s.log
[20170720-15:16:50] [CORE ] waiting for window manager (pid 18270) to exit
@tfischer77
Copy link

I'm facing the exact same issue on a Debian stretch system with the latest 0.9.3 branch of Xrdp. I wrote a small script (executed as a cronjob once a minute) to clean up the socket files. Since then, no complaints by the users any longer. However, that is only a workaround. My feeling is that it is a bug in sesman and should be corrected.

@metalefty
Copy link
Member

I'm working on the issue at #812. Workaround is as @tfischer77 says, run clean up script like this by cron.

https://gist.github.com/metalefty/2672c26ae0cb36f7a4bc100650c83a15

@metalefty
Copy link
Member

metalefty commented Jul 25, 2017

Merging this issue to #812 and #831.

@DS455
Copy link

DS455 commented Sep 11, 2017

@tfischer77
Can you share your script?

@metalefty
Copy link
Member

@DS455 see my gist link.

@DS455
Copy link

DS455 commented Sep 12, 2017

@metalefty

sh xrdp_clean_sockets.sh
xrdp_clean_sockets.sh: 19: xrdp_clean_sockets.sh: Syntax error: Missing '))'

then your code works https://www.tutorialspoint.com/execute_bash_online.php (bash v4.4)
On my PC the Bash v4.3 and there is an error: Syntax error: Missing '))'

I altered the script like this:

#!/bin/bash

SOCKDIR=/tmp/.xrdp
SESSIONS=`ls -l "${SOCKDIR}"/xrdp_* | sed -e 's|[^0-9]||g' | sort -u`
for i in ${SESSIONS}
do
        if [ ! -S ${SOCKDIR}/xrdp_display_${i} ]
        then
                cd ${SOCKDIR}
                rm -f xrdp_chansrv_audio_in_socket_${i} \
                        xrdp_chansrv_audio_out_socket_${i} \
                        xrdp_chansrv_socket_${i} \
                        xrdpapi_${i}
        fi
done

But the directory /tmp/.xrdp is not cleaned:

ls /tmp/.xrdp
xrdpapi_10  xrdpapi_21                        xrdp_display_15
xrdpapi_14  xrdp_chansrv_audio_in_socket_10   xrdp_display_16
xrdpapi_15  xrdp_chansrv_audio_in_socket_19   xrdp_display_17
xrdpapi_16  xrdp_chansrv_audio_out_socket_10  xrdp_display_19
xrdpapi_17  xrdp_chansrv_audio_out_socket_19  xrdp_display_20
xrdpapi_19  xrdp_display_10                   xrdp_display_21
xrdpapi_20  xrdp_display_14

@metalefty
Copy link
Member

The directory is already cleaned. No sockets should be deleted anymore.

Remember the original bug. xrdp_display_* will be deleted automatically when session exits but other sockets are not deleted automatically. The script only deletes orphan sockets. All remained sockets are not orphaned because corresponding xrdp_display_* still exists.

@metalefty
Copy link
Member

For example, if the socket directory is like this,

ls -1 /tmp/.xrdp
xrdpapi_10
xrdpapi_11
xrdp_chansrv_audio_in_socket_10
xrdp_chansrv_audio_in_socket_11
xrdp_chansrv_audio_out_socket_10
xrdp_chansrv_audio_out_socket_11
xrdp_display_11

the socket files to be deleted by the script are

  • xrdpapi_10
  • xrdp_chansrv_audio_in_socket_10
  • xrdp_chansrv_audio_out_socket_10

because xrdp_display_10 doesn't exists and *_10 are orphaned. 11 sockets will not be deleted because of existence of xrdp_display_11.

@DS455
Copy link

DS455 commented Sep 12, 2017

@metalefty
I understand, thank you.

@DS455
Copy link

DS455 commented Jun 7, 2022

Again having problems connecting, only works after restarting the service XRDP.

xrdp --version
xrdp 0.9.19
  A Remote Desktop Protocol Server.
  Copyright (C) 2004-2020 Jay Sorg, Neutrino Labs, and all contributors.
  See https://github.com/neutrinolabs/xrdp for more information.

  Configure options:
      --enable-fuse
      --enable-mp3lame
      --enable-pixman

  Compiled with OpenSSL 1.1.1f  31 Mar 2020

[20220607-08:30:44] [INFO ] Found X server running at /tmp/.X11-unix/X55
[20220607-08:30:45] [INFO ] Found X server running at /tmp/.X11-unix/X56
[20220607-08:30:45] [INFO ] Found X server running at /tmp/.X11-unix/X57
[20220607-08:30:45] [INFO ] Found X server running at /tmp/.X11-unix/X59
[20220607-08:30:45] [ERROR] X server -- no display in range (10 to 60) is available
[20220607-08:30:45] [ERROR] sesman_data_in: scp_process_msg failed
[20220607-08:30:45] [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans

@matt335672
Copy link
Member

@DS455 - you need to find out why you've got so many X servers registered on your system:-

20220607-08:30:44] [INFO ] Found X server running at /tmp/.X11-unix/X55
[20220607-08:30:45] [INFO ] Found X server running at /tmp/.X11-unix/X56
[20220607-08:30:45] [INFO ] Found X server running at /tmp/.X11-unix/X57
[20220607-08:30:45] [INFO ] Found X server running at /tmp/.X11-unix/X59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed confirmed reproduction duplicate sesman
Projects
None yet
Development

No branches or pull requests

5 participants