Port exhausting issue when using squidex client

Hi, for the fun of it i’ve tried to write a small program to test out how well our setup in Azure worked under load.

The only thing the program does is to fetch 200 articles, and then after that repeatedly fetch each single one of them by ID over and over again, by using the SquidexClient

Then i started the same program 8 - 10 times and just waited. The programs run for a while and then start throwing

Unhandled Exception: System.AggregateException: One or more errors occurred. (Address already in use)

After som small investigation, and looking through the internet, my best guess would be that the SquidexClient create a new httpclient per request, instead of reusing the same http client. When i look into netstats i can see that it just have a lot of unclosed connections, which could indicate that the port has been exhausted.

Does this make sense ?

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [x] Bug report
  • [ ] Performance issue
  • [ ] Documentation issue or request

Current behavior

Expected behavior

Minimal reproduction of the problem

Environment

  • [x ] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [ ] Cloud version

Version: [VERSION]

Browser:

  • [ ] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [ ] Edge

Others:

How do you use the client library?

If you create new client object for each call you will get this issue, but the client is shared:

you are completely right, i created the clientmanager once, but used getClient per request. After refactoring so i only use getClient once, the problem is gone. Sorry for the inconvenience

1 Like