MSMQ port exhaustion

RuLe 1 Reputation point
2020-11-05T09:14:38.56+00:00

Hi,

I have MSMQ server running on Windows Server 2016.
The applications are using public queues.

I see the tcp ports in "bound" state growing for the msmq process. Till all the ports are used up.
Is there a way to find out what is causing this?

example:

PS C:\Scripts> Get-NetTCPConnection -State BOUND |select -First 5

LocalAddress LocalPort RemoteAddress RemotePort State AppliedSetting OwningProcess


0.0.0.0 65534 0.0.0.0 0 Bound 3240
0.0.0.0 65530 0.0.0.0 0 Bound 3240
0.0.0.0 65529 0.0.0.0 0 Bound 3240
0.0.0.0 65522 0.0.0.0 0 Bound 3240
0.0.0.0 65519 0.0.0.0 0 Bound 3240

Windows Server 2016
Windows Server 2016
A Microsoft server operating system that supports enterprise-level management updated to data storage.
2,508 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
13,074 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Anonymous
    2020-11-05T14:43:15.813+00:00

    Might need to review some tracing to find the failures.
    https://learn.microsoft.com/en-us/previous-versions/windows/desktop/msmq/ms704062(v=vs.85)

    --please don't forget to Accept as answer if the reply is helpful--

    0 comments No comments

  2. Gloria Gu 3,896 Reputation points
    2020-11-09T07:02:05.777+00:00

    @RuLe Hi,

    Thank you for posting in Q&A!

    About Troubleshoot Port exhaustion,The key is to identify which process or application is using all the ports. Below are some of the tools that you can use to isolate to one single process:

    1.Start by looking at the netstat output.
    If you are using Windows Server 2016, then you can run the command netstat -anobq and check for the process ID which has maximum entries as BOUND.

    38190-16.png

    2.Check the Task Manager:

    (1)Add a column called “handles” under details/processes.

    38180-14.png

    (2)Sort the column handles to identify the process with the highest number of handles. Usually the process with handles greater than 3000 could be the culprit except for processes like System, lsass.exe, store.exe, sqlsvr.exe.

    38311-15.png

    (3)If any other process than these has a higher number, stop that process and then try to login using domain credentials and see if it succeeds.

    Finally, if the above methods did not help you isolate the process, we suggest you collect a complete memory dump of the machine in the issue state. The dump will tell you which process has the maximum handles.

    For more details, please refer to:
    https://learn.microsoft.com/en-us/windows/client-management/troubleshoot-tcpip-port-exhaust[troubleshoot-tcpip-port-exhaust][4]

    Hope you have a nice day!
    Gloria

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    https://learn.microsoft.com/en-us/answers/articles/67444/email-notifications.html

    0 comments No comments

  3. RuLe 1 Reputation point
    2020-11-09T13:50:25.62+00:00

    I know it is the MSMQ process.
    The question is why and is it a service that is reading/writing from/to msmq that is causing this.

    I will try the link that DSPatrick has sent for the tracing. Only I have little hope because:
    Https locally used and local services are writing to the local queues. And both are not supported for msmq tracing.

    0 comments No comments

  4. Anonymous
    2020-11-09T14:01:13.397+00:00

    From a windows perspective; generally if the process uses some dynamically assigned range of ports and didn't complete (and close) successfully and is repeatedly being triggered then it may be expected behavior to eventually run out of ports.

    --please don't forget to Accept as answer if the reply is helpful--

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.