[SERVER-24104] Replace std::duration types with implementations that throw exceptions on overflow Created: 09/May/16 Updated: 25/Jan/17 Resolved: 17/May/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | 3.3.8 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Andy Schwerin | Assignee: | Andy Schwerin |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Sprint: | Sharding 14 (05/13/16), Sharding 15 (06/03/16) | ||||||||||||
| Participants: | |||||||||||||
| Linked BF Score: | 0 | ||||||||||||
| Description |
|
The std::duration types, which underly stdx::duration, have undefined behavior on overflow and in some other situations that we can easily and inadvertently encounter. Since we do not require optimal arithmetic performance on our duration types, it would be better to replace them with implementations that throw on overflow. |
| Comments |
| Comment by Githook User [ 20/May/16 ] |
|
Author: {u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}Message: We can't just static_assert in the duration constructors, because we need overload resolution to This adds standard required sfinae to those ctors. In other cases where the standard uses sfinae, |
| Comment by Andy Schwerin [ 20/May/16 ] |
|
We raised the GCC compiler minimum to 5.3 in |
| Comment by Igor Canadi [ 20/May/16 ] |
|
https://github.com/mongodb/mongo/commit/97f24aa42d86dcadd789ba2c9e144709fa7a7aab uses built-in functions only available in gcc since 5.0 version: https://gcc.gnu.org/gcc-5/changes.html. I get this failure with gcc 4.8.5: https://gist.github.com/igorcanadi/1dca04aa6f6506a4ce6ffb5cf5fb72d3 Are you dropping support for gcc before 5.0? |
| Comment by Githook User [ 18/May/16 ] |
|
Author: {u'username': u'visemet', u'name': u'Max Hirschhorn', u'email': u'max.hirschhorn@mongodb.com'}Message: |
| Comment by Githook User [ 17/May/16 ] |
|
Author: {u'username': u'spencerjackson', u'name': u'Spencer Jackson', u'email': u'spencer.jackson@mongodb.com'}Message: |
| Comment by Githook User [ 17/May/16 ] |
|
Author: {u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}Message: |
| Comment by Githook User [ 17/May/16 ] |
|
Author: {u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}Message: The mongo::Duration type does overflow checking on casts and arithmetic. This patch also moves DESTRUCTOR_GUARD out of assert_util.h into |
| Comment by Githook User [ 17/May/16 ] |
|
Author: {u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}Message: This is a preliminary step for switching from stdx::chrono::duration to mongo::Duration. |
| Comment by Andy Schwerin [ 17/May/16 ] |
|
http://github.com/mongodb/mongo/commit/11e82fe19c81bd1a5d350a219c3a000e959b6dd6 Accidentally left the ticket number off the commit message. |
| Comment by Githook User [ 16/May/16 ] |
|
Author: {u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}Message: These errors were exposed by removing some unnecessary includes from |
| Comment by Githook User [ 10/May/16 ] |
|
Author: {u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}Message: |