Am 23.03.2013 16:54, Mike Gabriel schrieb:
You experience a race condition where the server tries to allocate a display port per session and if two users log in very simulataneously, the second user won't get a valid display.
I am not sure if this can be avoided really reliably. However, instead of incrementing the X2GO_PORT by 1 in x2gostartagent (in case the probed port is not usable anymore) we could increment the X2GO_PORT by some random value (between 1 and 30). Then it could still be that two clients try to get the same DISPLAY port (in case two random calls deliver the same value), but the failing logins should reduce by far.
No, adding randomness is doing it wrong! Normally the db should make sure that no display and the associated port is applied twice. Probably we should check the sqlite code anyway, because sqlite does not support concurrency out of the box. Additionally, if I remember right, before that stuff was rewritten to perl, I wrote an while-loop that looped through the displays until it had a valid display and free ports. Maybe that somehow got lost during the rewrite. Anyway something like that should be added. Maybe: If the agent fails to start check whether ports or display might have been the reason and retry n times silently.
Morty