[SERVER-36978] TaskRunner must ensure Client is initialized for thread before running tasks Created: 04/Sep/18  Updated: 29/Oct/23  Resolved: 21/Sep/18

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: 3.4.16, 3.6.7, 4.0.2, 4.1.2
Fix Version/s: 3.4.18, 3.6.9, 4.0.4, 4.1.4

Type: Bug Priority: Major - P3
Reporter: Tess Avitabile (Inactive) Assignee: Tess Avitabile (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.0, v3.6, v3.4
Sprint: Repl 2018-09-24
Participants:
Linked BF Score: 46

 Description   

If TaskRunner::_runTasks() neverĀ runs the body of this loop (for example, due to a shutdown request), then it will never initialize the Client for the thread. Then, when it cancels tasks, it there will be no Client set on the thread. This means it will be illegal for the task to call Client::cc(). TaskRunner::_runTasks() should ensure the Client is initialized before running runSingleTask().



 Comments   
Comment by Githook User [ 05/Oct/18 ]

Author:

{'name': 'Tess Avitabile', 'email': 'tess.avitabile@mongodb.com', 'username': 'tessavitabile'}

Message: SERVER-36978 TaskRunner must ensure Client is initialized for thread before running tasks

(cherry picked from commit fb4e163ff4a8ce5057b66b24f41f1bf193e2058c)
Branch: v3.4
https://github.com/mongodb/mongo/commit/90535dd9fc4355969a2adc3ff921537a464845fb

Comment by Githook User [ 05/Oct/18 ]

Author:

{'name': 'Tess Avitabile', 'email': 'tess.avitabile@mongodb.com', 'username': 'tessavitabile'}

Message: SERVER-36978 TaskRunner must ensure Client is initialized for thread before running tasks

(cherry picked from commit fb4e163ff4a8ce5057b66b24f41f1bf193e2058c)
Branch: v3.6
https://github.com/mongodb/mongo/commit/4a87040fdaca7cb76828ff52546c3c57c7da67ac

Comment by Githook User [ 05/Oct/18 ]

Author:

{'name': 'Tess Avitabile', 'email': 'tess.avitabile@mongodb.com', 'username': 'tessavitabile'}

Message: SERVER-36978 TaskRunner must ensure Client is initialized for thread before running tasks

(cherry picked from commit fb4e163ff4a8ce5057b66b24f41f1bf193e2058c)
Branch: v4.0
https://github.com/mongodb/mongo/commit/3de6632d615a35342464cab5b88643d8efd04abd

Comment by Githook User [ 21/Sep/18 ]

Author:

{'name': 'Tess Avitabile', 'email': 'tess.avitabile@mongodb.com', 'username': 'tessavitabile'}

Message: SERVER-36978 TaskRunner must ensure Client is initialized for thread before running tasks
Branch: master
https://github.com/mongodb/mongo/commit/fb4e163ff4a8ce5057b66b24f41f1bf193e2058c

Comment by Tess Avitabile (Inactive) [ 18/Sep/18 ]

benety.goh, do you know why the task runner initializes the client and opCtx only as neededĀ here instead of always initializing them here? I would like to change the task runner to always initialize the client and opCtx, but I'm not sure if there is a reason not to, such as for performance.

Generated at Thu Feb 08 04:44:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.