[SERVER-22715] Add an assert to Array.shuffle Created: 18/Feb/16 Updated: 24/Feb/16 Resolved: 19/Feb/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | JavaScript, Shell |
| Affects Version/s: | 3.3.1 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Robert Guo (Inactive) | Assignee: | Robert Guo (Inactive) |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Sprint: | TIG 10 (02/19/16), TIG 11 (03/11/16) | ||||||||
| Participants: | |||||||||
| Linked BF Score: | 0 | ||||||||
| Description |
|
Array.shuffle becomes an infinite loop if we do the following: Random.randint = NumberLong We should assert that we're not growing the array in Array.shuffle |
| Comments |
| Comment by Robert Guo (Inactive) [ 19/Feb/16 ] | |||||||
|
This approach will not solve the problem given that assert could be overridden as well. Closing as a won't fix | |||||||
| Comment by Mira Carey [ 18/Feb/16 ] | |||||||
|
Interesting. I've played around with the form a few different ways and it looks like there's some combination of a hard limit on the number of array elements: 262,143,998. and an out of memory error on the horizon. The shuffle looks like it'll eventually get there (OOM or too many array elements). It wouldn't be terribly hard to offer a timer that stopped running computation though. Something like:
| |||||||
| Comment by Robert Guo (Inactive) [ 18/Feb/16 ] | |||||||
|
Seems to be neither. The interpreter errors out after a few seconds.
| |||||||
| Comment by Mira Carey [ 18/Feb/16 ] | |||||||
|
Does it actually infinite loop, or does it eventually get OOM killed? If so, you might be able to attach that under |