Issue 10098

Title
Show current requests
Priority
feature
Status
resolved
Nosy list
albertca, ced, pokoli, reviewbot, roundup-bot
Assigned to
ced
Keywords
review

Created on 2021-02-13.09:55:49 by ced, last changed 3 weeks ago by roundup-bot.

Messages

New changeset 52781e4a3bff by Cédric Krier in branch 'default':
Add status command
https://hg.tryton.org/tryton-env/rev/52781e4a3bff
New changeset e49423e63825 by Cédric Krier in branch 'default':
Add status command
https://hg.tryton.org/trytond/rev/e49423e63825
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-03-17.09:45:04
On 2021-03-17 09:15, Sergi Almacellas Abellana wrote:
> It will be great if we can also show the database name (in case there are multiple databases this is usefull) and also the user who triggered the user.
> 
> Do you think it's possible to log also this information? 

The database is in the path but I will add it Cron and Task.
For the user we can only show the value from the request header without
any validation.
Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2021-03-17.09:15:50

It will be great if we can also show the database name (in case there are multiple databases this is usefull) and also the user who triggered the user.

Do you think it's possible to log also this information?
I suspect the users won't be available on cron or workers but for me it's not a big issue if we leave it empty.

Author: [hidden] (albertca) Tryton committer
Date: 2021-03-14.22:53:12

Thanks a lot for the work. That looks pretty cool!

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-03-14.19:01:32

The last version is based on a unix socket to which all processes write periodically the status if the socket exists. And a trytond-stat curses command creates the socket and display a sorted list of the requests, see:

Author: [hidden] (albertca) Tryton committer
Date: 2021-02-15.00:53:17

Maybe we should consider implementing a kind of trytond-monitor or trytond-top cli tool.

trytond instances could send a "start" and "end" message to a socket (or the existing log files), for each request, which could be captured and interpreted by trytond-monitor.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-02-15.00:05:30

There is one problem with this design, it is that when run under µwsgi it is not possible to send the SIGUSR1 signal to the workers. I tried also by activating the option py-call-osafterfork but µwsgi keep catching the signal and output its own statistics.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-02-13.09:55:49

Sometimes on production we may have database lock due to a long request or resource exhaustion which slow down the server etc. When such thing happens it is sometimes very difficult to find which request is causing the problem. For database lock, it is possible to find the database session but it may be very hard to link it to a specific request. This is mainly because we can not know which requests are processed now (and the cron jobs or tasks).
I propose to use a signal (SIGUSR1) to request a trytond process to dump to the log file the currently running requests, cron jobs and tasks with their starting time.
For request it will include the username if authorized, the remote address, the path, method and params (size limited from issue8101).
For cron job it will include the database, the cron id and method.
For tasks it will include the database, the task id.

History
Date User Action Args
2021-03-27 19:43:28roundup-botsetmessages: + msg65868
2021-03-27 19:43:24roundup-botsetmessages: + msg65867
nosy: + roundup-bot
status: testing -> resolved
2021-03-17 10:31:54reviewbotsetmessages: + msg65575
2021-03-17 10:05:16reviewbotsetmessages: + msg65574
2021-03-17 09:45:04cedsetmessages: + msg65573
2021-03-17 09:15:50pokolisetmessages: + msg65571
nosy: + pokoli
2021-03-15 10:42:37reviewbotsetmessages: + msg65515
2021-03-14 22:53:12albertcasetmessages: + msg65510
2021-03-14 20:10:06reviewbotsetmessages: + msg65509
2021-03-14 19:13:31reviewbotsetmessages: + msg65508

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