[CDRIVER-2567] Cluster time failure on /Topology/invalid_cluster_node Created: 23/Mar/18  Updated: 28/Oct/23  Resolved: 25/Mar/18

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.10.0

Type: Bug Priority: Major - P3
Reporter: Kevin Albertson Assignee: Kevin Albertson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to CDRIVER-4565 Occasional t2 >= t1 assertion failure... Closed
is related to CDRIVER-1995 /Topology/cooldown/standalone sometim... Closed
is related to CDRIVER-2115 Rare mock server test failures on 32-bit Closed

 Description   

This failure on evergreen https://evergreen.mongodb.com/task/mongo_c_driver_clang38_i386_test_3.6_sharded_cluster_noauth_nosasl_nossl_8d4c916c2a2f80a682af20b2d1169624681bfd48_18_03_23_11_52_18

Failed on a seemingly straightforward assertion about the timestamp on a cluster_node_t.

The failure seems to suggest that there's an integer overflow somewhere.

[2018/03/23 10:21:40.250] Assert Failure: 4294573995 < 607012
[2018/03/23 10:21:40.250] tests/test-mongoc-topology.c:430  test_invalid_cluster_node()

The right-hand side timestamp is generated one second after the left. Assuming it wraps at UINT32_MAX, then the values do make sense:

(UINT32_MAX - 4294573995) + 607012 = 1000313 // about one second

From what I've on a spawn host for Ubuntu 16.04 with the artifacts I haven't determined if/where the overflow is occurring. For now, we should try printing out any additional information on another potential future failure.



 Comments   
Comment by Githook User [ 25/Mar/18 ]

Author:

{'email': 'kevin.albertson@10gen.com', 'name': 'Kevin Albertson', 'username': 'kevinAlbs'}

Message: CDRIVER-2567 fix 32 bit bson_get_monotonic_time
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/47565f8a53856f09253806f753f6b9b9fe0953d7

Comment by Kevin Albertson [ 25/Mar/18 ]

This was caused by an overflow calculation in bson_get_monotonic_time on 32 bit systems. On 32 bit systems, the fields of struct timespec are 4 byte integers, so calculations like:

return ((ts.tv_sec * 1000000UL) + (ts.tv_nsec / 1000UL));

Would overflow in the multiplication of tv_sec.

This bug is also likely the cause of CDRIVER-1995 and possibly the cause of CDRIVER-2115.

Generated at Wed Feb 07 21:15:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.