[SERVER-15122] Result of gettimeofday() is not checked Created: 03/Sep/14  Updated: 30/Jun/16  Resolved: 17/Jun/16

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

Type: Bug Priority: Minor - P4
Reporter: Kevin Pulo Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-4740 Use monotonic clock sources for Timer Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Platforms 16 (06/24/16)
Participants:

 Description   

As SERVER-4740 explains, the server shouldn't use gettimeofday() for timing. However, the code currently does, and it doesn't check whether the call succeeded or not. If gettimeofday() returns -1 (not 0), then the call has failed and the values in the timeval struct shouldn't be used (they may not have even been initialised).



 Comments   
Comment by Kevin Pulo [ 30/Jun/16 ]
  • POSIX gettimeofday does not return errors.
  • The Linux and OS X man pages do indicate some error possibilities, but in both cases, the errors are inapplicable (related to tz parameter for which we always pass nullptr, or refer to calling settimeofday, or refer to a fault for the first parameter, for which we are passing the address of a stack allocated variable).
  • We're not aware of any evidence that this call has ever actually failed in practice.
  • Therefore, this has been closed out as "Works As Designed".
Generated at Thu Feb 08 03:37:00 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.