-
Type: Bug
-
Resolution: Done
-
Priority: Critical - P2
-
Affects Version/s: 1.2.0
-
Component/s: None
-
None
-
Environment:Solaris 11, x86_64
In 1.2.0-dev, mongoc_topology_select is responsible for selecting a server from your deployment for an operation. In pooled clients, if mongoc_topology_select doesn't know of a suitable server, it uses a condition variable to wait up to serverSelectionTimeoutMS for the monitor thread to discover one.
To use pthread_cond_wait, the driver begins by calculating the current time in milliseconds since the epoch:
struct timeval tv; int64_t msec; bson_gettimeofday (&tv); msec = (tv.tv_sec * 1000) + (tv.tv_usec / 1000) + timeout_msec;
This works on platforms where tv_sec is a 64-bit int, but on Solaris it's 32 bits and overflows. (These days, representing tv_sec requires 31 bits, so multiplying it by 1000 overflows.)
The driver constructs a negative timespec from this calculation and passes it to pthread_cond_wait, which returns EINVAL and mongoc_topology_select quits.
- is related to
-
CDRIVER-1305 Some tests hang on 32-bit Unix
- Closed