Repository navigation
Backport: Honour consoleproxy.session.timeout for noVNC console sessions - #13058
dheeraj12347 wants to merge 16 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to backport the fix to ensure consoleproxy.session.timeout is honored for noVNC console sessions on the 4.20 branch, so idle sessions are cleaned up and don’t linger indefinitely.
Changes:
- Updates the noVNC WebSocket handler with additional logging, parameter validation, and safer frame/error handling.
- Refactors the console proxy GC thread loop and related logging around idle session cleanup.
- Adjusts console proxy startup/authentication reflection and noVNC viewer creation/replacement logic.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| services/console-proxy/server/src/main/java/com/cloud/consoleproxy/ConsoleProxyNoVNCHandler.java | WebSocket connect/frame/error handling changes intended to support correct idle-session cleanup. |
| services/console-proxy/server/src/main/java/com/cloud/consoleproxy/ConsoleProxyGCThread.java | GC loop refactor and idle session timeout constant/comment updates. |
| services/console-proxy/server/src/main/java/com/cloud/consoleproxy/ConsoleProxy.java | Console proxy startup/auth reflection changes and noVNC viewer lifecycle adjustments. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 4.20 #13058 +/- ##
============================================
+ Coverage 16.26% 16.43% +0.16%
- Complexity 13434 13679 +245
============================================
Files 5667 5669 +2
Lines 500731 501678 +947
Branches 60803 60956 +153
============================================
+ Hits 81455 82445 +990
+ Misses 410172 409995 -177
- Partials 9104 9238 +134
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks for the detailed review and suggestions from Copilot. |
|
@dheeraj12347 , I set consoleproxy.session.timeout to 30000, expecting my consoles to get lost in half a minute. I restarted the MS. The consoles keep working until about the half an hour, the default setting. (I didn’t measure exactly) Can you have another look at this? |
|
@dheeraj12347 once this is merged into 4.20, it will be included in main as well after forward-merge |
Hi @DaanHoogland , I’ve updated the PR to address the consoleproxy.session.timeout behaviour you described: In ConsoleProxy.java I now read consoleproxy.session.timeout from the configuration (milliseconds), validate it, and store the effective value in ConsoleProxy.sessionTimeoutMillis, with a log line on startup showing the effective timeout. In ConsoleProxyGCThread.java I removed the hardcoded idle timeout and changed the GC logic to compute each viewer’s idle time in milliseconds and compare it against ConsoleProxy.sessionTimeoutMillis, logging the idle duration and configured timeout when a session is removed. To verify my changes, I built the console proxy server module with: bash I’m open to any feedback on this approach, and I’m happy to further adjust or iterate based on your results when you re-test with consoleproxy.session.timeout=30000. |
| return; | ||
| } | ||
| logger.trace("Sending client [ID: {}] frame of {} bytes.", viewer.getClientId(), f.getPayloadLength()); | ||
| viewer.updateFrontEndActivityTime(); |
There was a problem hiding this comment.
does an open console that nobody touches ever time out? the browser keeps asking for screen updates on its own, so every frame here looks like activity
@dheeraj12347 still no. every frame from the browser still counts as activity, and so does every screen update sent back to it. can we count only key presses and mouse moves? |
|
@DaanHoogland , @Pearl1594 and @Damans227 I also checked the bundled noVNC implementation: continuous screen updates are enabled through a client message, while the resulting screen updates travel from the server to the browser. I'll verify the idle-session behavior and whether the activity refresh in |
|
@blueorangutan package |
|
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19625 |
|
@blueorangutan test keepEnv |
|
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
Hi @DaanHoogland, @Damans227, and @kiranchavala, I've pushed an additional test in The targeted test passes locally (2 tests, 0 failures), and the console-proxy server module compiles successfully. The activity-tracking changes are also pushed. I'll continue verifying that only actual keyboard and mouse interactions refresh the idle timer, while automatic screen updates do not. Could you please review the latest changes when convenient? Thanks! |
|
[SF] Trillian test result (tid-17181)
|
|
Thanks for the fix @dheeraj12347, can you please reference the PR from which the fix is being backported from? |
|
@dheeraj12347 0f26cc3 covers my thread, only key presses and mouse moves keep the session alive now. when the timer runs out, does the console just freeze until the second timeout closes it? looks like an idle tab can sit frozen for up to 5 more minutes before it disconnects |
|
@Damans227, @kiranchavala did you test this? |
|
@DaanHoogland no, i havent run it on a lab, only read the code. still waiting on @dheeraj12347 for the frozen screen question above |
kiranchavala
left a comment
There was a problem hiding this comment.
LGTM Tested manually
(localcloud) 🐱 > list configurations name=consoleproxy.session.timeout
{
"configuration": [
{
"category": "Console Proxy",
"component": "AgentManager",
"defaultvalue": "300000",
"description": "Timeout(in milliseconds) that console proxy tries to maintain a viewer session before it times out the session for no activity",
"displaytext": "Consoleproxy session timeout",
"group": "System VMs",
"isdynamic": false,
"name": "consoleproxy.session.timeout",
"subgroup": "ConsoleProxyVM",
"type": "Number",
"value": "300000"
}
],
"count": 1
}
root@v-1-VM:~# tr ' ' '\n' < /var/cache/cloud/cmdline | grep session.timeout
consoleproxy.session.timeout=300000
root@v-1-VM:~# grep -i "consoleproxy.session.timeout" /var/log/cloud.log
2026-10-29T07:47:14,069 INFO [cloud.consoleproxy.ConsoleProxy] (Console-Proxy-Main:[]) Context property consoleproxy.session.timeout: 300000
2026-10-29T07:47:14,196 INFO [cloud.consoleproxy.ConsoleProxy] (Console-Proxy-Main:[]) Property consoleproxy.session.timeout: 300000
2026-10-29T07:47:14,336 INFO [cloud.consoleproxy.ConsoleProxy] (Console-Proxy-Main:[]) Effective consoleproxy.session.timeout=300000 ms
Take a console seession of a vm
After 5 min
root@v-1-VM:~# tail -f /var/log/cloud.log | grep -Ei "Dropping|session.timeout|idle timeout|Viewer has been created"
2026-10-29T09:55:01,383 INFO [cloud.consoleproxy.ConsoleProxyGCThread] (Console Proxy GC Thread:[]) Dropping com.cloud.consoleproxy.ConsoleProxyNoVncClient@30193f45 which has not been used for 304634 ms (configured timeout: 300000 ms)
[root@ref-trl-12549-k-Mol8-kiran-chavala-mgmt1 ~]# cmk update configuration name=consoleproxy.session.timeout value=60000
Loaded in-built API cache. Failed to read API cache, please run 'sync'.
{
"configuration": {
"category": "Console Proxy",
"component": "AgentManager",
"defaultvalue": "300000",
"description": "Timeout(in milliseconds) that console proxy tries to maintain a viewer session before it times out the session for no activity",
"displaytext": "Consoleproxy session timeout",
"group": "System VMs",
"isdynamic": false,
"name": "consoleproxy.session.timeout",
"subgroup": "ConsoleProxyVM",
"type": "Number",
"value": "60000"
}
}
systemctl restart cloudstack-management
Only when the console proxy is Destoryed or stop/started the setting is updated in the console proxy
[root@ref-trl-12549-k-Mol8-kiran-chavala-mgmt1 ~]# cmk destroy systemvm id=d03bc871-63c1-4673-975f-940799d792e6
root@v-5-VM:~# tr ' ' '\n' < /var/cache/cloud/cmdline | grep session.timeout
consoleproxy.session.timeout=60000
root@v-5-VM:~# grep -i "consoleproxy.session.timeout" /var/log/cloud.log
2026-10-29T10:09:47,029 INFO [cloud.consoleproxy.ConsoleProxy] (Console-Proxy-Main:[]) Context property consoleproxy.session.timeout: 60000
2026-10-29T10:09:47,138 INFO [cloud.consoleproxy.ConsoleProxy] (Console-Proxy-Main:[]) Property consoleproxy.session.timeout: 60000
2026-10-29T10:09:47,207 INFO [cloud.consoleproxy.ConsoleProxy] (Console-Proxy-Main:[]) Effective consoleproxy.session.timeout=60000 ms
|
@dheeraj12347 @DaanHoogland kiran tested this and the console froze when the timer ran out instead of closing. the log shows the session was dropped at 72s with a 70s timeout, but the tab stayed open and stuck. can we close the browser side too when the session is dropped, so the user sees it disconnected? |
|
|
Hi @DaanHoogland, @weizhouapache and @kiranchavala The targeted test passes locally (3 tests, 0 failures), and Checkstyle reports no violations. Could you please verify that the browser-side console now disconnects correctly when the configured session timeout expires? |
@dheeraj12347 54364d6 covers it, the browser side is closed now when the idle session is dropped. |
|
@blueorangutan package |
|
@kiranchavala a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19848 |
Thanks @dheeraj12347 issue is resolved, i see the console closed in the browser
|
|
@Damans227 @kiranchavala , you both approved, right? (i.e. this is ready-for-merge) |
Damans227
left a comment
There was a problem hiding this comment.
@DaanHoogland yes, ready from my side. thanks @dheeraj12347. kirans retest on the last commit shows the console closing. LGTM.


Description
This PR backports the console proxy/noVNC timeout fix to the 4.20 branch.
It ensures that
consoleproxy.session.timeoutis honoured for noVNC consolesessions, so idle sessions are cleaned up correctly and do not linger
indefinitely.
Key points:
consoleproxy.session.timeoutthrough the console proxy server fornoVNC-based console sessions.
are closed after the configured period.
newer
sessionRequiresNewViewerAPI onConsoleProxyClientParam, onlyremove the references that exist in later branches.
Related work
idle noVNC sessions not respecting
consoleproxy.session.timeout.Testing
Compiled the console proxy server module successfully:
Verified that the code builds cleanly with checkstyle on the 4.20 branch.
Fix Global setting "consoleproxy.session.timeout " is not honoured #12810