[SERVER-85597] Refactor uses of boost::asio to asio Created: 23/Jan/24  Updated: 06/Feb/24  Resolved: 01/Feb/24

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 8.0.0-rc0

Type: Task Priority: Major - P3
Reporter: James Bronsted Assignee: James Bronsted
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-84610 Define a version for ASIO Closed
Backwards Compatibility: Fully Compatible
Sprint: Service Arch 2024-02-05
Participants:

 Description   

Currently, we vendor two different versions of ASIO: one from the original implementer, and one from boost. Only one use exists in our codebase of the latter, in src/mongo/db/repl/isself.cpp.

Rewrite the calls to boost::asio::detail::socket_ops::inet_ntop as calls to asio::detail::socket_ops::inet_ntop and remove our dependency on boost's ASIO.



 Comments   
Comment by Githook User [ 01/Feb/24 ]

Author:

{'name': 'James Bronsted', 'email': '32047428+jpbronsted@users.noreply.github.com', 'username': 'jpbronsted'}

Message: SERVER-85597 refactor callers of boost::asio to use asio (#18582)

GitOrigin-RevId: 384d5958b09d976e02e21ae3d7dbfffb8a4d4710
Branch: master
https://github.com/mongodb/mongo/commit/4325025a5da12f08de403cda7b53dc76ae7d0895

Comment by James Bronsted [ 31/Jan/24 ]

It appears that we will not be able to remove our dependency on boost's ASIO because boost's logging module internally depends on it. The server successfully compiles after removing boost ASIO when the BOOST_LOG_NO_ASIO preprocessor definition is provided on the commandline. However, this hack is unlikely to be stable. I was unable to locate any publicly available documentation about setting this preprocessor definition and it appears to be something that boost uses internally to disable ASIO for environments in which it is not supported. Not a path we should walk.

As an alternative, I briefly looked into changing our uses of native ASIO in session to use boost ASIO, and that appeared to be nontrivial. To illustrate just one source of difficulty there, our session code defines classes named equivalently to classes defined in boost ASIO (e.g. basic_socket_acceptor), but with different template formats. Making the switch to boost ASIO there would require more than just a handful of clever find-and-replace operations, which I'm judging to be out of scope for this ticket.

I'm still of the opinion that rewriting the calls to boost ASIO in isself.cpp offers some value: if ever decide to move off the boost modules which depend on ASIO, then having already removed any of our direct uses of boost ASIO will make it that much easier to jettison boost ASIO as well.

Generated at Thu Feb 08 06:58:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.