Description
I am running a flask application in a docker container.
The docker container has a cpu quota and is using an alpine based image. Unit and unit-python3 are the ones provided by the alpine image (currently unit 1.26.1). the unit process is managed in the container by s6-init, which allows me to do a bit of app preparation before unit starts, but also would restart unit if it crashes.
Very often when the flask application process is requesting a lot of cpu, unit is loosing the configuration.
The config json in /var/lib/unit/conf.json
is still there and valid. If I restart the container everything goes well... until next cpu intensive operation.
I have no problem with the worker crashing due to cpu or memory quota, but I'd like my unit to keep running. Also acceptable if unit crashes. In that case it can be restarted automatically.
I would appreciate very much any ideas. Thank you!
This is my current startup arguments and configuration:
startup:
unitd --no-daemon --control 127.0.0.1:8080 --log /var/log/app/app.log
curl localhost:8080
output:
{
"certificates": {},
"config": {
"listeners": {
"*:5000": {
"application": "app"
}
},
"applications": {
"hxlproxy": {
"type": "python",
"processes": {
"max": 20,
"spare": 3,
"idle_timeout": 20
},
"module": "app",
"path": "/srv/www",
"threads": 5
}
},
"settings": {
"http": {
"max_body_size": 1584000000
}
}
}
}
curl localhost:8080
output when things went south:
{
"certificates": {},
"config": {
"listeners": {
},
"applications": {
},
}
}