[SERVER-30009] MapReduce failure: missing ) in parenthetical Created: 06/Jul/17 Updated: 30/Oct/23 Resolved: 31/Aug/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | MapReduce |
| Affects Version/s: | 3.2.14, 3.4.6 |
| Fix Version/s: | 3.2.18, 3.4.11, 3.5.13 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Ben Calev | Assignee: | Spencer Jackson |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Operating System: | ALL | ||||||||||||||||
| Backport Requested: |
v3.4, v3.2
|
||||||||||||||||
| Sprint: | Platforms 2017-07-31, Platforms 2017-08-21, Platforms 2017-09-11 | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
Issue Status as of Jul 13, 2017 ISSUE DESCRIPTION AND IMPACT
AFFECTED VERSIONS ISSUE STATUS DIAGNOSIS AND WORKAROUNDS As an example, consider the following mapReduce command, which runs on 3.4.5:
Running the same map-reduce command against 3.4.6 results in:
The error message appears because the mapReduce functions are strings, not functions. Fixing the types of the mapReduce functions resolves the error:
Users should consider using native Javascript objects in their application code if the driver supports them. Original SummaryMapReduce failure with 3.4.6 Original DescriptionWhen performing a mapreduce that works on all previous versions including 3.4.5, we are now receiving the error "missing ) in parenthetical map reduce @15:17". A rollback to 3.4.5 from 3.4.6 was required to resolve this. |
| Comments |
| Comment by Fory Horio [ 30/Nov/17 ] | ||||||||||||||||||||||||||||||||||||||||||
|
We just updated to 3.2.18. We are still getting the same error. 2017-11-30T12:07:42.490-0800 I COMMAND [conn13] mr failed, removing collection :: caused by :: 139 SyntaxError: missing ) in parenthetical @:112:0 | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 21/Nov/17 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Author: {'name': 'Spencer Jackson', 'username': 'spencerjackson', 'email': 'spencer.jackson@mongodb.com'}Message: (cherry picked from commit 8024561b6a73b5b0b56200bdfa3233219ff7fb18) | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 21/Nov/17 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Author: {'name': 'Spencer Jackson', 'username': 'spencerjackson', 'email': 'spencer.jackson@mongodb.com'}Message: (cherry picked from commit 8024561b6a73b5b0b56200bdfa3233219ff7fb18) | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 31/Aug/17 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Author: {'username': 'spencerjackson', 'name': 'Spencer Jackson', 'email': 'spencer.jackson@mongodb.com'}Message: | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Edouard Griffiths [X] [ 21/Jul/17 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Thanks for pointing out the trailing semicolon thing. Indeed the culprit was the finalizer function
Removing the semicolon after the function ending brace solves the problem | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Shane Harvey [ 20/Jul/17 ] | ||||||||||||||||||||||||||||||||||||||||||
|
egriffiths1A - Wrapping the function with a bson.Code object does not work around this issue. Whether a string or bson.Code, the JavaScript code still needs to be a valid function definition according to the server. For example, adding a trailing semi-colon results in the same "SyntaxError: missing ) in parenthetical @:1:45" error:
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Edouard Griffiths [X] [ 20/Jul/17 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Is there any work around when using PyMongo and define the functions inside a Code object from bson.code like: reducer = Code(""" """) then use it as the reducer argument of PyMongo's map_reduce. Same for mapper and finalizer. Thanks and best regards, | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Ramon Fernandez Marina [ 11/Jul/17 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Thanks for the reproducer oleg@evergage.com; we're discussing whether there's something mongod can do in terms of relaxing these constraints or at least provide a more useful error message. Regards, | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleg Rekutin [ 10/Jul/17 ] | ||||||||||||||||||||||||||||||||||||||||||
|
I have confirmed that removing an extra ";" in a failing instance of MapReduce made it work with 3.4.6 again. So I would recommend downgrading the severity of this bug at this point, to perhaps simply major? (Since it can be worked around with simple enough client updates). | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Spencer Jackson [ 10/Jul/17 ] | ||||||||||||||||||||||||||||||||||||||||||
|
The following runs on 3.4.5:
Running it against 3.4.6 results in:
It's complaining because the map/reduce functions are strings, not functions. Admittedly, the error message is not clear. Fixing the types resolves the error.
Take a look at your inputs to map reduce, and ensure they are functions. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleg Rekutin [ 10/Jul/17 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Attached is a reproducible test case written using Java driver 3.3.0 and Maven. It appears to be that the problem is due to the "reduce" function having an extra semicolon after the function() {} definition. When I comment out line Server30009Test.java:32 in the attachment, the test passes with MongoDB 3.4.6. It fails with the semicolon on 3.4.6, but passes with it on 3.4.4. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Ian Springer [ 08/Jul/17 ] | ||||||||||||||||||||||||||||||||||||||||||
|
The only issue I see in the 3.4.6 change log that mentions JavaScript or map-reduce is: https://jira.mongodb.org/browse/SERVER-28323 (Don’t pass JavaScript scopes a function ID number) Could that by any chance be the cause of the regression? | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Ian Springer [ 08/Jul/17 ] | ||||||||||||||||||||||||||||||||||||||||||
|
We are seeing this as well after upgrading to 3.4.6. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Michael O'Keefe [ 07/Jul/17 ] | ||||||||||||||||||||||||||||||||||||||||||
|
We are currently running into the same error on our system. MapReduce tasks which worked on all previous versions, including 3.4.5, are now failing with the same error message:
I'm working on finding a minimal map-reduce command which reproduces this; I'll post it once I have one. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Kelsey Schubert [ 06/Jul/17 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Hi bcalev, Thanks for reporting this issue. Would you please provide the problematic map reduce command, so we can reproduce and investigate the issue? Kind regards, |