[CDRIVER-752] Server selection times out immediately on Solaris Created: 17/Jul/15 Updated: 25/Jul/16 Resolved: 21/Jul/15 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | 1.2.0 |
| Fix Version/s: | 1.2-beta0 |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | A. Jesse Jiryu Davis | Assignee: | A. Jesse Jiryu Davis |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Solaris 11, x86_64 |
||
| Issue Links: |
|
||||||||
| Description |
|
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:
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. |
| Comments |
| Comment by A. Jesse Jiryu Davis [ 25/Jul/16 ] |
|
Could be related to |
| Comment by A. Jesse Jiryu Davis [ 21/Jul/15 ] |
|
No need for backport, mongoc_cond_timedwait is only in 1.2. |
| Comment by Githook User [ 21/Jul/15 ] |
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}Message: On Solaris, at least, timeval.tv_sec is 32 bits. Cast to int64_t before |