[SERVER-21935] SpiderMonkey shell takes 20+ minutes to run ~10MB JS test Created: 17/Dec/15 Updated: 06/Dec/22 Resolved: 03/Dec/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | JavaScript, Shell |
| Affects Version/s: | 3.1.7 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Kamran K. | Assignee: | Backlog - Server Tooling and Methods (STM) (Inactive) |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | fuzzer-blacklist, move-stm | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Server Tooling & Methods
|
||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Linked BF Score: | 15 | ||||||||
| Description |
|
The fuzzer created a ~10MB JS test (attached). The 3.0.8 shell takes ~12 seconds to run the test. The 3.2.0 shell takes 20+ mins and causes Evergreen tasks to time out. Both runs used a mongod from master. Some perf output:
|
| Comments |
| Comment by Brooke Miller [ 03/Dec/21 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
STM doesn't have bandwidth to pick this up, so we're closing as won't fix. However, if other teams have capacity and would like to pursue this, please feel free to pick this up. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Mira Carey [ 04/May/18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re-opening to re-investigate | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Eric Milkie [ 23/Jun/17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Closing as Won't Fix, or Gone Away? Does this problem no longer cause Evergreen task timeouts? Is the test simply gone? Did we end up increasing the timeouts? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Eric Milkie [ 27/Jun/16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Is SpiderMonkey throwing a C++ exception to handle the error casee, where V8 is not? Throwing and catching exceptions can really slow things down. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Max Hirschhorn [ 26/Jun/16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This ticket hasn't really gotten any attention and I think it's worth identifying what the underlying issue is. I collected some perf samples and found that js::ReportIsNotFunction() is where we are spending a lot of our time in js::Invoke().
I'm not familiar enough with SpiderMonkey to speak to the expense of that function, but it was easy enough to determine the sheer number of times we are calling it by setting a breakpoint in gdb. The 0.0.64-27692afcd0-ent_d7bdd5d639-qa_dac003fe66-1450372090006-094.js test attached to this ticket attempts to call an insert_doc() function 6000 times (of the ~13500 top-level statements). The identifier insert_doc is either not defined or isn't a function throughout the entire test. Applying the following changes to the test to define insert_doc as a no-op function makes it so that the test finishes in around 4 minutes (down from 20 or so minutes).
Gathering perf samples with the aforementioned changes to the test reveals that we also spend a significant amount of time in ReportIsNullOrUndefined() inside the js::ToObjectSlow() case of js::GetProperty(). I didn't investigate what statements within the tests are causing this to happen, but trying to access properties on null and undefined values seems exactly like what the fuzzer could be doing.
I'm still puzzled by the gap between V8's and SpiderMonkey's performance when running the test. Is it really the case that V8 has simply optimized reporting these error cases? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Kamran K. [ 17/Dec/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||