Termix-SSH / Termix-SSH/Support

[BUG]RDP/VNC connection startup is delayed by 10 seconds because /guacamole/connect-host/:hostId waits for guacd before returning the token

Open
#1,279 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug performance platform-docker platform-web rdp-vnc
Dominant language
No language data
Stars
28
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Title

RDP/VNC connection startup is delayed by 10 seconds because /guacamole/connect-host/:hostId waits for guacd before returning the token

Platform

Website - Firefox

Server Installation Method

Docker

Version

2.7.1

CLI Installation Method

None

CLI Version

No response

Troubleshooting
  • I have examined logs and tried to find the issue
  • I have reviewed opened and closed issues
  • I have tried restarting the application
  • I have checked open issues and ensured this is not a duplicate
The Problem

Browser Network timing for: POST /guacamole/connect-host/<hostId>
shows approximately:

Waiting for server response: 10.28 s

After that POST finally returns the token, the browser immediately opens the WebSocket and guacd establishes the RDP session in only a few seconds.

How to Reproduce

Open rdp session

Additional Context

In: /app/dist/backend/backend/hosts/guacamole/routes.js the /connect-host/:hostId handler contains:

token = tokenService.createRdpToken(...);
const sessionInfo = await waitForGuacdOpen(termixConnectId, 10000);
...
res.json({
    token,
    guacamoleConnectionId:
        sessionInfo?.guacamoleConnectionId ?? null,
});

The frontend cannot establish the Guacamole WebSocket until it receives the token from this HTTP response.
Therefore the backend waits up to 10 seconds for the guacd session to open, while the client cannot open that session because it is still waiting for the token.
The wait consequently times out on every connection and adds approximately 10 seconds to startup.

Verification
Replacing:

const sessionInfo =
    await waitForGuacdOpen(termixConnectId, 10000);

with:
const sessionInfo = null;
makes the POST return immediately and the RDP session opens without the artificial 10-second delay.
guacd logs confirm that once the WebSocket is opened, the actual RDP connection is established normally:

Creating new client for protocol "rdp"
...
Connected to RDPDR
...
RDPDR user logged on
Expected behavior

/guacamole/connect-host/:hostId should return the token immediately.
guacamoleConnectionId should be obtained asynchronously after the Guacamole WebSocket/session has actually been established, rather than blocking token delivery while waiting for an event that depends on that token being delivered.

Impact
Every RDP/VNC/Telnet connection using this code path receives an unnecessary ~10 second startup delay.
This also appears to be related to the session-sharing implementation, since guacamoleConnectionId is returned for that purpose.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in /app/dist/backend/backend/hosts/guacamole/routes.js and inspect the /connect-host/:hostId handler, token creation, and waitForGuacdOpen call. Trace how guacamoleConnectionId is used after the WebSocket opens. Done means the POST returns the token without the artificial wait and RDP/VNC/Telnet sessions still establish normally, including session sharing.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.