Dasherr icon indicating copy to clipboard operation
Dasherr copied to clipboard

[Bug] Host Check Causes Issues With Some Services

Open LeeThompson opened this issue 2 years ago • 9 comments

This is clearly not a "Dasherr" bug "per se", but perhaps some alternate check methods may be a good idea. (I.e. perhaps perform a HTTP GET (i.e. curl) instead of just opening a connection to the port.)

Example: With https://github.com/AUTOMATIC1111/stable-diffusion-webui the check causes the Stable Diffusion WebUI to throw an exception. It appears to still run so mostly this just makes it's console a horrible mess but it's possible that with other applications it may cause problems.

In this case, when Dasherr 'pings' the port, Stable Diffusion WebUI throws this exception:

ERROR:asyncio:Exception in callback _ProactorBasePipeTransport._call_connection_lost(None)
handle: <Handle _ProactorBasePipeTransport._call_connection_lost(None)>
Traceback (most recent call last):
  File "C:\Python\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Python\lib\asyncio\proactor_events.py", line 162, in _call_connection_lost
    self._sock.shutdown(socket.SHUT_RDWR)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

If I use curl to the host:port, it doesn't throw an exception.

LeeThompson avatar Dec 09 '22 20:12 LeeThompson

Could you pls do a simple test for me? There's this checkOnline function in include/worker.js Pls change:

	const options = {
		method: 'GET',
		mode: 'no-cors'
	};

to

	const options = {
		method: 'GET',
		mode: 'no-cors',
		connection: 'close'
	};

Does it help?

erohtar avatar Dec 10 '22 16:12 erohtar

EDIT: SD still throws an exception.

(I didn't refresh properly and got a false result.)

LeeThompson avatar Dec 10 '22 18:12 LeeThompson

Bummer! I saw the email notification of your original reply and was like "ok that wasn't too bad" lol

erohtar avatar Dec 10 '22 19:12 erohtar

I did include the added option in the latest release, though I'm still keeping this open.

erohtar avatar Dec 12 '22 15:12 erohtar

Another test - could you pls replace the checkOnline() function in worker.js with this and let me know?

async function checkOnline(thisUrl, thisId) {
	//reads all tiles from settings and sets their respective indicators to green
	let controller = new AbortController();

	const options = {
		method: 'GET',
		mode: 'no-cors',
		connection: 'close',
		signal: controller.signal
	};

	const response = await fetch(thisUrl,options);
	if (response.status = 200) {
		controller.abort();
		thisId.className = thisId.className.replace(/dot(?!\S)/g, 'dot dot-green');
		
		//this theming needs to be done here because js can't change style of future elements of a class
		$('.dot-green').css('background-color', currTheme.colorOn);
	} else {
		controller.abort();
		//console.log(thisUrl + ' : ' + response.status);
	}
}

erohtar avatar Dec 23 '22 07:12 erohtar

@erohtar I can't check this right now but I will when I get back home.

LeeThompson avatar Dec 24 '22 21:12 LeeThompson

No rush, take your time

erohtar avatar Dec 25 '22 05:12 erohtar

Still happening.

LeeThompson avatar Dec 27 '22 02:12 LeeThompson

Hmm. I'm not sure what else I could do differently - But I'll keep this open and come back to it in case I have other ideas.

erohtar avatar Dec 27 '22 12:12 erohtar