Subject: PyHoca GUI still showing terminated session (error: Semaphore released too many times)

From: Michael Ledin <[email-masked]>
Date: Thu, 16 Mar 2017 21:42:56 +0300

Package: pyhoca-gui

Version: 0.5.0.4

I'm using Archlinux and installed pyhoca-gui from AUR. Before that I 
used x2goclient and created several profiles there so in pyhoca-gui I 
continued to use these profiles.

I connect to server and then start new desktop environment (XFCE). Then 
I try to terminate the session. It terminated but PyHoca still shows it 
in server menu like "Running: ...session name here" but in gray color 
and session menu is not accessible so I can not terminate it again.

Here is the full log for "pyhoca-gui -d":

21:25:37: Warning: Mismatch between the program and library build 
versions detected.
The library used 3.0 (wchar_t,compiler with C++ ABI 1010,wx 
containers,compatible with 2.8),
and wxPython used 3.0 (wchar_t,compiler with C++ ABI 1009,wx 
containers,compatible with 2.8).
pyhoca-gui[11764] (PyHoca-GUI) DEBUG: PyHoca-GUI's user interface 
language is: en_US.
pyhoca-gui[11764] (PyHoca-GUI) INFO: PyHoca GUI is starting up
pyhoca-gui[11764] (PyHoca-GUI) INFO: start TaskBarIcon of type: 
('__WXGTK__', 'wxGTK', 'unicode', 'gtk2', 'wx-assertions-on', 'SWIG-1.3.29')
pyhoca-gui[11764] (PyHoca-GUI) WARN: the current release of PyHoca-GUI 
does not support client configuration
pyhoca-gui[11764] (x2gosessregistry-pylib) NOTICE: registering X2Go 
session AppHeads WAN...
pyhoca-gui[11764] (x2goclient-pylib) NOTICE: initializing X2Go session...
pyhoca-gui[11764] (x2gocontrolsession-pylib) NOTICE: connecting to 
[my.domain.here]:22
pyhoca-gui[11764] (PyHoca-GUI) NOTICE: [AppHeads WAN - connect] SSH key 
authentication has been successful.
pyhoca-gui[11764] (x2gosessregistry-pylib) NOTICE: using already 
initially-registered yet-unused session fa565712-0a75-11e7-9d4b-58946b494d4c
pyhoca-gui[11764] (x2goclient-pylib) NOTICE: initializing X2Go session...
pyhoca-gui[11764] (x2gosession-pylib) NOTICE: Using session 
appheads-50-1489688865_stDXFCE_dp24 as master session for profile 
AppHeads WAN.
pyhoca-gui[11764] (PyHoca-GUI) NOTICE: [AppHeads WAN - start] New X2Go 
session starting up... appheads-50-1489688865_stDXFCE_dp24
pyhoca-gui[11764] (x2goterminalsession-pylib) NOTICE: x2goumount-session 
(all mounts) for session appheads-50-1489688865_stDXFCE_dp24 has been 
successful
pyhoca-gui[11764] (x2goterminalsession-pylib) NOTICE: cleaning up 
session appheads-50-1489688865_stDXFCE_dp24 after termination
Traceback (most recent call last):
   File "/usr/lib/python2.7/site-packages/gevent/greenlet.py", line 536, 
in run
     result = self._run(*self.args, **self.kwargs)
   File "/usr/lib/python2.7/site-packages/x2go/client.py", line 1680, in 
terminate_session
     return session.terminate()
   File "/usr/lib/python2.7/site-packages/x2go/session.py", line 2374, 
in terminate
     self._lock.release()
   File "src/gevent/_semaphore.py", line 266, in 
gevent._semaphore.BoundedSemaphore.release 
(src/gevent/gevent._semaphore.c:5353)
   File "src/gevent/_semaphore.py", line 268, in 
gevent._semaphore.BoundedSemaphore.release 
(src/gevent/gevent._semaphore.c:5291)
error: Semaphore released too many times
Thu Mar 16 21:26:52 2017 <Greenlet at 0x7f340f8a5910: <bound method 
PyHocaGUI.terminate_session of <pyhoca.wxgui.frontend.PyHocaGUI; proxy 
of <Swig Object of type 'wxPyApp *' at 0x55e7af0c6320> 
 >>('fa565712-0a75-11e7-9d4b-58946b494d4c', 
session_name='appheads-50-1489688865_stDXFCE_dp24', 
match_profile_name=u'AppHeads WAN')> failed with error

Exception in thread Thread-1:
Traceback (most recent call last):
   File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
     self.run()
   File "/usr/lib/python2.7/threading.py", line 754, in run
     self.__target(*self.__args, **self.__kwargs)
   File "/usr/lib/python2.7/site-packages/x2go/guardian.py", line 116, 
in guardian
     update_mounts=self.auto_update_listmounts_cache,
   File "/usr/lib/python2.7/site-packages/x2go/client.py", line 3148, in 
update_cache_all_profiles
     update_mounts=update_mounts,
   File "/usr/lib/python2.7/site-packages/x2go/client.py", line 3089, in 
update_cache_by_profile_name
     self.listsessions_cache.update(profile_name, 
update_sessions=_update_sessions, update_desktops=_update_desktops, 
update_mounts=_update_mounts, )
   File "/usr/lib/python2.7/site-packages/x2go/cache.py", line 135, in 
update
     self._update_sessions(profile_name, control_session)
   File "/usr/lib/python2.7/site-packages/x2go/cache.py", line 204, in 
