Update: UltraVNC 1.4.3.6 and UltraVNC SC 1.4.3.6: https://forum.uvnc.com/viewtopic.php?t=37885
Important: Please update to latest version before to create a reply, a topic or an issue: https://forum.uvnc.com/viewtopic.php?t=37864

Join us on social networks and share our announcements:
- Website: https://uvnc.com/
- GitHub: https://github.com/ultravnc
- Mastodon: https://mastodon.social/@ultravnc
- Facebook: https://www.facebook.com/ultravnc1
- X/Twitter: https://x.com/ultravnc1
- Reddit community: https://www.reddit.com/r/ultravnc
- OpenHub: https://openhub.net/p/ultravnc

[SOLVED] Repeater 100% processor usage

Post Reply
Prisma
100
100
Posts: 320
Joined: 2005-10-27 15:50

[SOLVED] Repeater 100% processor usage

Post by Prisma »

Last edited by Prisma on 2013-08-26 11:53, edited 2 times in total.
Prisma
100
100
Posts: 320
Joined: 2005-10-27 15:50

Re: [BUG] Repeater 100% processor usage

Post by Prisma »

Applied a hotfix to source code. Dirty but anyway...

Code: Select all

   while(notwebstopped)
   {
      sessions = wi_poll();
      if( sessions < 0 )
      {
         dtrap();    /* restart the server thread?? */
         Sleep(1);  /*<----------------- */
      }
   }
User avatar
Rudi De Vos
Admin & Developer
Admin & Developer
Posts: 6865
Joined: 2004-04-23 10:21
Contact:

Re: [BUG] Repeater 100% processor usage

Post by Rudi De Vos »

this seems a better solution
Add an extra while loop and close/restart socket on error.

Code: Select all

DWORD WINAPI ThreadStartWeb(LPVOID lpParam)
{
	int   sessions = 0;
	while(notwebstopped)
	{
		int old_port=0;
		int error=-1;		
		WORD wVersionRequested;
		WSADATA wsaData;
		int err;

		sessions = 0;
		wVersionRequested = MAKEWORD( 2, 2 ); 
		err = WSAStartup( wVersionRequested, &wsaData );
		if ( err != 0 ) {
		return 0;
		}
		printf("Webio server starting...\n");



		error = wi_init();
		old_port=saved_portHTTP;
		while (error<0)
		{
			dprintf("wi_init error %d\n", error);
			saved_portHTTP++;
			error = wi_init();
		}

		if (old_port!=saved_portHTTP)
		{
			char text[200];
			sprintf(text,"The defined web port is already in use. \nChanged to http://localhost:%i \nVerify settings!\n Default user and password is admin.",saved_portHTTP);
			MessageBox(NULL,text,"UltraVnc Repeater: Warning",MB_ICONEXCLAMATION);
		}
		/* Install our port-local authentication routine */
		emfs.wfs_fauth = wfs_auth;

		while(notwebstopped)
			{
				sessions = wi_poll();
				if( sessions < 0 )
					{
						// dtrap(); This doesn't do anything on win32 platform.
						goto dtrap;
					}
			}
		dtrap:
		closesocket(wi_listen);
		WSACleanup( );
	 }
   return sessions;
}
User avatar
Rudi De Vos
Admin & Developer
Admin & Developer
Posts: 6865
Joined: 2004-04-23 10:21
Contact:

Re: [BUG] Repeater 100% processor usage

Post by Rudi De Vos »

src+bin repeater in 1193 folder

DOWNLOAD test builds
http://www.uvnc.eu/1193/
Prisma
100
100
Posts: 320
Joined: 2005-10-27 15:50

Re: [BUG] Repeater 100% processor usage

Post by Prisma »

Downloaded and running (for now) in debugger. We'll see. THX Rudi.
Prisma
100
100
Posts: 320
Joined: 2005-10-27 15:50

Re: [BUG] Repeater 100% processor usage

Post by Prisma »

Hello Rudi,

that wasn't it. Now the socket seems to be not restarted. Until restart of the whole process, the repeater keeps working but the website keeps being unavailable.
User avatar
Rudi De Vos
Admin & Developer
Admin & Developer
Posts: 6865
Joined: 2004-04-23 10:21
Contact:

Re: [BUG] Repeater 100% processor usage

Post by Rudi De Vos »

It's a hell to test, i install a securityb tool to test websites to generate a lot of data.
Found another one
missing wi_delsess(sess);
session don't get removed, so you keep getting the socket error in a loop

Code: Select all

case WI_POSTRX:
         /* See if there is more to read */
         error = recv(sess->ws_socket, 
            sess->ws_rxbuf + sess->ws_rxsize,
            sizeof(sess->ws_rxbuf) - sess->ws_rxsize, 0);

         if(error < 0)
         {
            if(errno == EWOULDBLOCK)
               error = 0;
            else
            {
               error = errno;
               dprintf("sock recv error %d\n", error );
	wi_delsess(sess); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<ADD
               return WIE_SOCKET;
            }
         }
User avatar
Rudi De Vos
Admin & Developer
Admin & Developer
Posts: 6865
Joined: 2004-04-23 10:21
Contact:

Re: [BUG] Repeater 100% processor usage

Post by Rudi De Vos »

found some other...

src+bin in same folder (repeater16082013.zip)
Prisma
100
100
Posts: 320
Joined: 2005-10-27 15:50

Re: [BUG] Repeater 100% processor usage

Post by Prisma »

New code runnig in our VS2010...
Prisma
100
100
Posts: 320
Joined: 2005-10-27 15:50

Re: [BUG] Repeater 100% processor usage

Post by Prisma »

Stable until now. 100% processor usage should have happened within a few day. But it didn't. I mark this thread pre-empting as solved.
Post Reply