Issue 10706

Title
status with multiple container
Priority
bug
Status
resolved
Nosy list
ced, pokoli, reviewbot, roundup-bot
Assigned to
ced
Keywords
review

Created on 2021-09-02.11:12:11 by ced, last changed 3 weeks ago by roundup-bot.

Messages

New changeset ad527be4ed6e by Cédric Krier in branch 'default':
Add node to id of status
https://hg.tryton.org/tryton-env/rev/ad527be4ed6e
New changeset bf276f67b2c4 by Cédric Krier in branch 'default':
Add node to id of status
https://hg.tryton.org/trytond/rev/bf276f67b2c4
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-09-02.15:53:30

The problem is that usually with docker deployment, the hostname of multiple same container is just suffixed by an indice. So the end has a very meaningful.
I think the best solution would be in case of long name: <1234@host...name_123>.

Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2021-09-02.15:16:24

Maybe using <pid@hostname> and increase padding to 10 digits should do the trick.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-09-02.11:47:51

It looks like it could work considering that docker hostname must be unique.
Also it has the advantage to provide a way to the user to find where is the process if we display the hostname-pid in the stat. So we could just prepend to the pid the hostname. The only problem is that we pad PID to 5 but now it will be random length. So we will probably need to ellipsis (in the middle) in the rendering the hostname if it is too long.

Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2021-09-02.11:23:49

Should we use the hostname-pid combination?
When using docker, the hostname is different for each container so it will make it unique without the need of an uuid.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-09-02.11:12:11

When running multiple Tryton containers (for serving, cron, worker etc), the database path is mounted with the same volume for all the containers. So when running trytond-stat on any container, it creates the file socket for all the containers. This should not be a problem as the socket communication is design to receive from multiple processes because we rely on the PID to distinct the data from each processes. The problem is that the PID (from os.getpid()) inside a container can be the same as another process inside another container (and the odds are hight to have collision as docker tent to start with low PID).
I could not find a way to get real PID of the process from inside the container (I think it is on purpose for security reason). And anyway it will not solve completely the problem is the containers are run on multiple machines.
So a possible idea will be to use a UUID that is generated once by the status when starting the dumper and use this UUID as unique identifier to store processes in trytond-stat.

History
Date User Action Args
2021-09-23 10:04:41roundup-botsetmessages: + msg70288
2021-09-23 10:04:37roundup-botsetmessages: + msg70287
nosy: + roundup-bot
status: testing -> resolved
2021-09-11 00:19:32reviewbotsetmessages: + msg70025
nosy: + reviewbot
2021-09-11 00:09:20cedsetassignedto: ced
keyword: + review
reviews: 360101002
status: chatting -> testing
2021-09-02 15:53:30cedsetmessages: + msg69792
2021-09-02 15:16:24pokolisetmessages: + msg69791
2021-09-02 11:47:51cedsetmessages: + msg69781
2021-09-02 11:23:49pokolisetmessages: + msg69780
nosy: + pokoli
status: unread -> chatting
2021-09-02 11:12:11cedcreate

Showing 10 items. Show all history (warning: this could be VERY long)