question

tomasvymazal avatar image
tomasvymazal asked

Matchmaking returns ServiceUnavailable, 500 Internal Server Error, 400 BadRequest

We have game running on PlayFab with titleId: 8D5A and game server is hosted on a PlayFab and since monday we started to see strange behavior. We are not aware of any change in our code that can possibly cause it, because matchmaking code wasn't changed for a while and till now, everything worked. So this can possibly be a PlayFab bug but I do not claim that in the end, cause isn't in our code.

Description: We are making one matchmaking request (see below) and get correct reply. Client connects to given IP and everything goes fine. Now second client requests exactly same request as the first and gets error response (see below too). When we try to repeat the matchmaking request on second client for a few times, after few tries it gets correct reply. This correct reply on second device seems to corelate in time with the time the first client actually goes to the game on dedicated server. Since that time, second matchmaking request returns correct result and second client is able to go into the game (the same instance of the game as the first client).

The request (copied from Visual Studio debugger, same in both cases):

BuildVersion:    "Test12"
CharacterId:    null
GameMode:    "FS"
LobbyId:    null
Region:    "EUWest"
StartNewIfNoneFound:    ""
StatisticName:    null
TagFilter:    {PlayFab.ClientModels.CollectionFilter}
     Excludes:    null
     Includes:    Count=1
          [0]:
               Data:    Count=1    
                    ["Visible"]:    "Yes"

Second matchmaking results in this error response (again, copied from Visual Studio debugger):

Error "PlayFabError(ServiceUnavailable, 500 Internal Server Error\r, 400 BadRequest)"
CustomData    null   
Error    ServiceUnavailable   
ErrorDetails    null   
ErrorMessage    "500 Internal Server Error\r"   
HttpCode    400    
HttpStatus    "BadRequest"   

Is this us doing something wrong or is the cause somewhere else? I'd like to remind that as far as I know, our matchmaking and server code related to this hasn't been changed for a while, but I am not 100% sure that everything is ok with our code.

Thanks alot for a reply.

Tom

Matchmaking
2 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.

tomasvymazal avatar image tomasvymazal commented ·

Update 1: this seems to be related to usage of tags. When we remove tags from matchmake request, this behavior wont happen and matchmake succeeds for all clients.

Update 2: when problem occurs (with usage of tags), we discovered strange "cascade behavior": when first client matches, it stars to load a game for him. While loading a game for first client, matchmake requests from second client fail. When first client gets into game, second client matchmake requests succeeds. This also repeats for second and third player and so on. Maybe it isn't related to certain client getting into game and other one succeeding, but to some timeout related to first successful matchmake. And again, this happens only for case when we are using tags, if tags in requests are removed, matchmaking succeeds for all clients.

0 Likes 0 ·
tomasvymazal avatar image tomasvymazal commented ·

Update 3: just to be clear, we use tags to hide servers after some times, so no new players would be able to join existing server after given time. But we need to allow players who were on that server and disconnected, to connect again, so in that case, player would reconnect by doing matchmaking without use of tag. So we cannot use Server State to filter out players coming late.

0 Likes 0 ·
brendan avatar image
brendan answered

