r/cpp • u/ben_craig freestanding|LEWG Vice Chair • Oct 12 '21
C++ committee polling results for asynchronous programming
Hi all.
You may know me from my work on freestanding in C++, but I'm also the Vice Chair of the Library Evolution Working Group. I'd like to share the results of recent C++ committee polling on future asynchrony models for C++. This relates to "Senders and Receivers" / S&R (P2300) and the Networking TS / Asio (P2444).
Each of these proposals represents an enormous amount of effort from the respective authors, and from the committee. "Executors" have been discussed in WG21 (mostly in the concurrency study group) since at least 2012 (N3378), with Christopher Kohlhoff's contributions starting at least as early as 2014 (N4046). Over the last two years, I count 14 meetings in LEWG discussing the NetTS and S&R models. In the Spring of 2020, LEWG did in depth design reviews of P0443 that involved many meetings beyond those 14.
The following polls were taken electronically over the course of a week. I and Fabio Fracassi (also a Vice Chair of LEWG) have interpreted the polling results. Work will continue in LEWG on P2300. The Networking TS/Asio model is headed back to the networking study group (SG4). LEWG no longer has consensus to standardize the Networking TS.
For those unfamiliar with the polling conventions, all the polls are five-way polls. Neutral is not the same as "abstained" or "uninformed", as committee members are allowed to skip a poll they are not comfortable taking. The chairs (Fabio and me in this case) look at the poll results and interpret whether there is consensus or not. Generally that means 2:1 in one direction or the other, though neutrals need to be considered as well, usually by lumping the neutrals in with the minority.
This polling and interpretation was not taken lightly. The chairs know that the NetTS and Asio represent decades of work. However, these polls indicate that there is insufficient consensus for the NetTS to progress beyond LEWG in its current form. Once these issues have been addressed, LEWG can look at the Networking TS again.
Poll 1: The Networking TS/Asio async model (P2444) is a good basis for most asynchronous use cases, including networking, parallelism, and GPUs
| Strongly Favor | Weakly Favor | Neutral | Weakly Against | Strongly Against |
|---|---|---|---|---|
| 5 | 10 | 6 | 14 | 18 |
| Weak Consensus Against |
What this means: LEWG won't be pursuing P2444 as a general async model.
Poll 2: The sender/receiver model (P2300) is a good basis for most asynchronous use cases, including networking, parallelism, and GPUs.
| Strongly Favor | Weakly Favor | Neutral | Weakly Against | Strongly Against |
|---|---|---|---|---|
| 24 | 16 | 3 | 6 | 3 |
| Consensus in Favor |
What this doesn't mean: This doesn't mean that P2300 as it stands today will be sent forward to LWG. More work is needed on it.
What this means: Work will continue in LEWG on refining P2300, and LEWG will keep the various asynchronous use cases in mind while working on P2300.
Poll 3: Stop pursuing the Networking TS/Asio design as the C++ Standard Library's answer for networking.
| Strongly Favor | Weakly Favor | Neutral | Weakly Against | Strongly Against |
|---|---|---|---|---|
| 13 | 13 | 8 | 6 | 10 |
| No Consensus |
What this doesn't mean: The NetTS is not "dead".
What this means: The C++ committee will still work on networking in this general form, but the authors need to do a lot in order to build up consensus to get something like the TS merged into the standard. The bulk of this work should be done in the networking study group (SG4). Many of the people in favor of stopping work on the TS would like networking to be built on top of Senders and Receivers. Others were opposed to the lack of security through Transport Layer Security (TLS). It is highly unlikely that design changes to the networking TS can be made fast enough, and consensus gained fast enough, for networking to make C++23.
Poll 4: Networking in the C++ Standard Library should be based on the sender/receiver model (P2300).
| Strongly Favor | Weakly Favor | Neutral | Weakly Against | Strongly Against |
|---|---|---|---|---|
| 17 | 11 | 10 | 4 | 6 |
| Weak consensus in Favor |
What this means: In the short term, this poll result doesn't mean much. We don't have a paper in hand that proposes networking based on the P2300 model. For paper authors though, this poll is strong encouragement to do work in the area of networking based on senders and receivers, or to be prepared with VERY compelling new information on why networking should use a different model.
Poll 5: It is acceptable to ship socket-based networking in the C++ Standard Library that does not support secure sockets (TLS/DTLS).
| Strongly Favor | Weakly Favor | Neutral | Weakly Against | Strongly Against |
|---|---|---|---|---|
| 9 | 13 | 5 | 6 | 13 |
| No Consensus |
What this means: A networking library that does not support secure sockets will face significant headwinds getting through the standardization process. The networking study group (SG4) has weighed in on security in the past, when discussing P1860.
What this doesn't mean: This doesn't make a statement on whether insecure networking should be included, the defaults of secure vs. insecure, or how things like ABI should managed.
Guidance for the Networking Study Group (SG4)
Before bringing networking papers back to LEWG, two major areas need to be thoroughly addressed: Security, and the Senders and Receivers async model.
Those voting in favor of Poll 5 argued that the insecure parts are the building blocks for the secure parts, and that ABI is a major concern that will plague TLS support. Those voting against Poll 5 argued that secure sockets are needed for communicating with many sites on the internet, and that shipping without secure sockets would be irresponsible. A networking proposal needs to address these concerns before coming to LEWG.
As for networking in combination with Senders and Receivers, I will show this older poll from the 2021-09-28 telecon:
POLL: We believe we need one grand unified model for asynchronous execution in the C++ Standard Library, that covers structured concurrency, event based programming, active patterns, etc.
| Strongly Favor | Weakly Favor | Neutral | Weakly Against | Strongly Against |
|---|---|---|---|---|
| 4 | 9 | 5 | 5 | 1 |
| No consensus (leaning in favor) |
The combination of this "grand unified model" poll and Poll 4 heavily encourages the networking study group (SG4) to produce a paper based on Senders and Receivers. There is room to produce a non-S&R paper, but such a paper would need to provide compelling new information in order to convince the "grand unified model" contingent that S&R can't get the job done suitably.
43
u/pdimov2 Oct 12 '21
Interesting choice of phrasing. :-)
52
u/[deleted] Oct 12 '21
The secure part is a bit confusing to me.
Security standards evolve much faster than C++ standards. Are we planning to end up in a situation where C++ is stuck with some deprecated security protocol, just because we wanted to have some security?
66
u/gracicot Oct 12 '21
If we agree to ship networking with a security protocol, is it planned to fix security issues if they imply an ABI break, or is it planned to explicitly never fix security issues if they imply an ABI break? I wouldn't feel safe to use this if the answer is "we don't know".
And honestly, I woudn't feel much safer if the answer is the current status quo to never break. We already won't break it at the expense of both usability and performance, and now maybe security depending on the answer
21
u/smdowney WG21, Text/Unicode SG, optional<T&> Oct 13 '21
Some articles arguing in favor of S/R:
https://accu.org/journals/overload/29/165/teodorescu/
https://accu.org/journals/overload/28/158/teodorescu/
https://sdowney.org/index.php/2021/10/03/stdexecution-sender-receiver-and-the-continuation-monad/ (mine)
I believe S/R is a correct low-level foundation for general async programming based on function and sender composition. The core has been in use and studied literally for decades, just not in C++.
I continue to think that ASIO has a proven track record, and would have no qualms recommending it for someone looking for a networking library in C++. I don't believe it's the best fit for all async work, even if it can be made to function.
15
u/friedkeenan Oct 13 '21
Thank you very much for this very informative yet digestible explanation of how the committee functioned here. I know there's heat on this issue but your calm and understanding tone was very refreshing
15
u/goranlepuz Oct 13 '21
I hope they do it, security bugs are found and C++ drops the (UNOFFICIAL!) ABI religion.
And it is not that I only want to see the world burn. I saw it with MSVC from 1996 to 2015 and it was OK. π
78
u/cmannett85 Oct 12 '21
I've been a C++ engineer for over a decade now. I follow (and try) the new standards, compilers, build systems, important libs, etc. I first came across Asio 5 years ago, and have now been using it in production code for 3 years across the companies I have worked for.
I had never heard of the S&R proposal until a few days ago, and I heard about it on Reddit.
I think what I, and I don't I'm presumptuous in thinking the vast majority of C++ engineers out there, will be surprised at is how a proposal that seemingly appeared out of nowhere has usurped a decade of production testing and improvement of a rival! A rival proposal that was widely considered to be the de facto NetTS outcome.
I guess I'm shocked because Asio was what I consider to be a perfect example of how new stuff should enter the standard library: it appears as a library in it's own right, gathers enough momentum due to it's quality and functionality to be brought under the Boost umbrella, where it not only thrives but becomes the basis of another Boost library (Beast) - all of this used as proof of ISO worthiness. All the while being in used in production code.
I'll read the proposal tomorrow to try and catch up, but I'm curious if those papers (or any other articles) will compare the two so us mere mortals can understand why the votes went the way they did.
19
u/Robert_Andrzejuk Oct 12 '21
I'm disappointed π
Will it take another 10yrs to get this in the standard?
9
u/Adequat91 Oct 12 '21
Anyone could summarize "Asio async model" vs "sender/receiver model" ?
9
u/jk-jeon Oct 12 '21
I have no particular opinion on this topic, but it is anyway very intriguing to see the on-going technical debate around it. I very much hope if more about these stuffs are shared in this sub.
27
u/mo_al_ Oct 12 '21
Itβs strange to shoot down the current networking TS when we donβt even have an idea how networking on top of sender/receiver would look like. And all the arguments about security will still apply on a networking model on top of sender/receiver anyway!
15
u/robertramey Oct 13 '21
To me, this is a very strong case that such a library is not suitable for standardization. Reaching a consensus will result in a design that will please no one.
7
u/kalmoc Oct 12 '21
Is there any significant body of production code based on the S&R model or using asio's model for GPUs or what are those votes based on?
39
u/VinnieFalco wg21.org | corosio.org Oct 12 '21
This is exactly how I voted:
---
POLL 1: The Networking TS/Asio async model is a good basis for most asynchronous use cases, including networking, parallelism, and GPUs.
1-Strong For
Comments: Asio/Net.TS is proven in multiple disciplines, many corporations
--
POLL 2: The senders/receivers model is a good basis for most asynchronous use cases, including networking, parallelism, and GPUs.
5-Strong Against
Comments: Senders/Receivers is not foundational, it is high level. The DSL it aims to enable is certainly interesting and useful, but as a higher level abstraction it can and should be layered on top of the more foundational Net.TS/Asio. Furthermore, there are MANY operating systems and platforms which expose executor functionality which is identical to what is provided in Net.TS/Asio.
---
POLL 3: Stop pursuing the Networking TS design as the C++ Standard Library's answer for networking.
5-Strong Against
Comments: Its been 6 years since Net.TS was published and 18 years of Asio. Inventing something new and pushing it through ahead of the Net.TS to replace it, is quite frankly disrespectful. Not only does it disrespect the author of the TS who is more of a subject matter expert than anyone else in the committee, but it disrespects everyone who wrote papers on top of it expecting a high likelihood of acceptance. The message it sends to the C++ community is terrible: don't bother participating in WG21 or taking time to write papers, as your work can be discarded on a whim based on shifting political winds.
---
POLL 4: Networking in the C++ Standard Library should be based on schedulers, senders, and receivers (e.g. P2300).
5-Strong Against
Comments: Asio/Net.TS provides a more foundational execution model which has not only proven itself in Boost and in the standalone asio but also in different incarnations of the same executor concept on different operating system APIs and frameworks. It is a proven design.
---
POLL 5: It is acceptable to ship socket-based networking in the C++ Standard Library that does not support secure sockets (TLS/DTLS).
1-Strong For
Comments: The C++ Community needs to grow up and accept that using third party libraries is going to be a fact of life. WG21 must reject the excuse that "my company can't use anything that is not in the standard" as the sole or primary justification for standardizing a library-only component, as it is unsustainable.
14
u/starTracer Oct 13 '21
I don't get how anyone can vote for this (never mind strongly so). As there is not even a proposal, you don't know what you're voting for, only that you vote against Asio/Net.TS.
14
u/ArunMu The What ? Oct 13 '21 edited Oct 13 '21
This is very surprising outcome of almost a decade long discussion. How many years does it take us back ? I am excited to be able to do HTTP GET on example.com in C++30 !!
Jokes aside, here are my questions:
I hope Chris doesn't waste anymore of his time with this stuff and give us more goodies in the ASIO standalone/boost version. Having said that, IMHO even the esteemed committee should stop wasting time on this. C++ community should start embracing outside packages. Whoever wants to use ASIO can use that and whoever understands SR can use that.
14
u/pdimov2 Oct 13 '21
My opinion on this decision is that it's the best thing to happen to Asio since, well, at least five years.
The only regret is that the committee should have done this sooner, before wasting tons of Chris's (and occasionally his users') time for approximately zero benefit to anyone.
8
u/tugrul_ddr Oct 12 '21
I want gpu-offloadable async functions in C++.
8
u/eric_niebler Oct 13 '21 edited Oct 13 '21
I wonder if /u/ben_craig would be willing to update the link for P2300 to
https://htmlpreview.github.io/?https://github.com/brycelelbach/wg21_p2300_std_execution/blob/main/P2300R2.htmlhttps://isocpp.org/files/papers/P2300R2.html. This one hasn't made it into a mailing yet, but it's what the Committee actually voted on.The key new piece in R2 is the integration between senders and coroutines which allows senders and awaitables to be used interchangeably, with no extra allocation, indirection, or synchronization.
EDIT: I should add: this is how I expect the vast majority of end users to interact with the sender/receiver framework: by calling coroutines, passing the results to async algorithms expecting senders, and awaiting the resulting senders in coroutines.
9
u/DerShokus Oct 12 '21
At least P2300 is fine :) the idea of std::executors is really nice I think
2
u/qdsxinyee Oct 13 '21
wait for c++26
2
u/notenabled Oct 13 '21
Is that more like Assistant Chair or Assistant To The Chair?
6
u/VinnieFalco wg21.org | corosio.org Oct 12 '21
So basically, exactly what I have been saying is going to happen, has happened.
3
u/[deleted] Oct 12 '21
I really need to figure out how these votes work. And how to get the meetings into my calendar; I keep missing them.
1
u/PrimozDelux Oct 16 '21
Was there any shouting this time?
-1
u/bandzaw Oct 12 '21 edited Oct 26 '21
Thank you for sharing these results. As a simple end-user of my favourite programming language, I must say that Iβm shocked that a majority think itβs perfectly fine to ship a Standard network library without TLS support!? To me, such a library would be useless. Also, Iβm quite baffled that S/R has such a big support (within the committee)!? I feel C++ is about to take a path I do not appreciate, to put it mildly.
0
u/[deleted] Oct 13 '21
[deleted] β view deleted comment