Comments (15)
This is clearly a regression so I tagged it according.
from freerdp.
I reckon xfreerdp gets stuck in the select, which handles fds from tcp, window events, among others. This way, it can't detect a connection failure.
xfreerdp.c's select:
freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) ... freerdp_channels_get_fds(channels, instance, rfds, &rcount, wfds, &wcount) ... xf_get_fds(instance, rfds, &rcount, wfds, &wcount) ... if (select(max_fds + 1, &rfds_set, &wfds_set, NULL, NULL) == -1)
from freerdp.
I think this select ought to enforce a timeout to allow you to handle the non-connection case. This way you might be able to check the specific fds to know if it is really working or not. IIRC the RDP has a keep-alive type of package and thus this ought to allow us to proper detect this case.
from freerdp.
@otavio I added some code today to have select() timeout after some time, which lets us do something. But then I couldn't figure out a way to get proper disconnection detection. We'll need to keep looking into it I guess.
from freerdp.
Easy to test, if you are connecting to a remote VM you can just unplug the network cable (phsically or virtual) from it and see how the system behaves.
from freerdp.
Any updated on this? Right now the latest git gives a black window and sits there forever. When I bring the server back online, the RDP window exits.
from freerdp.
@rbhkamal thanks for the update - there isn't a fix for now ;( but I hope we can fix this for 1.1
from freerdp.
I'm trying to hack in a fix and it seems like there are two places where XFreeRDP gets stuck. The first place is in libfreerdp/utils/tcp.c: freerdp_tcp_wait_write. There is a select statement there that hangs the entire program IF the user generates mouse clicks while the server is down. I fixed that by putting a 10 second timeout and made freerdp_tcp_wait_write return -1.
The second part is in the client code (same place as 2 years ago) xf_interface.c: xf_thread.
select(max_fds + 1, &rfds_set, NULL, NULL, &timeout)
I don't quite understand what the rfds_set is, is it only for X11 events?
The problem I believe can be solved by simply creating a function that checks the status of the transport sockets and use it when the select above times out.
Something like this:
state = select(socketfds+1, &fds, , NULL, &timeout)
if (state == 0)
// See if reading/writing from socket produces an error (any error)
state = recv(sockfs, data, length, 0);
if ( state <= 0)
abort or increment a counter or start a timer to close everything.
I'm not an expert in RDP protocol but is there such thing like heartbeats for RDP?
http://stackoverflow.com/questions/5640144/c-how-to-use-select-to-see-if-a-socket-has-closed
bool isclosed(int sock) {
fd_set rfd;
FD_ZERO(&rfd);
FD_SET(sock, &rfd);
timeval tv = { 0 };
select(sock+1, &rfd, 0, 0, &tv);
if (!FD_ISSET(sock, &rfd))
return false;
int n = 0;
ioctl(sock, FIONREAD, &n);
return n == 0;
}
from freerdp.
Setting keepalive on the socket fixes everything, not sure of this is a real solution but at least it is a workaround.
from freerdp.
still effecting latest for me kubuntu 14.04
from freerdp.
When activating keep alive (as @rbhkamal mentioned) it works in most cases but not if there is still outgoing data pending in the TCP socket.
I believe this issue should be finally fixed once #2409 is merged. (When all keep alive settings and TCP_USER_TIMEOUT is available and compiled in)
from freerdp.
Closing this issue due to inactivity. If the problem still exists with the current master branch please re-open or create a new one.
from freerdp.
This is still an issue but not universally. Just had about 50 machines lose connection to the host. After ~5-10 minutes some machines closed off the client (which is still a surprisingly long time), others just stayed frozen indefinitely. Even worse is that xFreeRDP wouldn't release the keyboard so users couldn't actually type outside of xFreeRDP anymore either (or kill it off with keyboard commands).
from freerdp.
@Enverex seems quite long true but there shouldn't be any indefinite freezes anymore (as the issues says).
For completeness what version did you experience the this behavior with?
from freerdp.
1.2.0-beta1 apparently. I can't update further because that brings in a new set of bugs regarding how multi-monitors are handled (or rather, how they aren't - specifically #2863 (comment)).
from freerdp.
Related Issues (20)
- zsh: command not found: xfreerdp HOT 2
- current master WITH_LIBRARY_VERSIONING=OFF buggy
- app_id should be set to wm-class
- clipboard data Failed to connect to a new session HOT 7
- [server terminates connection] Upgrading from 2.x to 3.x SSL read errors after connect HOT 25
- Upgrading from 2.x to 3.x introduces TLS security schema issues HOT 3
- xfreerdp 2.11.5 still broken with: "Fastpath update Bitmap [1] failed, status 0" HOT 9
- Can not use bottom of the screen with the mouse if monitor resolution differs HOT 1
- client/X11: Trying to paste copied files from a server crashes xfreerdp HOT 8
- -
- Compiler warning: xxxx called on pointer returned from a mismatched allocation function HOT 6
- More compiler warnings HOT 2
- stable-2.0 branch fails to build with GCC 14 HOT 1
- [sdl] Should /kbd:remap:KEY=VALUE work? HOT 1
- Multiple monitors acts weirdly under Plasma 6 Wayland HOT 3
- Crash is occurring in FreeRDP at the time of ERRINFO_LOGOFF_BY_USER in desktop screen in Android with Freerdp 2.11.2
- Crash is occurring in FreeRDP at the time of ERRINFO_LOGOFF_BY_USER in desktop screen in Android with Freerdp 2.11.2 HOT 4
- API Support for IANA Time Zone String Redirection in FreeRDP HOT 3
- Multitransport-flag slows down connection HOT 1
- Application "stucks" using RAIL on Gnome HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from freerdp.