[JAVA-2228] Document.parse() stucked in a dead loop Created: 16/Jun/16 Updated: 19/Oct/16 Resolved: 23/Jun/16 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | BSON |
| Affects Version/s: | 3.2.2 |
| Fix Version/s: | 3.3.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | liqiaoping | Assignee: | Ross Lawley |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: | |||
| Description |
|
I use mongo java driver in my flume project, and one day the events channel was full and after debug, I found that the thread was blocked in a dead loop. |
| Comments |
| Comment by Ross Lawley [ 23/Jun/16 ] | |||||||||
|
Thanks lqp276 for reporting. A fix has now been merged into master and will be available in the forthcoming 3.3 release. | |||||||||
| Comment by Githook User [ 23/Jun/16 ] | |||||||||
|
Author: {u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}Message: Fix infinite loop when parsing invalid regular expressions
| |||||||||
| Comment by Githook User [ 20/Jun/16 ] | |||||||||
|
Author: {u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}Message: Fix infinite loop when parsing invalid regular expressions. Added EOF check for JsonBuffer to prevent multiple reads at end of file.
| |||||||||
| Comment by liqiaoping [ 17/Jun/16 ] | |||||||||
|
Hi Ross, I agree with you analysis and the bug was triggerd by the malfromed json string. Because in our project simple json will sastify our needs we didn't import a third party json lib. I think it would be better to call it a 'robust issue', ^^ in method "scanRegularExpression" of org.bson.json.JsonScanner: | |||||||||
| Comment by Ross Lawley [ 16/Jun/16 ] | |||||||||
|
Hi lqp276, Thanks for the ticket, it looks to be an escaping issue as well as a Document.parse issue. In the example provided its caused by the value in mark. A simplified failure case is:
However, escaping correctly works as expected:
With the example string I ensured that the quote in the mark string is triple escaped and it works as expected:
| |||||||||
| Comment by liqiaoping [ 16/Jun/16 ] | |||||||||
|
The data should reproduce this bug: after Reading the code I think it's the bug of bson library[version bson-3.2.2.jar], but I think it will better to raise this bug here... it's my first time to add bug, if i missed some important info please note me |