automatic reconnect of client if server went away

Bug #1011482 reported by Christoph Thielecke
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Epoptes
Fix Released
Low
Fotis Tsamis

Bug Description

Its nessary if the client cant connect to server / connect to server lost that the client does a polling every minute to establish the connection again.

Revision history for this message
Alkis Georgopoulos (alkisg) wrote :

When epoptes was first developed, it targeted LTSP netbooted computer labs, where the clients would crash anyway if the network connection was ever lost. So the reconnection feature was skipped in order to minimize RAM usage for thin clients.

It will be implemented in a future version, since now epoptes also targets non LTSP installations as well.

Changed in epoptes:
status: New → Confirmed
Revision history for this message
Kevin (wittyman37) wrote :

Is there some script I can place on the clients that will check to see if epoptes is connected, and then reconnect if it is not?

Revision history for this message
Alkis Georgopoulos (alkisg) wrote :

We want to solve this in a good way that's why we're postponing it until the networking backend is redesigned.

In the meantime, you could try editing /usr/sbin/epoptes-client,
and replacing:
    exec socat openssl-connect:$SERVER:$PORT,$cert_param,interval=60,forever EXEC:"$cmdline"
with:
   while ! socat openssl-connect:$SERVER:$PORT,$cert_param,interval=60,forever EXEC:"$cmdline"; do sleep 1; done

and:
    exec socat tcp:$SERVER:$PORT,interval=60,forever EXEC:"$cmdline",nofork
with:
    while ! socat tcp:$SERVER:$PORT,interval=60,forever EXEC:"$cmdline",nofork; do sleep 1; done

That might work but I haven't tested it.

Revision history for this message
Laércio de Sousa (lbssousa) wrote :

Alkis,

In my tests (server running Ubuntu 12.04;, clients running Ubuntu 10.04), your solution didn't work.

Fortunately, I rapidly realized that socat exits with code 0 when I disconnect the server, thus I removed the "!"s in while clauses. Now the automatic reconnection works.

Thanks a lot!

Revision history for this message
Laércio de Sousa (lbssousa) wrote :

I've just uploaded a new branch with this solution, for anyone interested.

lp:~oiteam/epoptes/auto-reconnect

Revision history for this message
Laércio de Sousa (lbssousa) wrote :

I'm testing auto-reconnect branch in three different situations:

- server reboots
- server disconnects (loses IP)
- client disconnects

