[CSHARP-2457] ClusterBuilder.RegisterStreamFactory causes infinite recursion Created: 18/Dec/18  Updated: 28/Oct/23  Resolved: 04/Jan/19

Status: Closed
Project: C# Driver
Component/s: Connectivity
Affects Version/s: None
Fix Version/s: 2.7.3

Type: Bug Priority: Minor - P4
Reporter: Alex Skalozub Assignee: Dmitry Lukyanov (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The problem is, _streamFactoryWrapper captures reference to itself, instead of the previous value of _streamFactoryWrapper. 

It can be easily fixed by replacing

_streamFactoryWrapper = inner => wrapper(_streamFactoryWrapper(inner));

with

_streamFactoryWrapper = inner => wrapper(_streamFactoryWrapper(inner));



 Comments   
Comment by Githook User [ 24/Jan/19 ]

Author:

{'username': 'dmitry-lukyanov', 'email': 'dmitry_lukyanov@epam.com', 'name': 'Dmitry Lukyanov'}

Message: CSHARP-2457: Fix of infinity calls of IStreamFactory wrappers.
Branch: v2.7.x
https://github.com/mongodb/mongo-csharp-driver/commit/7b980b0845bd96b185f967cd41582893326c0981

Comment by Githook User [ 04/Jan/19 ]

Author:

{'username': 'dmitry-lukyanov', 'email': 'dmitry_lukyanov@epam.com', 'name': 'Dmitry Lukyanov'}

Message: CSHARP-2457: Fix of infinity calls of IStreamFactory wrappers.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/ee541a0860bacd1a88cfd437307db318fb9635d4

Comment by Dmitry Lukyanov (Inactive) [ 18/Dec/18 ]

Hi Alex Skalozub,

Thank you for the report, we plan to fix it soon.

Comment by Alex Skalozub [ 18/Dec/18 ]

Sorry, posted too early. The replacement should be:

 

var streamFactoryWrapper = _streamFactoryWrapper;
_streamFactoryWrapper = inner => wrapper(streamFactoryWrapper(inner));

 

Generated at Wed Feb 07 21:42:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.