Bug 1425596 - [RFE] Provide a way to correlate each 'run and protect' thread to its task
Summary: [RFE] Provide a way to correlate each 'run and protect' thread to its task
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: vdsm
Version: 4.1.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ovirt-4.2.0
: 4.2.0
Assignee: Nir Soffer
QA Contact: Lucie Leistnerova
URL:
Whiteboard:
Depends On:
Blocks: 1425219 1461295
TreeView+ depends on / blocked
 
Reported: 2017-02-21 20:49 UTC by Marina Kalinin
Modified: 2019-05-16 13:04 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
undefined
Clone Of:
: 1461295 (view as bug list)
Environment:
Last Closed: 2018-05-15 17:50:23 UTC
oVirt Team: Infra
Target Upstream Version:
Embargoed:
lsvaty: testing_plan_complete-


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:1489 0 None None None 2018-05-15 17:52:06 UTC
oVirt gerrit 77456 0 master MERGED api: Show task id in storage api logs 2017-06-06 21:06:23 UTC
oVirt gerrit 77893 0 ovirt-4.1 MERGED api: Show task id in storage api logs 2017-07-04 12:23:49 UTC

Description Marina Kalinin 2017-02-21 20:49:02 UTC
Today, there is no way to correlate directly (without guessing and hoping it is your lucky day) from 'run and protect' thread to the task opened to fulfill the request. Unless you go to engine.log and try correlating the command from there.
If engine.log is missing or system has high traffic of events going on and the threads in the pool are being reused frequently, the likelihood of correlating the thread to its task successfully decreases. 

Example of current behavior:
~~~
INFO  (jsonrpc/6) [dispatcher] Run and protect: create_lease(lease={u'sd_id': u'd4ad5a78-1d75-457b-8caf-400d2d7917a6', u'lease_id': u'7eb2c25b-1bc8-4016-a9a5-73c6a69d2fa2'})

INFO  (tasks/2) [storage.ThreadPool.WorkerThread] START task a6a2107d-63b0-42b3-ac60-4ebbb1d1e3a9 (cmd=<bound method Task.commit of <storage.task.Task instance at 0x31afa70>>, args=None)

INFO  (tasks/2) [storage.xlease] Adding lease '7eb2c25b-1bc8-4016-a9a5-73c6a69d2fa2' in lockspace u'd4ad5a78-1d75-457b-8caf-400d2d7917a6' (xlease:548)
~~~

Expected behavior:
Add a correlation ID to be present in both thread and task. This sounds like the best option to me.

Or somehow add the task information in run and protect message or the other way around. But the problem with other way around is that jsonrpc threads seem to be reused from a pool of threads and they do not really have a unique identifier as the task does.

Comment 2 Nir Soffer 2017-03-23 23:05:37 UTC
All storage verbs run in a task, and the task id is available via vars.task.id.
We just need to add the task id in the logger creating the "Run and protect"
messages.

Can be something like:

INFO  (jsonrpc/6) [dispatcher] Run and protect: create_lease(lease={u'sd_id': u'd4ad5a78-1d75-457b-8caf-400d2d7917a6', u'lease_id': u'7eb2c25b-1bc8-4016-a9a5-73c6a69d2fa2'}) (task=a6a2107d-63b0-42b3-ac60-4ebbb1d1e3a9)
...
INFO  (tasks/2) [storage.ThreadPool.WorkerThread] START task a6a2107d-63b0-42b3-ac60-4ebbb1d1e3a9 (cmd=<bound method Task.commit of <storage.task.Task instance at 0x31afa70>>, args=None)
...
INFO  (jsonrpc/6) [dispatcher] Run and protect: create_lease, Return response: None)
(task=a6a2107d-63b0-42b3-ac60-4ebbb1d1e3a9)

Adding correction id can be nice, but we don't have it now in vdsm, it was dropped
when we moved to jsonrpc.

Comment 3 Nir Soffer 2017-05-28 16:58:40 UTC
This is trivial using the new logging infrastructure introduced in 4.1.3.

Comment 7 Lucie Leistnerova 2017-11-06 09:33:07 UTC
Every vdsm.api START/FINISH call has its task_id. This format replaced the 'Run and protect' prefix.
So the start/finish of asynchronous action can be correlate to 'START task' action.

verified in vdsm-4.20.6-1.el7ev.x86_64

Comment 12 errata-xmlrpc 2018-05-15 17:50:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2018:1489

Comment 13 Franta Kust 2019-05-16 13:04:50 UTC
BZ<2>Jira Resync


Note You need to log in before you can comment on or make changes to this bug.