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

**URL:** <https://forums.unrealengine.com/t/how-to-fix-logstats-metadata-mismatch-did-you-assign-a-stat-to-two-groups/370543>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [September 15, 2016, 1:47pm UTC](https://forums.unrealengine.com/t/how-to-fix-logstats-metadata-mismatch-did-you-assign-a-stat-to-two-groups/370543 "2016-09-15T13:47:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Syntopia](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Syntopia](https://forums.unrealengine.com/u/Syntopia)\
**Post date:** [September 15, 2016, 1:47pm UTC](https://forums.unrealengine.com/t/how-to-fix-logstats-metadata-mismatch-did-you-assign-a-stat-to-two-groups/370543/1 "2016-09-15T13:47:32Z")

</div>

Hello,

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

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

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();
}
```

---

<div class="post-metadata">

**Author:** ![Syntopia](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Syntopia](https://forums.unrealengine.com/u/Syntopia)\
**Post date:** [September 16, 2016, 10:08am UTC](https://forums.unrealengine.com/t/how-to-fix-logstats-metadata-mismatch-did-you-assign-a-stat-to-two-groups/370543/2 "2016-09-16T10:08:52Z")

</div>

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)
