[SERVER-49455] Improve error reporting in launchServiceWorkerThread() Created: 10/Jul/20  Updated: 12/Oct/21  Resolved: 17/Nov/20

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Amirsaman Memaripour Assignee: Benjamin Caimano (Inactive)
Resolution: Duplicate Votes: 0
Labels: servicearch-wfbf-day
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-48509 "failed to create service entry worke... Closed
duplicates SERVER-50035 save the errno from pthread_create to... Closed
Related
Sprint: Service arch 2020-11-30
Participants:
Linked BF Score: 0

 Description   

We use launchServiceWorkerThread() to spawn new threads for ServiceExecutorSynchronous. It may return a non-okay status on the event of a failure. However, the information stored in the returned status is sometimes not very useful (see below). We should improve the error reporting components of this function to facilitate debugging.

[cpp_unit_test:transport_test] 2020-07-08T09:53:11.436+0000 | 2020-07-08T09:53:11.436Z E  TEST     23070   [main] "Throwing exception","attr":{"exception":"Expected ::mongo::Status::OK() == (status) (OK  == InternalError Failed to create service entry worker thread: pthread_create failed: Success) @src/mongo/transport/service_executor_test.cpp:144"}



 Comments   
Comment by Amirsaman Memaripour [ 12/Oct/21 ]

g.fanini@gmail.com, launchServiceWorkerThread() is only called to run the first task for an accepted ingress connection on a mongod/mongos server. Any task, including commands, scheduled after the first one will use the existing thread and won't spawn new threads. See here for reference. This is the expected behavior, both for Linux and Windows, and there are safe-guards to ensure this.

Comment by G F [ 03/Oct/21 ]

excuse me, may I ask for an information, is it thinkable that launchServiceWorkerThread is continuously spawning a thread for each command received from a client in a continuous session, at least compiled for windows not linux ? surely I misunderstood ?

Comment by Benjamin Caimano (Inactive) [ 17/Nov/20 ]

I think we have this covered between SERVER-48509 and SERVER-50035.

Comment by Amirsaman Memaripour [ 10/Jul/20 ]

One possible solution is to also include error codes in log messages.

Generated at Thu Feb 08 05:19:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.