Github user sanhex commented on a diff in the pull request:
https://github.com/apache/incubator-guacamole-server/pull/118#discussion_r145845105
--- Diff: src/protocols/ssh/client.c ---
@@ -70,8 +70,14 @@ int guac_ssh_client_free_handler(guac_client* client) {
/* Free terminal (which may still be using term_channel) */
if (ssh_client->term != NULL) {
- guac_terminal_free(ssh_client->term);
+ /* Close user input pipe to stop reading in ssh_input_thread */
+ close(ssh_client->term->stdin_pipe_fd[1]);
+ close(ssh_client->term->stdin_pipe_fd[0]);
+ ssh_client->term->stdin_pipe_fd[1] = -1;
+ ssh_client->term->stdin_pipe_fd[0] = -1;
+
--- End diff --
Sorry for the confusion. The changes in this patch to guac_terminal_free()
are only for a better practice of preventing unnecessary double closing. It
does nothing with the dead lock. The dead lock will happen if I only switch the
guac_terminal_free() and pthread_join(). ssh_input_thread() won't be terminated
if I don't manually close the pipe here.
---