In all cases, I get auto reconnection in almost all tries. In some tries, however, a given client reconnects, but does not show thumbnails (in other words, EM_SYSTEM reconnects, but EM_SESSION doesn't).

Still working on it...

Revision history for this message
Dave (dstien) wrote :

Good work, guys...keep it up.

I'm working with a couple of mobile labs full of laptops. This is my biggest problem. Whenever students close the laptop the connection is lost and does not re-establish automatically. I've also experienced cases where it seems like the connection just fails for other reasons. I am really looking forward to having the reconnect work well.

What are the chances this will land in Epoptes for 12.04?

Revision history for this message
Laércio de Sousa (lbssousa) wrote :

Dave,

If you wanna try, you can download the epoptes-client script from auto-reconnect branch and put it in folder /usr/sbin in your clients.

http://bazaar.launchpad.net/~oiteam/epoptes/auto-reconnect/view/head:/epoptes-client/epoptes-client

I maintain a PPA with daily updates of Epoptes code, plus some branches I maintain for multiseat purposes (intended for use in computers of project ProInfo, Brazil). The auto-reconnect branch is also included in this PPA.

This PPA contains packages for all supported Ubuntu releases (lucid, precise, quantal, raring).

ppa:oiteam/epoptes-daily

Revision history for this message
Yannis Tsop (ogiannhs) wrote :

Should't this branch be merged to epoptes trunk? I have also tested it and works just fine. it is far better now with the reconnection of the clients (when the server looses connection to the network or just reboots)

Revision history for this message
Rodolfo Ribeiro (rarp555) wrote :

hello I'm in trouble with auto -reconnect customers 'm trying to put the link of the script :

http://bazaar.launchpad.net/~oiteam/epoptes/auto-reconnect/annotate/head:/epoptes-client/epoptes-client

crontab but it is not working because the script needs of the active terminal session would help me because I am new to linux environment.

Sorry for the English because it was translated with google translator

Revision history for this message
Laércio de Sousa (lbssousa) wrote :

Hi there!

Instead of hacking /usr/sbin/epoptes-client, I've written a wrapper script to be executed instead in /etc/xdg/autostart/epoptes-client.desktop. Here's the code (tested on Xubuntu 15.04):

#!/bin/sh

old_hostname=$(hostname)

[ -x /usr/bin/nm-online ] && nm-online --timeout=600

until [ "$State" = "closing" ]
do
    new_hostname=$(hostname)

    if [ "${new_hostname}" != "${old_hostname}" ]
    then
        cookie=$(xauth list ${old_hostname}/unix${DISPLAY} | cut -f5 -d' ')
        xauth add "${new_hostname}/unix${DISPLAY}" "MIT-MAGIC-COOKIE-1" ${cookie}
        old_hostname=${new_hostname}
    fi

    epoptes-client
    eval $(loginctl show-session ${XDG_SESSION_ID} | grep "State")
done

Revision history for this message
calin (bobescalin2002) wrote :

Laércio de Sousa (lbssousa) how did you run the script? Where did you put it?

I have the same problem using 32 pc using linux mint xfce 17.2 in a lab, the clients disconects...

Revision history for this message
Alkis Georgopoulos (alkisg) wrote :

Hi guys,

Reconnections were implemented in:
http://bazaar.launchpad.net/~epoptes/epoptes/trunk/revision/458

Keeping the connections were implemented in:
http://bazaar.launchpad.net/~epoptes/epoptes/trunk/revision/457

And there will be another commit for reconnecting the GUI to the epoptes service.

There are builds available in the epoptes daily builds ppa.

Please comment on if the above commits work for you!

Changed in epoptes:
assignee: nobody → Fotis Tsamis (ftsamis)
importance: Undecided → Low
status: Confirmed → Fix Committed
Revision history for this message
ippsatsi (laz133) wrote :

I installed from epoptes daily builds ppa, (epoptes_0.5.8+bzr461+oi3+201511230531~ubuntu14.04.1_all.deb) in the server and the client and the reconnection works very well.

But when I click on the information button, this does not work and the terminal shows me this error:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/epoptes/ui/gui.py", line 474, in on_tb_client_properties_clicked
    dlg = ClientInformation(self.getSelectedClients(), self.daemon.command)
  File "/usr/lib/python2.7/dist-packages/epoptes/ui/client_information.py", line 60, in __init__
    uname, realname = inst.users[client[C_SESSION_HANDLE]].values()
ValueError: too many values to unpack

I assume that is because in the source code there are pieces of code for multiseat environments, for example I found it in /usr/lib/python2.7/dist-packages/epoptes/core/structs.py:

   def add_user(self, username, realname, seat, handle):
        self.users[handle] = {'uname' : username, 'rname' : realname, 'seat' : seat}

Revision history for this message
Alkis Georgopoulos (alkisg) wrote :

@ippsatsi, the package version number suggests that you used this PPA:
https://launchpad.net/~oiteam/+archive/ubuntu/epoptes

AFAIK this is Laércio's PPA, it's not the "official" one where the epoptes developers publish our proposed versions:
https://code.launchpad.net/~epoptes/+archive/ubuntu/proposed

Remove it from your sources (sudo rm /etc/apt/sources.list.d/epoptes*), and try this instead:
sudo add-apt-repository ppa:epoptes/proposed
sudo apt-get update
sudo apt-get dist-upgrade

In the end, verify that you have this version installed:
0.5.8-1+r462~ubuntu14.04.1

Revision history for this message
ippsatsi (laz133) wrote :

Thanks, i'll try.

Revision history for this message
Alkis Georgopoulos (alkisg) wrote :

Fix released in epoptes 0.5.9.

Changed in epoptes:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.