Supervisor / supervisor

Supervisor process control system for Unix (supervisord)
http://supervisord.org
Other
8.53k stars 1.25k forks source link

error: <class 'xml.parsers.expat.ExpatError'>, unclosed token: line 130, column 0: file: /usr/lib/python3.10/xmlrpc/client.py line: 460 #1623

Open yangyile1990 opened 10 months ago

yangyile1990 commented 10 months ago
supervisor> 
supervisor> restart simple:
error: <class 'xml.parsers.expat.ExpatError'>, unclosed token: line 130, column 0: file: /usr/lib/python3.10/xmlrpc/client.py line: 460
supervisor> 

Now all the sub service in the simple: group are STOPPED

Then run the same commond. get the same error message.

supervisor> 
supervisor> restart simple:
error: <class 'xml.parsers.expat.ExpatError'>, unclosed token: line 130, column 0: file: /usr/lib/python3.10/xmlrpc/client.py line: 460
supervisor> 

Now all the sub service in the simple: group are RUNNING

supervisor> 
supervisor> version
4.2.1
supervisor> 

So what is the reason.

I can restart my sub service one by one.

By the way my simple.conf contains a lot of chinese characters. I think this is the reason. But I have to use chinese characters as my project is chinese and my project path is chinese an my log path is in chinese.

So how to support NON-ASCII code in conf file? If you don't support use chinese characters in the conf file, you can also tell it to me. As I have read the doc but I can not find it says not support chinese characters.

please help me.

waketzheng commented 2 months ago

After try a demo, I found that supervisor did support non-ascii characters in conf file.

Example

numprocs=1 autostart=true startsecs=10 autorestart=true startretried=3 redirect_stderr=true stdout_logfile_maxbytes=20MB stdout_logfile_backups=20

- main.py
```py
#!/usr/bin/env python
from pathlib import Path

import fastapi_cdn_host
import uvicorn
from fastapi import FastAPI

BASE_DIR = Path(__file__).resolve().parent
app = FastAPI(title=BASE_DIR.name)
fastapi_cdn_host.patch_docs(app)

@app.get('/')
async def root():
    return '车如流水马如龙,美人如玉剑如虹。'

def main() -> None:
    uvicorn.run(f'{Path(__file__).stem}:app', reload=True)

if __name__ == '__main__':
    main()

[tool.poetry.dependencies] python = "^3.11" fastapi = "^0.112.2" uvicorn = "^0.30.6" fastapi-cdn-host = "^0.7.5" fastapi-cli = {version = "^0.0.5", platform = "linux"}

[build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api"

- Install poetry and deps
```bash
pip install pipx --user
which pipx || export PATH=$PATH:$HOME/.local/bin
pipx ensurepath
pipx install poetry
wget https://mirror.ghproxy.com/https://raw.githubusercontent.com/waketzheng/carstino/main/pip_conf.py
python pip_conf.py --poetry # 给poetry换源
mkdir /root/部署
cd /root/部署
poetry new dongfang
cd dongfang
poetry add fastapi uvicorn fastapi-cdn-host fastapi-cli
[[ -f man.py ]] || echo -e "from fastapi import FastAPI\napp=FastAPI()\n@app.get('/')\nasync def root():\n    return 'homepage'" > main.py
poetry run fastapi dev main.py