Matchmaker process missing index

2 players perform a 2-player match. Each player calls Envelope_MatchmakerAdd,but it fails,the error is “matchmaker process missing index”.

Hello @hexun80149128,

Which version of Nakama are you using?

@flavio the version is 3.17.0

@hexun80149128 Looking at the logs it looks like there are both joining and leaving presences, I suspect what’s happening is that a player is leaving just before matchmaking is being processed which could cause the error you’re seeing.


I restarted the server and 2 people were still matched, which is normal. Logs and errors are the same when failed。 The Player is not leaving @sesposito

@hexun80149128 A few questions:

  • How many players in total are being added to the matchmaker? How often does it happen?

  • Can you check that these newly added tickets are being matched later? (i.e. in the next matchmaker iteration). I suspect that the matchmaker was already running before the tickets entered the pool. These are warning logs not errors, so if they are matched in the next run it’s no cause for concern.

As for the warning logs, those tickets are different from the ones being added so I suspect it is a small out-of-sync check where the matchmaker search returns do not match its working copy because they are too recent. Again I expect they will be matched in the next iteration, and this is probably a log we can remove as it is creating confusion.


@ftkg

  1. there are 2 players
    2.they cannot matched later. I set matchmaker: interval_sec: 5. Every 5 sec it will trigger matching.but see the picture,01:04:08 there are two tickets in the pool,but until 01:05:32 it not works.then I remove one of time

I think I found the reason. After I commented out the added MatchmakerFilter, it became normal. But I want to know what is the real reason? Previously, this function MatchmakerFilter was added for the 2v2v2 situation. https://forum.heroiclabs.com/t/suppose-my-game-is-a-3v3-3-parties-use-partymatchmakeradd-each-party-has-2-people-can-they-match-together/ 3808

	//if err := initializer.RegisterMatchmakerOverride(logic.MatchmakerFilter); err != nil {
	//	logger.Error("Unable to register: %v", err)
	//	return err
	//}
func MatchmakerFilter(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, candidateMatches [][]runtime.MatchmakerEntry) (matches [][]runtime.MatchmakerEntry) {
	for index, entries := range candidateMatches {
		totalNum := len(entries)
		logger.Debug("MatchmakerFilter entry group:%d", totalNum)
		if totalNum%2 == 1 {
			matches = append(matches, candidateMatches[index])
			continue
		}
		tickets := make(map[string]int, totalNum)
		for _, entry := range entries {
			logger.Debug("MatchmakerFilter single entry:%v ", entry, "ticket: %v ", entry.GetTicket(), "GetProperties: %v", entry.GetProperties(), "GetPartyId: %v ", entry.GetPartyId())
			tickets[entry.GetTicket()] += 1
		}
		numArr := make([]int, 0, len(tickets))
		for _, num := range tickets {
			numArr = append(numArr, num)
		}
		if internal.FindPairWithSum(numArr, totalNum/2) == nil {
			logger.Debug("MatchmakerFilter entry group not match,numArr is %v", numArr)
		} else {
			matches = append(matches, candidateMatches[index])
		}
	}
	return matches
}

I want to know what’s wrong with MatchmakerFilter @ftkg @sesposito

When you register a MatchmakerFilter, it runs a different code path, so you may have found an issue with the custom matchmaker itself.

In your second post the 2 players were matched. Did you do anything different there?

@ftkg I just check whether the matching results of the system meet the conditions I need, and if so, I will keep them.if not match,drop it 。
what should I do to fix the bug?

My question was when you restarted the server and it matched as expected. I need to understand better how I can replicate this issue. Are you doing anything different when it matches and when it stops matching the players?

when I comment out MatchmakerFilter,it works fine。 when I use MatchmakerFilter,first works fine,then “Matchmaker process missing index”. I think MatchmakerFilter cause the bug.but I don’t know why.
@ftkg

@ftkg the MatchmakerFilter is just filter out the desired matching results and discard the unwanted ones, such as 3v3 games. Don’t make 2v2v2 . 3 parites with each have 2 player。

@hexun80149128 Please post the entire log, including the first successful matchmaking up to the failures.

I also found this issue when using MatchmakerOverride functionality. The reason for it was that the code didn’t remove used tickets from search index. This fix was merged to resolve this issue: Fixes for MatchmakerOverride logic by maciejmrozinski · Pull Request #1110 · heroiclabs/nakama · GitHub

1 Like