[JAVA-3770] CodecConfigurationException when creating an instance of DocumentCodec Created: 22/Jun/20 Updated: 28/Oct/23 Resolved: 09/Jul/20 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Codecs |
| Affects Version/s: | 3.11.2, 3.12.5, 4.0.4 |
| Fix Version/s: | 4.1.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Eugeny Ganchurin | Assignee: | Ross Lawley |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
While looking at flame graphs for my application under the load, I found that my application was spending significant time on filling stack traces though there were no errors in logs. I found that the reason is in that my application is heavily using Document#toJson method. Under the hood, the method creates a new instance of DocumentCodec. And deep inside there is also a call to create a new instance of BsonTypeCodecMap which has the following code:
The thing is in that it can't find a codec for BsonType "ARRAY" and clazz "interface java.util.List", then throws an exception, ignores it, and affects application performance. I think that the simplest way to reproduce the issue is to set a breakpoint on the line with the catch condition and to create a new instance of DocumentCodec. |
| Comments |
| Comment by Githook User [ 09/Jul/20 ] |
|
Author: {'name': 'Ross Lawley', 'email': 'ross.lawley@gmail.com', 'username': 'rozza'}Message: Create DEFAULT_BSON_TYPE_CODEC_MAP for DocumentCodec and BsonDocumentCodec
|
| Comment by Ross Lawley [ 30/Jun/20 ] |
| Comment by Eugeny Ganchurin [ 23/Jun/20 ] |
|
@Ross Lawley, I'm using the default codec registry. Thanks. |
| Comment by Ross Lawley [ 23/Jun/20 ] |
|
HI eugeny.ganchurin@gmail.com, Thanks for the ticket. Can I ask if you are using a custom codec registry or the default codec registry? Ross |