question

Brent Batas (Lisk) avatar image
Brent Batas (Lisk) asked

Not enough threads in Thread Pool

When trying to get Current Games every ~10 seconds on my login server, I started receiving this error:

[Warn]     0 2413.310: Error: ConnectionError

[Warn]     0 2413.310: Error Message: There were not enough free threads in the ThreadPool to complete the operation.

[Warn]     0 2413.310: Error HttpCode: 0

This is the only PlayFab API call I think I make on my Login Server. How can I avoid this happening?

Thanks!

apisCustom Game Servers
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

That's actually a generic error that isn't related to our calls, apart from the fact that you may be spinning a thread to make an async call to us. Things to check on would be, are you cleaning your async operations, do you have any deadlocks, etc. Bear in mind that ThreadPool is best used with very limited operations. If you have long-running logic, it's best to give it a dedicated Thread.

Now, that said, why are you calling GetCurrentGames every 10 seconds? What does this server do, exactly? If it's a matchmaking server, why isn't it keeping the list of running games in memory (GetCurrentGames is usually only used to recover the list, in that case)? If it's that you have multiple servers like it that are spinning up sessions for groups of players (the "city"/"dungeon" model of servers), why aren't these servers connecting to each other to coordinate in realtime on sessions they're aware of (which would then eliminate the 10 second delay you have right now)?

3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Brent Batas (Lisk) avatar image Brent Batas (Lisk) commented ·

Thanks for the update. It's a login server that is keeping track of how many players are in the Lobby server, to figure out how many to let through each tick. If there are 500 players in the lobby (waiting for a game), it stops letting people through until there are fewer than 500.

0 Likes 0 ·
brendan avatar image brendan Brent Batas (Lisk) commented ·

Okay, so why not just have it talk to the lobby server(s) directly? Why does it need to call GetCurrentGames?

0 Likes 0 ·
Brent Batas (Lisk) avatar image Brent Batas (Lisk) brendan commented ·

That's a good point. Unfortunately right now, the lobby server frequently crashes, so it wasn't reliable to connect to it.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.