[SERVER-74900] ftdc_connection_reuse.js can unsafely attempt to read missing keys from FTDC BSON Created: 15/Mar/23 Updated: 29/Oct/23 Resolved: 12/Apr/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.0.0-rc0, 7.1.0-rc0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | George Wangensteen | Assignee: | Jason Chan |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Service Arch
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Operating System: | ALL | ||||||||
| Backport Requested: |
v7.0
|
||||||||
| Sprint: | Service Arch 2023-04-17 | ||||||||
| Participants: | |||||||||
| Linked BF Score: | 25 | ||||||||
| Description |
|
In it's getDiagnosticData helper, ftdc_connection_reuse.js pulls FTDC twice from the server; once to make sure a specific sub-document (the connPoolStats pool entry for a NITL pool) is present in the returned BSON, and once again to actually fetch the data to provide for the rest of the test to use after it determines that sub-document is present. However, the FTDC document returned by the server can change between the two pulls, if the FTDC loop runs in between them. In the following ordering of events:
The test will attempt to access a key in the BSON that doesn't exist: https://github.com/mongodb/mongo/blob/861164c8a2d50c1b99111f30359c4b5826623fa7/jstests/noPassthrough/ftdc_connection_reuse.js#L37 resulting in it returning "undefined" value that is subsequently attempted to be unsafely read-into later in the test (i.e. here). To fix we should make sure the FTDC that is checked for NITL-pool-presence is the same blob that is returned to the rest of the test. We should also consider ensuring that the dropConnections has been viewed by the FTDC collector before proceeding with the test, to ensure that we don't need to wait for it to update the view an additional time (once to see the dropConnections, and once again to see the new data we expect after doing more work). But this is optional, as the test should keep retrying to pull more data until the expected state is seen. |
| Comments |
| Comment by Githook User [ 13/Apr/23 ] |
|
Author: {'name': 'Jason Chan', 'email': 'jason.chan@mongodb.com', 'username': 'jasonjhchan'}Message: |
| Comment by Githook User [ 12/Apr/23 ] |
|
Author: {'name': 'Jason Chan', 'email': 'jason.chan@mongodb.com', 'username': 'jasonjhchan'}Message: |