Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VM console blocked in browsers #393

Open
usernameisalreadytaken2014 opened this issue Jul 23, 2014 · 3 comments
Open

VM console blocked in browsers #393

usernameisalreadytaken2014 opened this issue Jul 23, 2014 · 3 comments
Milestone

Comments

@usernameisalreadytaken2014

When clicking the Connect to VM button, the browser blocks the popup window. Tested in Google Chrome.

This is because the kimchi Javascript (1) does AJAX transactions, and when they are done (2) attempt to open a new window, but this is no longer in the context of the user clicking on something, and is therefore blocked by standard popup blockers.

I hacked the Javascript code so that kimchi (1) does "var x = window.open();", then (2) fires off AJAX requests, and when those return (3) sets the new window's location using "x.location = blah;". This works.

Unfortunately it doesn't work on iPads. So I tried again, this time just reverting the logic so that window.open() happens first, and the AJAX requests to start QEMU-VNC happens second.

I half expected this to cause a race condition where the websockets connection is dropped by websockify, because the backend QEMU-VNC port either has not been assigned yet, or has been assigned but is returning TCP RST because it's not running yet.

However, I've done quite a bit of testing, and have not run into the race condition even once, so it seems like a very good solution.

(Not sure why the race condition does not occur. Maybe websockify is able to wait until the port is available before connecting or something?)

Anyway, works great. Patch available if any interest.

@usernameisalreadytaken2014
Copy link
Author

Thinking about it a bit more, I think that when clicking "connect to VM", nothing else but opening the new window should be performed.

The URL pointed to in the new window should contain the AJAX code to call the server and request the QEMU-VNC port be opened and whatever else needs to be done in addition to showing the novnc GUI.

@jimsalterjrs
Copy link

#641 was mine. Commenting to add weight; this bug is a significant issue for me.

@overcookedTOFU
Copy link
Contributor

This is still an issue as of Kimchi 2.1. @usernameisalreadytaken2014, do you still have that patch? I'd love to test it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants