Oops.  I sent this to Ty directly, now I will send it to the mailing list.

On Wed, May 20, 2009 at 4:33 PM, Ty Hahn <yosn...@gmail.com> wrote:
> On Wed, May 20, 2009 at 9:20 AM, Robert Seward
> <robert.y.sew...@gmail.com> wrote:
>> I have never experienced this, but I think there is a locking race in the
>> code.  I have been making changes for myself in this area of the code, so I
>> could come up with a change and let you try it out.  Give me a few days.
>>
>
> Actually it was not that hard for me to reproduce the situation. It's
> quite persistent.
> Writing a shell script opening two xrdp sessions was enough to reproduce.

I tried to reproduce this by opening two xrdp sessions at once, but it
never happened.  Maybe I don't have enough processors on the server.

> Anyway. Thanks for your reply and I look forward to your code.

Attached is a patch.  This patch isn't the best solution - it will
slow down the rate at which xrdp can start new sessions - but it is
simple and will let us know if I am on the right track.

Robert
Index: sesman/session.c
===================================================================
RCS file: /cvsroot/xrdp/xrdp/sesman/session.c,v
retrieving revision 1.31
diff -c -r1.31 session.c
*** sesman/session.c	20 Apr 2009 04:31:24 -0000	1.31
--- sesman/session.c	21 May 2009 16:30:44 -0000
***************
*** 424,429 ****
--- 424,443 ----
    }
    else /* parent sesman process */
    {
+     /*
+      * Wait for a while to make sure the X server starts before continuing on.
+      * We wait here so that no other thread tries to grab this display number.
+      */
+     for (i = 0; !x_server_running(display); ++i)
+     {
+       if (i > 240)
+       {
+ 	log_message(&(g_cfg->log), LOG_LEVEL_ERROR,
+ 		    "X server for display %d startup timeout", display);
+ 	return 0;
+       }
+       g_sleep(250);
+     }
      temp->item->pid = pid;
      temp->item->display = display;
      temp->item->width = width;
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
xrdp-devel mailing list
xrdp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xrdp-devel

Reply via email to