Trac issueshttps://gitlab.torproject.org/legacy/trac/-/issues2020-06-13T15:40:46Zhttps://gitlab.torproject.org/legacy/trac/-/issues/30187100% cpu usage in winthreads tor_cond_wait2020-06-13T15:40:46ZTrac100% cpu usage in winthreads tor_cond_waitFor years I run relay using self-compiled win64 version of tor.
Compiler mingw64.
Relay runs well for some time but suddenly starts using 100% cpu all cores.
I traced where it happens. The following loop never ends :
```
do {
DWO...For years I run relay using self-compiled win64 version of tor.
Compiler mingw64.
Relay runs well for some time but suddenly starts using 100% cpu all cores.
I traced where it happens. The following loop never ends :
```
do {
DWORD res;
res = WaitForSingleObject(cond->event, ms);
EnterCriticalSection(&cond->lock);
if (cond->n_to_wake &&
cond->generation != generation_at_start) {
--cond->n_to_wake;
--cond->n_waiting;
result = 0;
waiting = 0;
goto out;
} else if (res != WAIT_OBJECT_0) {
result = (res==WAIT_TIMEOUT) ? 1 : -1;
--cond->n_waiting;
waiting = 0;
goto out;
} else if (ms != INFINITE) {
endTime = GetTickCount();
if (startTime + ms_orig <= endTime) {
result = 1; /* Timeout */
--cond->n_waiting;
waiting = 0;
goto out;
} else {
ms = startTime + ms_orig - endTime;
}
}
/* If we make it here, we are still waiting. */
if (cond->n_to_wake == 0) {
/* There is nobody else who should wake up; reset
* the event. */
ResetEvent(cond->event);
}
out:
LeaveCriticalSection(&cond->lock);
} while (waiting);
```
res = WAIT_OBJECT_0;
ms = INFINITE;
cond->n_to_wake=0x11
cond->generation=0x28
generation_at_start=0x28
it means no path with "goto out" ever execute
more than one thread run this loop and each one eat separate core
Some people I shared binaries with report same problem.
Pls check
**Trac**:
**Username**: bolvanTor: unspecifiedAlexander Færøyahf@torproject.orgAlexander Færøyahf@torproject.orghttps://gitlab.torproject.org/legacy/trac/-/issues/9820oficially offer win64 version of tor2020-06-13T05:45:45ZTracoficially offer win64 version of torDue to recent botnet activity relay operators suffer from high cpu usage. Properly recompiling tor with mingw64 helps reduce cpu usage twice. I did it for myself and think others will also benefit from that.
I also did small modification...Due to recent botnet activity relay operators suffer from high cpu usage. Properly recompiling tor with mingw64 helps reduce cpu usage twice. I did it for myself and think others will also benefit from that.
I also did small modification to sources to allow settings process priority for tor. It can be important to lower priority when running on single and two core cpus if you use your computer for other purposes than tor and dont want tor to slow down anything else.
**Trac**:
**Username**: bolvanErinn ClarkErinn Clarkhttps://gitlab.torproject.org/legacy/trac/-/issues/9826tor process priority in windows2020-06-13T14:32:15ZTractor process priority in windowsDue to recent botnet activity relay operators suffer from high cpu usage. When running on single and two core cpu's tor process can slow down other tasks. In some cases it is desired to have tor process priority lowered. Windows do not ...Due to recent botnet activity relay operators suffer from high cpu usage. When running on single and two core cpu's tor process can slow down other tasks. In some cases it is desired to have tor process priority lowered. Windows do not have built-in ways to set priority for services.
I implemented little mod for myself. It uses some torrc variable and calls SetPriorityClass API.
I think it would be great if official version had the same feature.
**Trac**:
**Username**: bolvanTor: unspecified