question

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

500 Internal Server Error when calling Matchmake

Sometimes, when I upload the latest version of my build, I receive a 500 Internal Server Error error.

  1. The server reports that it is Running and the game mode is definitely "server" since I never change it.
  2. I've tried refreshing the game modes by entering in the same information then pressing Save.
  3. When I use Postman, the matchmake works.
  4. When I use my Unity client using the Unity SDK, I get the 500 internal Server Error.
  5. The server has been running for about 30 minutes, so it isn't an issue of spin-up time.

Other times, everything works great.

What am I doing wrong?

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

Brent Batas (Lisk) avatar image
Brent Batas (Lisk) answered

Resolved the issue!

I misunderstood your comment here (https://community.playfab.com/questions/5411/how-to-check-if-the-server-exe-is-in-fact-running.html) when you said

"Obviously, it should behave the same on your server as it does on ours, but the key thing to know is that the executable isn't at the root of the drive - it's in a sub-folder."

I took this to mean that on my local machine (zip file), I'd have:

  • /root/server.exe
  • /root/plugins/library.dll


while on the server, this would be unpacked to be:

  • /root/subfolder/server.exe
  • /root/plugins/library.dll


when in fact, after I printed out the directories and files on the server, the file structure matches my local machine (and zip file).

In a nutshell: I thought the relative paths were different. They're actually the same.

Glad to finally move on from this!

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 answered

A 500 error indicates something unexpected that occurred. In the case of matchmaking, we have a couple of known issues that return 500 errors, for which we'll be updating to return more informative responses. One is if the build isn't running, which it sounds like you've already checked. The other is if there's missing or incorrect information in the call - BuildVersion, Region, or GameMode, if you're not specifying a LobbyId.

14 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 ·

I'm making the call with the exact same BuildVersion, Region, and GameMode as when I use Postman.

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

Hmm... I am seeing some oddness in the logs about this. The calls aren't exactly the same, but we need to do some checks to see why one would fail and not the other. We'll update soon with more on this.

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

Thanks - looking forward to it. Is there anything I can do in the meantime? I was thinking of using Wireshark to try to sniff the packets to see exactly what was going on.

0 Likes 0 ·
Show more comments
Brent Batas (Lisk) avatar image Brent Batas (Lisk) commented ·

@Brendan thanks for looking into it. I just took a break and came back to it, and matchmaking is working now. However, still no logs or output files and still unable to connect to the server.

When you get a chance, would you mind looking into my server once again? As I've mentioned before, everything works locally, including

  • exe in a subfolder
  • running the exe as a Network Service user
0 Likes 0 ·
brendan avatar image brendan ♦♦ Brent Batas (Lisk) commented ·

Let's simplify this as much as possible, and just use the File class (https://msdn.microsoft.com/en-us/library/system.io.file_methods(v=vs.110).aspx). That's what we use in our game server example (https://github.com/PlayFab/PlayFabGameServer/blob/571ca35e62a3f0a973d6c692d490972ca95dace9/GameServerSource/Assets/Packages/DefaultPackages/PlayFabServer/Commands/LogCommands.cs). Just have your log function do the same thing we do - if File.Exists(), use WriteAllLines (or WriteAllText, if you prefer), and AppendAllLines (or AppendAllText) if it does. Realistically, a file stream should work just as well, but let's minimize the variables in the test.

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

@Brendan I changed the code to use File.WriteAllLines as below:

List<string> LogEntries = new List<string>();
LogEntries.Add("Hello world"); LogEntries.Add("...");
if (!File.Exists(logFilePath))
{
File.WriteAllLines(logFilePath, LogEntries.ToArray());
}
else
{
foreach (var strOut in LogEntries)
{
File.AppendAllText(logFilePath, strOut);
}
}

Still no logs on the server. Any ideas?

If not, I can try reproducing the problem on a separate minimal codebase and then send that code source to you.

0 Likes 0 ·
Show more comments
Brent Batas (Lisk) avatar image Brent Batas (Lisk) commented ·

Hi Brendan - I'll work on getting a code sample for you back on Monday.

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

@Brendan I submitted a support ticket with the source code. Looking forward to fixing this together!

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

Given that this is a Unity project, you can switch to using the standard Unity logging by adding

-logFile <log_file_path>

To your Command Line. That will result in getting the full log output that Unity provides, which is likely going to work best for you, in this case.

0 Likes 0 ·
Show more comments
Brent Batas (Lisk) avatar image Brent Batas (Lisk) commented ·

Hi @Brendan

I'm experiencing the same issue again with the Matchmake() call returning a 500 Internal Server Error when it was working previously. BuildId, Region, and GameMode are the same and correct. According to the Dashboard, everything is online and Running.

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

I'm not able to reproduce this in your title - Matchmake returns the server info for your currently active server. However, the current server host has only been running for half an hour, so it's not clear what was running when you tried the test. Again though, if your server host status, on the Servers->Servers tab was not "Running", you could get this error. We have a work item open to make that error response more informative for that case.

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.