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

CPU Spike to 100% #2

Open
karan-kang opened this issue Jan 12, 2015 · 3 comments
Open

CPU Spike to 100% #2

karan-kang opened this issue Jan 12, 2015 · 3 comments

Comments

@karan-kang
Copy link

I just tried running your tool with 1KB of data with unlimited number of messages, and it seems the CPU is spiking at 100% while the client server is communicating.

Client:
echotool 127.0.0.1 /p tcp /r 5757 /n 0 /d ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef

Server:
echotool /p tcp /s 5757

@CurlingGeek
Copy link

This appears to be an issue with busy waiting in the TcpEchoServer.ServerThread. A quick and dirty fix for me was to add a sleep into the loop (note that this will affect the timeout logic):

while (tcpClient.Client.Connected && serverRunning && !timeOut)
{
    TimeSpan timeoutSpan = DateTime.Now - tcpState.TimeoutWatch;
    if (timeoutSpan.Seconds >= ConnectionTimeout)
        timeOut = true;

    Thread.Sleep(100);
}

@PavelBansky
Copy link
Owner

CurlingGeek is right. The problem is that the Thread get the whole cycle busy.

I'll fix it.

@belvederecristovao
Copy link

belvederecristovao commented Aug 3, 2021

echotool server.to-test.com /p udp /r 4578 /d Hello

I revceived the message bellow.

This is usually a temporary error during hostname resolution and means that the local server has not received a response from an authorized server.

Este geralmente é um erro temporário durante a resolução do nome do host e significa que o servidor local não recebeu uma resposta de um servidor autorizado

Statistics: Received=0, Corupted=0, Lost=0

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

No branches or pull requests

4 participants