_update_sessions
     self.x2go_listsessions_cache[profile_name]['sessions'] = 
control_session.list_sessions()
   File 
"/usr/lib/python2.7/site-packages/x2go/backends/control/plain.py", line 
1749, in list_sessions
     self.associated_terminals[_session_name].__del__()
   File 
"/usr/lib/python2.7/site-packages/x2go/backends/terminal/plain.py", line 
413, in __del__
     self._x2go_tidy_up()
   File 
"/usr/lib/python2.7/site-packages/x2go/backends/terminal/plain.py", line 
424, in _x2go_tidy_up
     self._share_local_folder_lock.release()
   File "src/gevent/_semaphore.py", line 266, in 
gevent._semaphore.BoundedSemaphore.release 
(src/gevent/gevent._semaphore.c:5353)
   File "src/gevent/_semaphore.py", line 268, in 
gevent._semaphore.BoundedSemaphore.release 
(src/gevent/gevent._semaphore.c:5291)
error: Semaphore released too many times

If I'll try then to disconnect from server then GUI shows that server is 
disconnected but I still will get the following log output:

pyhoca-gui[11764] (PyHoca-GUI) NOTICE: [AppHeads WAN - disconnect] X2Go 
Profile is now disconnected.
Traceback (most recent call last):
   File "/usr/lib/python2.7/site-packages/gevent/greenlet.py", line 536, 
in run
     result = self._run(*self.args, **self.kwargs)
   File "/usr/lib/python2.7/site-packages/x2go/client.py", line 3005, in 
disconnect_profile
     _retval = s.disconnect() | _retval
   File "/usr/lib/python2.7/site-packages/x2go/session.py", line 1377, 
in disconnect
     self._lock.release()
   File "src/gevent/_semaphore.py", line 266, in 
gevent._semaphore.BoundedSemaphore.release 
(src/gevent/gevent._semaphore.c:5353)
   File "src/gevent/_semaphore.py", line 268, in 
gevent._semaphore.BoundedSemaphore.release 
(src/gevent/gevent._semaphore.c:5291)
error: Semaphore released too many times
Thu Mar 16 21:28:59 2017 <Greenlet at 0x7f340f8a5370: <bound method 
PyHocaGUI.disconnect_profile of <pyhoca.wxgui.frontend.PyHocaGUI; proxy 
of <Swig Object of type 'wxPyApp *' at 0x55e7af0c6320> >>(u'AppHeads 
WAN')> failed with error

Next if I try to connect to server again then GUI looks like I was 
connected to server, but previously terminated session is showed like 
running (though pressing "Show session windows" results in nothing) and 
"An unknown error occured during authentication" message is popped up 
and the following log is outputed:

pyhoca-gui[11764] (x2gosessregistry-pylib) NOTICE: registering X2Go 
session AppHeads WAN...
pyhoca-gui[11764] (x2goclient-pylib) NOTICE: initializing X2Go session...
pyhoca-gui[11764] (PyHoca-GUI) NOTICE: [AppHeads WAN - unknown error] An 
unknown error occurred during authentication!
Traceback (most recent call last):
   File "/usr/lib/python2.7/site-packages/gevent/greenlet.py", line 536, 
in run
     result = self._run(*self.args, **self.kwargs)
   File "/usr/lib/python2.7/site-packages/pyhoca/wxgui/frontend.py", 
line 636, in _do_authenticate
     self._X2GoClient__connect_session(session_uuid, 
add_to_known_hosts=self.add_to_known_hosts)
   File "/usr/lib/python2.7/site-packages/x2go/client.py", line 1367, in 
connect_session
     sshproxy_force_password_auth=sshproxy_force_password_auth,
   File "/usr/lib/python2.7/site-packages/x2go/session.py", line 1355, 
in connect
     self.update_status()
   File "/usr/lib/python2.7/site-packages/x2go/session.py", line 1603, 
in update_status
     session_list = self.control_session.list_sessions()
   File 
"/usr/lib/python2.7/site-packages/x2go/backends/control/plain.py", line 
1749, in list_sessions
     self.associated_terminals[_session_name].__del__()
   File 
"/usr/lib/python2.7/site-packages/x2go/backends/terminal/plain.py", line 
413, in __del__
     self._x2go_tidy_up()
   File 
"/usr/lib/python2.7/site-packages/x2go/backends/terminal/plain.py", line 
424, in _x2go_tidy_up
     self._share_local_folder_lock.release()
   File "src/gevent/_semaphore.py", line 266, in 
gevent._semaphore.BoundedSemaphore.release 
(src/gevent/gevent._semaphore.c:5353)
   File "src/gevent/_semaphore.py", line 268, in 
gevent._semaphore.BoundedSemaphore.release 
(src/gevent/gevent._semaphore.c:5291)
error: Semaphore released too many times
Thu Mar 16 21:34:17 2017 <Greenlet at 0x7f340f8a5370: <bound method 
PyHocaGUI._do_authenticate of <pyhoca.wxgui.frontend.PyHocaGUI; proxy of 
<Swig Object of type 'wxPyApp *' at 0x55e7af0c6320> 
 >>(<wx._core.CommandEvent; proxy of <Swig Object of t, 
'299442ea-0a77-11e7-9d4b-58946b494d4c')> failed with error

After that if I press "Disconnect from server" nothing happens except 
showing popup that profile is disconnected though GUI says that there is 
still active connection and I even can start new desktop session.

pyhoca-cli also has that "Semaphore released too many times" error. I 
will report it as separate bug.

--

Michael Ledin