The issue that caused Matchmake to fail if no running servers have any tags set (and you're using Tags in the Matchmake call) has been fixed. Please let us know if you're still seeing any issues with this.

13 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.

rob avatar image rob commented ·

I'm still seeing 500 Internal Server errors with GetCurrentGames. It seems very unreliable. Sometimes I call it and get my list of games and then I'll call it again and it returns a 500 error with nothing having changed in terms of games/tags/players.

I'm using both include and exclude tag filters in my request to GetCurrentGames and some of the tags will have been set, some will not.

0 Likes 0 ·
brendan avatar image brendan rob commented ·

A 500 error indicates that something unpredicted went wrong in the call. Can you provide the full response body, including the RequestID?

0 Likes 0 ·
rob avatar image rob brendan commented ·

It's the same as tomasvymazal above^

PlayFabError(ServiceUnavailable, 500 Internal Server Error, 400 BadRequest)

Sorry, not sure what you mean by the RequestID?

I believe it's happening when new rooms are being opened/tags are being set. Once a room has been left open for a while and isn't doing anything (no tags being updated) it seems to work. But it can take a while to settle down.

Sometimes a game appears on one refresh and then disappears when you refresh again a moment later. Also, if a player has just joined or left, the number of players showing in the room will jump back and forth between refreshes. Not major but it's strange that it's correct and then reverts to being incorrect when you refresh again.

0 Likes 0 ·
Show more comments
Show more comments
brendan avatar image
brendan answered

Can you walk us through the details of how you use Tags? A basic flow giving the specifics of the calls and when the decision is made to set those Tags is what we'll need. Also, do you mind if we create a couple of players in the title and try to reproduce your flow?

10 |1200

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

tomasvymazal avatar image
tomasvymazal answered

OK, it goes like this. Client sends a matchmake request (and this is where problem described above happens, but not for a first client, but for all of the rest):

BuildVersion:    "Test12"
CharacterId:    null
GameMode:    "FS"
LobbyId:    null
Region:    "EUWest"
StartNewIfNoneFound:    ""
StatisticName:    null
TagFilter:    {PlayFab.ClientModels.CollectionFilter}  
	Excludes:    null     
	Includes:    Count=1
	[0]:
		Data:    Count=1   
			["Visible"]:    "Yes"

They are generally like this, but can differ in GameMode, when users select different map to go to (but problem occurs when they are choosing same map). TagFilter as above is always included.

Next, server starts, it hosts regular game and parallel to that, it waits for a 30 second since start of the game, and after that it sets server's tag to "Visible":"No". This should disallow new players to join to existing game after 30 secs since start of the game.

However, there is one exception to not allowing new players to go to existing game. And it goes when player disconnects from an existing game (or quits the game)...we want to allow him to return to game. So he basically keeps his LobbyId saved and when he does matchmaking, he provides this lobbyId, but in a same time, he does not provide TagFilter. So this allows him to join game even when its tag is "Visible":"No", if he has valid LobbyId (which is checked).

"Also, do you mind if we create a couple of players in the title and try to reproduce your flow?" - no, its ok, I don't mind.

Thanks a lot!

7 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.

brendan avatar image brendan commented ·

Got it - and thanks, it was useful to test your specific scenario. I'm seeing two things:

1. You're not setting the Tag on the server, apparently. When I used SetGameServerInstanceTags to set the Tag "Visible": "Yes", I was then able to successfully search for the server 100% of the time.

2. We clearly have a bug where, if you are searching using Tag filtering, and there's at least one server instance running, but no running instances have the Tag(s) in the filter, we're hitting a null reference exception. I've filed a bug on that to get it fixed.

0 Likes 0 ·
tomasvymazal avatar image tomasvymazal commented ·

"2. We clearly have a bug where, if you are searching using Tag filtering, and there's at least one server instance running, but no running instances have the Tag(s) in the filter, we're hitting a null reference exception. I've filed a bug on that to get it fixed."

Can I ask how does it look with that bug you mentioned? Is that fixed?

0 Likes 0 ·
brendan avatar image brendan tomasvymazal commented ·

Not yet, but as long as you have at least one server running with the Tag set, you won't encounter this issue. Is the issue that you're not setting the flag until after players join, and that the Matchmake call is intended to start these servers?

0 Likes 0 ·
tomasvymazal avatar image tomasvymazal brendan commented ·

Yeah, that is the issue. May I ask when do you plan to fix this bug? We plan to use the tag feature and would be glad that the problem is fixed.

0 Likes 0 ·
Show more comments
rob avatar image rob commented ·

I'm running into this error as well. I don't have the latest SDK I don't think but I'm not seeing anything about in the latest release notes so I'm guessing it still hasn't been fixed. Any estimate on when it will be sorted?

0 Likes 0 ·
brendan avatar image brendan rob commented ·

Sorry, but until work is in process, it's basically impossible for us to provide a date. As a live service, we have to adjust for real-time needs frequently. For now, I would have to recommend holding off on using server instance tags.

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.