How to fix "LogStats:Warning: MetaData mismatch. Did you assign a stat to two groups?"

Hello,

I need to create two threads. I base my code on this Rama tutorial:

Whan I do it, I get a message in the log:

LogStats:Warning: MetaData mismatch. Did you assign a stat to two groups? New //STATGROUP_Threads//FTCPSocketListeningTh///Thread_2130_0///####STATCAT_Advanced#### old //STATGROUP_Threads//FTCPSocketListeningTh///Thread_202c_0///####STATCAT_Advanced####

And my second thread dont stop opposed to in the first. I read, it because of the same name, but I called the threads different.

Help me fix it. Thanks!

.

.

.

Code of my two identical FRunnable class – FServerStatusCheckingTh and FTCPSocketListeningTh.

.h

#pragma once

class SIENNACLIENTPROJECT_API FServerStatusCheckingTh : public FRunnable
{
	static  FServerStatusCheckingTh* Runnable;

	FRunnableThread* Thread;

public:

	FServerStatusCheckingTh();
	~FServerStatusCheckingTh();

	virtual bool   Init();
	virtual uint32 Run();
	virtual void   Stop();

	static FServerStatusCheckingTh* RunServerChecking();

	static bool bThreadRun;

	static void Shutdown();

};

.cpp

#include "SiennaClientProject.h"
#include "ServerStatusCheckingTh.h"

FServerStatusCheckingTh* FServerStatusCheckingTh::Runnable = NULL;
bool FServerStatusCheckingTh::bThreadRun = false;

FServerStatusCheckingTh::FServerStatusCheckingTh()
{
	Thread = FRunnableThread::Create(this, TEXT("ServerStatusChecking"), 0, TPri_BelowNormal); 
}

FServerStatusCheckingTh::~FServerStatusCheckingTh()
{
	delete Thread;
	Thread = NULL;
}

bool FServerStatusCheckingTh::Init()
{
	bThreadRun = true;
	return true;
}

uint32 FServerStatusCheckingTh::Run()
{
	while (bThreadRun)
	{
		FPlatformProcess::Sleep(1.f); 
	GLog->Log("FServerStatusCheckingTh");
		
	}
	return 0;
}

void FServerStatusCheckingTh::Stop()
{
}

FServerStatusCheckingTh* FServerStatusCheckingTh::RunServerChecking()
{
	if (!Runnable && FPlatformProcess::SupportsMultithreading())
	{
		Runnable = new FServerStatusCheckingTh();
	}
	return Runnable;
}

void FServerStatusCheckingTh::Shutdown()
{
	if (Runnable)
	{
		bThreadRun = false;

		delete Runnable;
		Runnable = NULL;
	}
}

In FTCPSocketListeningTh change only the displayed message in the log and thread name

.h

#pragma once

class SIENNACLIENTPROJECT_API FTCPSocketListeningTh : public FRunnable
{
	static FTCPSocketListeningTh* Runnable;

	FRunnableThread* Thread;

public:

	FTCPSocketListeningTh();
	~FTCPSocketListeningTh();

	virtual bool   Init();
	virtual uint32 Run();
	virtual void   Stop();

	static FTCPSocketListeningTh* RunSocketListening();

	static bool bThreadRun;

	static void Shutdown();

};

.cpp

#include "SiennaClientProject.h"
#include "TCPSocketListeningTh.h"

FTCPSocketListeningTh* FTCPSocketListeningTh::Runnable = NULL;
bool FTCPSocketListeningTh::bThreadRun = false;

FTCPSocketListeningTh::FTCPSocketListeningTh()
{
	Thread = FRunnableThread::Create(this, TEXT("TCP_SocketListening"), 0, TPri_BelowNormal); 
}

FTCPSocketListeningTh::~FTCPSocketListeningTh()
{
	delete Thread;
	Thread = NULL;
}

bool FTCPSocketListeningTh::Init()
{
	bThreadRun = true;
	return true;
}

uint32 FTCPSocketListeningTh::Run()
{
	while (bThreadRun)
	{
		FPlatformProcess::Sleep(1.f);
		GLog->Log("FTCPSocketListeningTh");
	}
	return 0;
}

void FTCPSocketListeningTh::Stop()
{
}

FTCPSocketListeningTh* FTCPSocketListeningTh::RunSocketListening()
{
	if (!Runnable && FPlatformProcess::SupportsMultithreading())
	{
		Runnable = new FTCPSocketListeningTh();
	}
	return Runnable;
}

void FTCPSocketListeningTh::Shutdown()
{
	if (Runnable)
	{
		bThreadRun = false;

		delete Runnable;
		Runnable = NULL;
	}
}

Run and Shutdown in GameInstance:

void USiennaGameInstance::Init()
{
	GLog->Log("<<< USiennaGameInstance::USiennaGameInstance >>>");

        FServerStatusCheckingTh::RunServerChecking(); 
	FTCPSocketListeningTh::RunSocketListening();
}

void USiennaGameInstance::Shutdown()
{
	FTCPSocketListeningTh::Shutdown();
	FServerStatusCheckingTh::Shutdown();
}

Solved, I called a function to create a threads multiple times) eventually create a threads with the same name.

Morality of story: in any strange situation, go to sleep)