You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Exception in the named pipe Serverloop creates huge logfiles and high CPU usage #81
The Serverloop in NpListener.cs calls ProcessNextClient() in a while loop. If an exception is thrown in the ProcessNextClient method, a message is logged and the loop continues. From the comment line I understand that this is done on purpose, but the result is that it writes log messages as fast as it can when an exceptions happens repeatedly. In my case that resulted in a logfile over 1 gigabyte within 1 or 2 minutes and a high CPU usage. Exceptions can happen there for more reasons than reaching the connection limit only. In our case it was an UnauthorizedAccessException. Another reason could be an invalid pipename e.g.
I don't know what the best solution would be. Maybe silently catch the specific exception that is triggered by exceeding the number of available connections, pause for 50ms and continue? And re-throw all other exceptions?
private void ServerLoop()
{
while (running)
{
ProcessNextClient();
}
}
public void ProcessNextClient()
{
try
{
// pipe code
// every exception thrown here causes a log message
}
catch (Exception e)
{
//If there are no more avail connections (254 is in use already) then just keep looping until one is avail
_log.Error("ProcessNextClient error: {0}", e.ToString().Flatten());
}
}
Also ran into this issue, when launching the host multiple times the named pipe already exists and causes UnauthorizedAccessException. Current workaround seems to be to manually attempt connection at launch, and only if that fails setup the servicewire host.
Resolved for 6.0.1. The named-pipe listener now retries only the transient Windows pipe-capacity condition (ERROR_PIPE_BUSY) with a short backoff. Other failures, including UnauthorizedAccessException, escape to ServerLoop, fault the host, emit one fatal entry, and stop the listener instead of entering an unbounded CPU/logging loop. Added targeted regression coverage on .NET 10 and .NET Framework 4.8.
Activity
tylerje commentedon Jan 11, 2024
Or only log the Nth instance of the exception? I'll try to get to this soon.
RoVaDePi commentedon Jan 24, 2025
Also ran into this issue, when launching the host multiple times the named pipe already exists and causes UnauthorizedAccessException. Current workaround seems to be to manually attempt connection at launch, and only if that fails setup the servicewire host.
tylerje commentedon Aug 18, 2026
Resolved for 6.0.1. The named-pipe listener now retries only the transient Windows pipe-capacity condition (
ERROR_PIPE_BUSY) with a short backoff. Other failures, includingUnauthorizedAccessException, escape toServerLoop, fault the host, emit one fatal entry, and stop the listener instead of entering an unbounded CPU/logging loop. Added targeted regression coverage on .NET 10 and .NET Framework 4.8.