Comments (12)
I have the same issue and fixed it by reducing the load in the main busy-waiting loops.
Try this patch:
diff --git a/py-kms/pykms_Server.py b/py-kms/pykms_Server.py
index 80c182a..2a1638d 100644
--- a/py-kms/pykms_Server.py
+++ b/py-kms/pykms_Server.py
@@ -10,6 +10,7 @@ import logging
import os
import errno
import threading
+import time
try:
# Python 2 import.
@@ -57,6 +58,7 @@ class server_thread(threading.Thread):
self.is_running = False
self.server = None
self.queue.task_done()
+ time.sleep(0.1)
##-----------------------------------------------------------------------------------------------------------------------------------------------
@@ -249,6 +251,7 @@ class kmsServer(socketserver.BaseRequestHandler):
loggersrv.info("Responded to activation request.")
ShellMessage.Process([-3, 18, 19]).run()
break
+ time.sleep(0.1)
def finish(self):
self.request.close()
ZIP file:
pykms-reduce-cpu.zip
from py-kms.
I investigated problem and i noted that's dependent on how docker container is created.
So i created a docker container in this way:
and visualized some things:
Actually there's a cpu overload. (with commands sudo docker stats --no-stream
and sudo docker exec -ti container_id top
)
Then i created another docker container with -it
option, and this doesn't suffer the same problem.
View previous image and top
command result:
I tested that py-kms process runs good with:
sudo docker exec -ti container_id bash
python3 pykms_Client.py 0.0.0.0 1688
cat /var/log/py3-kms.log
and then exiting from bash:
sudo docker logs container_id
Note: environment variables must be called before container ID, so run-py3-kms.sh, run-py2-kms.sh and docker readme require correction.
I await feedback.
from py-kms.
me too...have to kill it to recover. I used it on GCP.
from py-kms.
from py-kms.
@SystemRage Can you start up the python3 docker container? That's how i am running it. On a fully up to date ubuntu 18.04, docker 18.09-6
I put LOGLEVEL=DEBUG but there is no logging at all
from py-kms.
Yeah that reduces the load for me. Ugly workaround but hey it works :)
from py-kms.
With the sleep in the while loop the 100% CPU usage is gone. Could you run the pykms_Server.py in a docker container?
from py-kms.
Seems to work pretty well 👍
from py-kms.
I'm running master branch on a vanilla Ubuntu 18.04 install (not Docker-ized). Standard systemd unit file produces a 100% CPU utilization due to loop logic. Is this in pipeline to address, or is the best workaround to wrap in a screen -DmS shell?
[Unit]
Description=kms
After=network.target
Wants=network-online.target
[Service]
ExecStart=/usr/bin/python3 /opt/kms/py-kms/pykms_Server.py -V DEBUG --logfile /var/log/py-kms_server.log
Restart=always
KillMode=process
Type=idle
User=nobody
Group=nogroup
[Install]
WantedBy=multi-user.target
from py-kms.
I have the same issue and fixed it by reducing the load in the main busy-waiting loops.
Try this patch:
diff --git a/py-kms/pykms_Server.py b/py-kms/pykms_Server.py index 80c182a..2a1638d 100644 --- a/py-kms/pykms_Server.py +++ b/py-kms/pykms_Server.py @@ -10,6 +10,7 @@ import logging import os import errno import threading +import time try: # Python 2 import. @@ -57,6 +58,7 @@ class server_thread(threading.Thread): self.is_running = False self.server = None self.queue.task_done() + time.sleep(0.1) ##----------------------------------------------------------------------------------------------------------------------------------------------- @@ -249,6 +251,7 @@ class kmsServer(socketserver.BaseRequestHandler): loggersrv.info("Responded to activation request.") ShellMessage.Process([-3, 18, 19]).run() break + time.sleep(0.1) def finish(self): self.request.close()ZIP file:
pykms-reduce-cpu.zip
Valid fix, i guess.
from py-kms.
Also having this issue, the patch seems to work.
from py-kms.
Adding some timeout when getting from queue resolves cpu overload (similar to sleep(), but more elegant). The second timeout (in request handler) can be omitted, tested without it and cpu stays low.
So docker options -it or #51 could be not used.
from py-kms.
Related Issues (20)
- Docker with SQLite fails to start due to incorrect parms HOT 3
- Docker run it is not working with python3 tag HOT 1
- Error: ←[7m←[91m←[1mSO_REUSEPORT not supported on this platform. Exiting...←[0m HOT 2
- What does the "connect" subparameter do? HOT 1
- Confused about some of the defaults HOT 4
- Office Pro 2019 Converted from Retail to Volume Not Genuine Error HOT 4
- If yoy dont like russia HOT 1
- What's the error? HOT 1
- Windows Server 2022 HOT 30
- Add support for Windows Server 2022 to Docker Hub image HOT 11
- latest versions of tzlocal leads to 0xC004F074 error HOT 2
- Server 2022 Update HOT 1
- Broken server help and ather HOT 2
- Cannot Activate MS Office LTSC Professional Plus 2021 HOT 3
- [IMPORTANT] This repository is dead. Please use a fork! HOT 1
- Cannot assign Ip Address (Errno 99) HOT 1
- We need Relation-DB support ?
- systemed keeps crashing HOT 1
- GCC and python3-dev is missing HOT 1
- ActivationID with multiples Products
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from py-kms.