[Xrdp-devel] SIGPIPE and reconnection issues

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Xrdp-devel] SIGPIPE and reconnection issues

Nicola Ruggero
Hello all,
first many thanks for your great work! I'm a system administrator with
very few C knowledge but I'm working on xrdp since april 2010 in order
to understand deeply how it works.

I did some patch to xrdp (0.5.0) in order to have the following
features implemented for my company:
- Using the same unix user for all sessions (startwm -> X11rdp +
firefox + java_vm) distinguishing the sessions by a "terminal_id".

so the code was modified as below:
- Username does not identify anymore the session, a "terminal_id" is
used instead
- Directory field has been replaced. This field now contains the
"terminal_id" (aka: unique number that identify the terminal server
client)
- If directory field is empty, then it failback using usernames to
identify sessions
- terminal_id is also passed as parameter to session startup script
- Some logging improved to identify connections, reconnection, disconnections

this patches are very light and they work very well but sometimes the
session hangs during reconnection in this way:
1. I can see login windows
2. connecting to sesman ok
3. connecting (xup)
4. connected ok
5. it freezes a little bit here and then the connection closes itself :(

it happens randomly so it is difficult to analyse. What I found is
that sometime the xrdp-chansrv session process got creazy because of
SIGPIPE.

Here the log:
xrdp-chansrv [0552054173]: main: using DISPLAY 28
xrdp-chansrv [0552054257]: channel_thread_loop: thread start
xrdp-chansrv [0552054934]: send_init_response_message:
xrdp-chansrv [0552054946]: clipboard_init: g_xfixes_event_base 106
xrdp-chansrv [0552054947]: clipboard_init st 1, maj 4 min 0
xrdp-chansrv [0552135738]: channel_thread_loop: trans_check_wait_objs
error resetting
xrdp-chansrv [0552144866]: send_init_response_message:
xrdp-chansrv [0552144871]: clipboard_init: g_xfixes_event_base 106
xrdp-chansrv [0552144871]: clipboard_init st 1, maj 4 min 0
xrdp-chansrv [0552180176]: nil_signal_handler: got signal 13
<last line repeated infinitively>

What can I do? I thought to patch chansrv.c in this way:

Index: chansrv.c
===================================================================
--- chansrv.c   (revision 2678)
+++ chansrv.c   (working copy)
@@ -519,6 +519,7 @@
 nil_signal_handler(int sig)
 {
   LOG(1, ("nil_signal_handler: got signal %d", sig));
+  g_set_wait_obj(g_term_event);
 }

i'm still testing but not sure it will fix this strange behaviour... any idea?

thanks,
Nicola

Ps. I already checked the kernel parameters (like number open files
etc...) and seems to be ok.

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
xrdp-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/xrdp-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Xrdp-devel] SIGPIPE and reconnection issues

Nicola Ruggero
2010/6/10 Nicola Ruggero <[hidden email]>:
> this patches are very light and they work very well but sometimes the
> session hangs during reconnection in this way:
> 1. I can see login windows
> 2. connecting to sesman ok
> 3. connecting (xup)
> 4. connected ok
> 5. it freezes a little bit here and then the connection closes itself :(
>
[CUT]
>
> What can I do? I thought to patch chansrv.c in this way:
>
[CUT]
>
> i'm still testing but not sure it will fix this strange behaviour... any idea?
>
> thanks,
> Nicola
>

This patch seems to solve my problem (again r280 of
svn://server1.xrdp.org/srv/svn/repos/main/x11rdp_xorg71):

--- trunk/prjVari/x11rdp_xorg71/xorg-server-X11R7.1-1.1.0/hw/rdp/rdpup.c 2010/01/08
09:17:13 1825
+++ trunk/prjVari/x11rdp_xorg71/xorg-server-X11R7.1-1.1.0/hw/rdp/rdpup.c 2010/06/14
10:18:53 2691
@@ -417,9 +417,29 @@
     }
     else
     {
-      rdpLog("rejecting connection, already got a connection\n");
+      rdpLog("resetting connection, already got a connection\n");
       g_sleep(10);
-      g_tcp_close(g_tcp_accept(g_listen_sck));
+      RemoveEnabledDevice(g_sck);
+      g_connected = 0;
+      g_tcp_close(g_sck);
+      g_sck = 0;
+      g_sck_closed = 1;
+
+      /* Retry connections */
+      g_sck = g_tcp_accept(g_listen_sck);
+      if (g_sck == -1)
+      {
+        g_sck = 0;
+      }
+      else
+      {
+        g_tcp_set_non_blocking(g_sck);
+        g_tcp_set_no_delay(g_sck);
+        g_connected = 1;
+        g_sck_closed = 0;
+        AddEnabledDevice(g_sck);
+      }
+
     }
   }
   if (sel & 2

Regards,
Nicola

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
xrdp-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/xrdp-devel
Loading...