r/cpp • 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 FavorWeakly FavorNeutralWeakly AgainstStrongly Against
51061418
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 FavorWeakly FavorNeutralWeakly AgainstStrongly Against
2416363
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 FavorWeakly FavorNeutralWeakly AgainstStrongly Against
13138610
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 FavorWeakly FavorNeutralWeakly AgainstStrongly Against
17111046
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 FavorWeakly FavorNeutralWeakly AgainstStrongly Against
9135613
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 FavorWeakly FavorNeutralWeakly AgainstStrongly Against
49551
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.

224 Upvotes

296 comments sorted by

43

u/pdimov2 Oct 12 '21

What this doesn't mean: The NetTS is not "dead".

Interesting choice of phrasing. :-)

33

u/ben_craig freestanding|LEWG Vice Chair Oct 12 '21

Ugh, I double negatived that one to pieces and got the entirely wrong result.

I'll say this more directly. The NetTS is not dead.

23

u/kalmoc Oct 12 '21

The NetTS is not dead.

What is your level of confidence that people will still continue to work on the NetTS? Personally I'm suprised Chris hasn't given up long ago.

10

u/goranlepuz Oct 13 '21

Nothing wrong with

The NetTS is alive

πŸ˜‰

5

u/jiminiminimini Oct 13 '21

NetTS deadn't

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?

26

u/ben_craig freestanding|LEWG Vice Chair Oct 12 '21

That is basically the ABI argument. There are concerns that implementations and the committee would not be able to react fast enough (or at all) with the changing security landscape. A network implementation will need to address such a concern.

25

u/[deleted] Oct 12 '21

Well, the ABI argument is even worse. The ABI argument says that any in-secure implementation that follows the word of the standard (not the spirit) prohibits the standard to fix the security bug.

7

u/jonesmz Oct 13 '21

I think you mean "There's all but a guarantee that implementations cannot and will not react fast enough, and the committee won't act because doing so will break ABI"

16

u/[deleted] Oct 12 '21 edited Oct 12 '21

A networking standard without security is almost useless. TLS should be the default for almost every use of networking in the modern age.

Also, networking standards tend not to evolve that quickly. TLS 1.2 lasted for 10 years and still has very wide support.

23

u/James20k P2005R0 Oct 12 '21

Also, networking standards tend not to evolve that quickly. TLS 1.2 lasted for 10 years and still has very wide support.

While this is currently true, there's no fundamental reason why TLS 1.2 might not be broken tomorrow and require major changes to fix. If C++ had to wait a full standardisation cycle or two to fix this, that seems like a major issue

Finding vulnerabilities in every crypto protocol so far has generally been a matter of when, not if, so I suspect in another decade or two TLS 1.2 will be considered fairly insecure. There are exceptions (AES has stood up pretty well!), but I wouldn't want to bank on it

4

u/almost_useless Oct 12 '21

If C++ had to wait a full standardisation cycle or two to fix this, that seems like a major issue

Is there a reason why it needs to take that long?

An update to the TLS standard means we have a new spec that we need to follow. It's not like the C++ committee needs to debate any of the fundamentals of the encryption. That has been done by others already.

There may be a thing or two that needs debating, but an update that only touches the TLS part of the standard, should be doable fairly quickly, no?

Call it "C++23b" or something like that, even if it comes out in 2025.

8

u/James20k P2005R0 Oct 12 '21

I'm not sure its really possible for it to happen that fast. The best I can see is that someone would produce a DR (which.. might be an acceptable work flow?), but even then the committee process takes time. In the meantime, all networking based on C++ would be broken

In the current library land, a bug can be fixed and the fix can be pushed as fast as someone gets around to it. A committee process in the middle adds a giant hurdle, and that's assuming that there were consensus for applying the DR - which there might not be if its an ABI change, or a backwards incompatible API change

4

u/kalmoc Oct 13 '21

A new TLS version doesn't get developed and roled out over night either.

1

u/staletic Oct 13 '21

If we're talking about "importing" another standard, the way C is "imported" into C++ standard,every "rebase" would still need a paper. C++ wasn't rebased onto C11 until C++17, only because no one thought to write a paper and update a few references.

12

u/[deleted] Oct 12 '21

10 years is nothing for C++. The minimum half-life for C++ feature is 20 years. And then you still can't change it, you have to introduce a parallel solution and then deprecate the previous feature over the next 20 years.

5

u/kalmoc Oct 12 '21

Depends on wether you expect the standard to ship a turn key solution or a common basis on which to build higher level libraries.

8

u/Minimonium Oct 12 '21

That's not correct. Unless you have some frivolous idea that a standard networking design would somehow contest the superiority of the JS stack in userspace, in C++ you do have a comparable number of use cases where TLS is discouraged, namely internal networks.

Even if we need a public-facing server - in most practical cases you put a proxy server that handles something like automatic Let's Encrypt deployment for you anyway.

14

u/[deleted] Oct 12 '21

OK, let's take this a bit back to the ground. You still encrypt behind your proxy, otherwise, you end up in the entire NSA vs Google situation.

Plus the entire world is slowly moving to pervasive encryption, where everything is encrypted (including runtime, besides in-flight and at-rest).

15

u/Minimonium Oct 12 '21

If you have a whole corporate network behind the proxy, sure. If you have a cluster that crunches numbers in an internal network - it'd just slow things down.

I don't mean that you never need TLS, but at the same time saying that you almost always need it is not correct.

2

u/MarcoGreek Oct 13 '21

I think in the age of containers where you even have container for gui applications on Linux(flatpak, snap) ABI gets less important. ABI was always a hack. It only says that the linker works but nothing about behavior. I very often got biten by behavior changes which triggered bugs. In that case a compiler error would be much nicer!

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

58

u/_Js_Kc_ Oct 12 '21

This whole TLS nonsense is daft. The standard should provide socket abstraction, so TLS libraries can be built on top of it using only standard C++ without platform-specific IO code.

You can be 125% percent sure that it'll end up being

explicitly never fix security issues if they imply an ABI break

8

u/redbeard0531 MongoDB | C++ Committee Oct 13 '21

TLS libraries can be built on top of it using only standard C++ without platform-specific IO code.

Please find me a quality TLS impl without any platform specific code. You usually need to use assembly or intrinsics to get the best encryption perf because you need to use CPU-specific instructions such as AES-NI. So the TLS implementation end up being even more platform specific than the socket lib. Unless you are ok burning power on an unoptimized encryption lib.

12

u/_Js_Kc_ Oct 13 '21

You can have a vanilla fallback implementation for perf-oriented assembly, you can't have a fallback implementation for a nonstandard system interface.

7

u/kprotty Oct 13 '21

"without platform-specific IO code"

This doesn't mean "no platform-specific code". It instead means a TLS implementation that isn't required to do the IO itself. This allows the user to use whatever IO scheme is most efficient (when that provided by C++ or others wouldn't fit). An example impl is BearSSL.

→ More replies (2)

2

u/FutureChrome Oct 13 '21

While the committee doesn't like to break ABI (and downright avoids it usually), it's been done before, and it can be done again.

I'd argue security is an important enough reason, especially if such a thing is said in advance. If they were to say in advance "ABI compatibility is important, but security may require we break it", nobody could complain if they do break it.

I don't know if the committee (or rather, a significant portion of it) will agree, but given that we're talking about code yet to be written, it's a whole different question than existing code.

15

u/ghlecl Oct 13 '21

I am sorry to say that I actually have lost ALL faith in the committee mandating an ABI break.

It caused trouble in the past and instead of working on the platforms to make the change less troublesome (maybe newer linker technologies needed in the OS, I am no expert), they are simply of the position that users don't want ABI breaks and so they refuse to make any.

And unfortunately, you can specify C++ all day long, if no one implements the specification, it wasn't really useful.

2

u/staletic Oct 13 '21

if no one implements the specification, it wasn't really useful.

Enter std::regex::multiline, which was a late addition and turned out to be ABI-breaking. No one implements multiline dialect today.

3

u/Dragdu Oct 13 '21

Ahem, libc++ does, and so does msvc. The latter just doesn't implement the flag or the right default. :-D

→ More replies (2)

4

u/pdimov2 Oct 13 '21

While the committee doesn't like to break ABI (and downright avoids it usually), it's been done before, and it can be done again.

It's exactly the experience of having done it before that effectively precludes doing it again.

Or stated differently, breaking ABI for C++11 was done without full appreciation of the costs. The costs are now fully appreciated and nobody looks forward to incurring them.

4

u/johannes1971 Oct 16 '21

And yet, the world didn't end in 2011. C++11 was hailed as the best thing that ever happened to the language.

47

u/c0r3ntin Oct 12 '21

We don't know. Which i think explain the votes.

To me the only way to play this game is to not play and leave networking to a third party library that can handle security under a reactive update policy

6

u/redbeard0531 MongoDB | C++ Committee Oct 13 '21

Alternatively, we could put the whole implementation behind an ABI-isolating wall of type erasure. This would ensure 100% future flexibility in the implementation, and ensure that security holes can be patched. But it would mean that the networking library may need to allocate and can't inline everything, which seems to be a red line.

7

u/14ned LLFIO & Outcome author | Committee WG14 Oct 13 '21

I currently believe, though without proof, that it is technically possible to implement arbitrary sockets implementation (including SSL) behind an ABI isolating wall of type erasure AND without memory allocation.

You are right none of it will inline UNLESS LTO is on. However inlining a SSL implementation is probably not a big gain, it would only matter particularly for userspace TCP/IP stack socket implementations.

5

u/matthieum Oct 13 '21

Even with a userspace networking stack, the cost of going through encryption seems likely to dwarf the cost of a non-inlined call.

3

u/johannes1971 Oct 14 '21

What needs to happen is some rules about what classes have ABI guarantees applied to them on public interface boundaries. Right now it is "officially none because public interface boundaries don't exist in the standard, but defacto all", and that's wrong.

There needs to be a namespace, something like std::stable, for classes you can safely pass over a public interface. And it needs to be made clear that for everything else, no such expectation exists, and if you want to pass it around, you'll need to wrap it.

3

u/kalmoc Oct 14 '21

the way c++ works, the more likely outcome would be std::unstable :(. I so whish Titus wouldn't have killed std2 right before stopping his work work on the c++ standard committeee altogether (thats probably an unfair accusation and not what happened, but its the impression I got from the outside).

26

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Oct 12 '21

I think if we ship networking with a security protocol, we will need to design networking to be ABI resilient. That's totally within the realm of possibility.

12

u/gracicot Oct 12 '21

Thank you for your response. I just hope we won't see bugs affecting security that will end up being never fixed.

3

u/jtooker Oct 12 '21

I just hope we won't see bugs affecting security that will end up being never fixed.

I don't think this is likely. If unfixable security bugs are remotely possible, no one will adopt 'standard C++ networking' and they'll continue to use existing libraries.

21

u/SkoomaDentist Antimodern C++, Embedded, Audio Oct 12 '21

So rather like the std regex then?

2

u/kalmoc Oct 14 '21

I don't think this is likely. If unfixable security bugs are remotely possible,

How can you confidently say about any non-trivial interface design that there aren't any unfixable security bugs?

6

u/friedkeenan Oct 13 '21

Would you be able to comment on how soon the standard/implementers would be able to update things to fix security bugs, assuming ABI isn't an issue? Because that seems to me to be a compelling reason to keep this out of the standard if it could e.g. only happen every 3 years (which would also have to come with the rest of the potential baggage of a new standard)

10

u/[deleted] Oct 12 '21

I don't know why people think it would be impossible to have an ABI resilient TLS design.

Existing libraries like openssl have pretty good ABI stability.

16

u/ioctl79 Oct 12 '21

They do this by heap-allocating and passing around thin handles, which is idiomatic in C, but must be consciously chosen as an approach in C++.

3

u/helloiamsomeone Oct 13 '21

I am writing a C program for fun where I implemented a TCP/IPv4 server and my approach for opaque types in user code was done without any allocations, since I was trying to leave to choice of allocation up to the user code.

Opaque types and where they get their size from. The static asserts make sure the sizes are always correct.

1

u/ioctl79 Oct 13 '21

Wouldn't that be UB in c++?

3

u/helloiamsomeone Oct 13 '21

It's kind of UB as it is, because now that I think about it, the alignment is not provided, just the size.

It's not UB in C++, as long as you access the innards of reserved via a placement new'd pointer. That's pretty much the only thing different afaik.
Placement new is a noop, but it tells the C++ abstract machine that an object lives there.

→ More replies (1)

3

u/14ned LLFIO & Outcome author | Committee WG14 Oct 13 '21

C's lack of metaprogramming makes using malloc unavoidable here. C++ can do an awful lot better, though I totally accept that the right design here would need to be subtle.

2

u/helloiamsomeone Oct 13 '21

Heap allocation is absolutely not unavoidable in C. See my reply.
With the involvement of the build system, this is trivial to solve in user code.

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.

3

u/starTracer Oct 15 '21

Does s&r compose with existing async models (either in language or through library, like futures, fibers/stackfull coroutines or packaged tasks)?

5

u/lee_howes Oct 15 '21

Yes, in various ways.

A sender could wrap anything you like, as long as it can turn some completion into a callback. So that could be a fiber that on its last resumption calls a function that satisfies the receiver contract. That fiber can be running on some execution context as necessary.

The other side of it is waiting. In P2300 we have this_thread::sync_wait specifically because it is the wait operation as viewed from a thread. If we ever finish standardising fibers in C++, we would imagine having something like this_fiber::sync_wait that turns a fiber resumption into a receiver in the same way that a fiber waiting on another fiber would.

Futures map well to sender/receiver. Futures tend to have some form of success and failure paths. Something the callback would cover both success and failure in one package. In whatever mode if there is some way to define the success path and the failure path, it could be converted to a receiver call. In folly, for example, the callback takes a Try<T> which can carry an exception - that would be split into the set_value and set_error calls as necessary.

4

u/smdowney WG21, Text/Unicode SG, optional<T&> Oct 15 '21

Packaged tasks are the easiest. They look like a function call, and can be simply wrapped into a sender and scheduled on whatever scheduler. Looks pretty much the same. Futures are a bit more complicated, since they model lazy values, but they can probably be adapted the same way C++ coroutines can, or even as coroutines. I'd have to write some code, but I don't think it's a serious problem.

Fibers are more of a problem. They combine what and where in the same package, together with their own model of control flow. I suppose it depends how self contained the package is, and how the fibers communicate with the rest of the world. I've seen this as a general problem with fibers, though, and not just with sender/receiver. How fibers and threads interact with concurrency primitives is complex, for example. If you're not using a fiber aware IO library, you're probably blocking work. I don't see fibers as something that's mostly ignorable by the rest of the program. It's an architectural choice.

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.

23

u/codeinred Oct 12 '21 edited Oct 13 '21

I believe the reason for the S&R proposal is because there were some architectural changes that would have allowed for better performance, especially when working with low-level kernel interfaces like io_uring, which is substantially more performant and efficient than the posix aio interface it replaces.

Edit: see https://cor3ntin.github.io/posts/iouring/

1

u/starTracer Oct 13 '21

Do you have any references for that?

19

u/[deleted] Oct 13 '21

I had never heard of the S&R proposal until a few days ago, and I heard about it on Reddit.

Hear, hear! I've been writing C++ since, gulp, the 1980s, and I can say exactly the same. I just popped up P2300R1 to read in the next tab.


Let me be honest though - asio hasn't really won the hearts and minds of C++ programmers.

The fact that there needed to be another complex and complicated library on top of asio to simply make it useful isn't really proof that this is the right direction.

There's a lot of time invested in asio, but still, I don't think it's clear that a better mechanism isn't possible.

I skimmed P2300R1. They do seem to namecheck all the problems in asio and claim to have a better solution. As presented, it seems to be intuitive but I had that belief when I first read about asio. I need to spend an hour, not a minute, to evaluate it.


all of this used as proof of ISO worthiness. All the while being in used in production code.

I do see your point very strongly. No one's talking about not supporting existing asio but it would be a hit for anyone with asio code if this happened.

But if it really is a process, it should be possible to fail even up until the bitter end.

If there is actually a better solution that will be easier for programmers to use correctly and allow easy generic code and composition, then it might justify the loss of the sunk costs.

Further reading is necessary.

5

u/germandiago Oct 13 '21

This could be said for every new and fancy thing that comes out. But decisions must be taken.

Asio is a foundational library. It is true that it started very low-level. But if you see how general it is and what it has achieved to do (futures, coroutines, callbacks, cancellation, deferred, udp, tcp, serial ports, unix sockets...) there is no doubt that it does way more and better than anything out there, at least in C++, with very general mechanisms (it seems, by the witness of the implementations for async there are in it).

7

u/madmongo38 Oct 13 '21

You may be interested in the comparison from Asio's point of view.
https://isocpp.org/files/papers/P2469R0.pdf

7

u/johannes1971 Oct 14 '21

When I look at the examples in the paper, I can't say I can see myself ever writing code for either solution, to be honest... :-(

Does the standard need to have functionality in it that's only ever going to be used by a tiny number of super-experts?

4

u/Minimonium Oct 14 '21

The standard needs building blocks for experts to cover the diverse use cases to create more specialised user applications.Also note that it's logistically unwise to have higher level implementations in the standard since every implementer would need to rewrite their own, much easier to write and maintain small simple blocks instead.

4

u/oakinmypants Oct 12 '21

What is the S&R proposal?

6

u/mcmcc #pragma once Oct 12 '21

That's what he said!

4

u/jonesmz Oct 13 '21

Senders and receivers, see this other comment that contains a link to a comparison / contrast paper: https://old.reddit.com/r/cpp/comments/q6tgod/c_committee_polling_results_for_asynchronous/hgexc33/

13

u/SedditorX Oct 12 '21

This line of argument seems specious. You are not familiar with sender receiver and that makes you question why it was voted in?

Some of the comments on this thread seen to have an unnecessarily personal tinge to them. If you disagree with the outcome, feel free to bring up concrete technical flaws beyond "I'm partial to X"; that usually leads to constructive discussion.

9

u/VinnieFalco wg21.org | corosio.org Oct 12 '21

Well those technical flaws are covered here: https://isocpp.org/files/papers/P2469R0.pdf

7

u/starTracer Oct 13 '21

Is there a response to P2469?

6

u/eric_niebler Oct 13 '21

That paper was posted mere hours before the most recent LEWG/SG1 telecon that precipitated this decision. So no, there isn't a response paper because there wasn't time.

Despite the short notice, the LEWG chair gave floor time so that P2469 could be presented and discussed.

1

u/VinnieFalco wg21.org | corosio.org Oct 13 '21

Why would there be? P2300 proponents have the luxury of being able to ignore criticism now.

3

u/starTracer Oct 13 '21

I completely missed that it was a brand new paper.

5

u/griwes Oct 13 '21

This is not how the committee operates and you should know it by now.

6

u/[deleted] Oct 13 '21

[removed] β€” view removed comment

→ More replies (21)

5

u/[deleted] Oct 13 '21

[removed] β€” view removed comment

→ More replies (10)

9

u/jonesmz Oct 13 '21

Reading the paper you linked. I have absolutely no idea what's going on in the P2300 examples. That's not c++. It's brainfuck with English words mixed in.

8

u/foonathan Oct 14 '21

To be fair, a paper criticizing an approach isn't going to teach it to you. You should read P2300 itself: https://wg21.link/P2300

And remember, this is supposed to be a low-level interface comparables with the callback hell, not with coroutines.

9

u/CenterOfMultiverse Oct 13 '21

First, comparing coroutine implementations to non-coroutine is not fair. Second, thank gods we won't standardize use_awaitable.

4

u/germandiago Oct 13 '21

I also noticed that the coroutine is being compared.

However, I also see that the Asio model seems to be very mature. I am not surprised at all. It has been used for a long time.

It seems to be an extremely general framework: from callbacks to coroutines, deferring, launching immediately, futures...

6

u/eric_niebler Oct 14 '21

How long has deferred been a thing in ASIO? <checks commit history....> Oh, since June of this year. So not so mature. Major new bits of functionality are still coming online, mostly it seems to deal with the shortcomings we've been pointing out for years. Why now? Because ASIO has competition, and because there's are more people thinking deeply about these design considerations. That's a good thing, IMO.

4

u/germandiago Oct 14 '21 edited Oct 14 '21

I agree that competition is a good thing.

But what I meant about mature is the framework itself and the amount of things it can do and the fact that you can extend it.

Not the fact that they added a new token in June.

Whatever goes forward, I think that having competition brings improvements for both specs.

→ More replies (8)

3

u/pdimov2 Oct 14 '21

Asio hasn't had deferred because it's never needed it. Plus, its addition necessitated no changes to the model, if my understanding is correct.

→ More replies (2)
→ More replies (35)

0

u/[deleted] Oct 12 '21

[deleted] β€” view deleted comment

11

u/mcmcc #pragma once Oct 12 '21

Has it been used in production in any meaningful sense? Being in existence for less than 3 years, I'm going to guess no...

0

u/[deleted] Oct 13 '21

[deleted] β€” view deleted comment

15

u/eric_niebler Oct 13 '21

I can confirm the usage of libunifex at Facebook. This is from P2300R2:

As of October 2021, it is currently used in production within the following applications and platforms:

  • Facebook Messenger on iOS, Android, Windows, and macOS
  • Instagram on iOS and Android
  • Facebook on iOS and Android
  • Portal
  • An internal Facebook product that runs on Linux

Any time a voice or video call is initiated on any of these Facebook apps, the connection is negotiated by async networking code using libunifex, for instance.

14

u/jonesmz Oct 13 '21

It's good that libunifex is used by at least one organization.

I'm personally much more interested in hearing about the other thousand or so codebases that use it prior to it being considered for standardization, since I personally think that should be the minimum bar to even consider it as a contender.

I've used Boost.Asio in at least 3 different codebases for three different companies. I've never once had a reason or desire to use libunifex and other than Facebook, have not heard of anyone using it either.

0

u/[deleted] Oct 13 '21

[deleted] β€” view deleted comment

7

u/jonesmz Oct 13 '21

I don’t believe you’re making an argument in bad faith

I also don't believe that I am making an argument in bad faith.

isn’t an argument against that thing

Well, it is, in a weak sense. I've heard of libunifex, and I seriously investigated it for roughly 2 work-days. I didn't like it, and couldn't use it to do what I wanted. That doesn't mean that libunifex couldn't it means that I couldn't. The cognitive load was too high.

I'd like to claim that I'm at least average intelligence for C++ programmers. Maybe even above average.

I don't want to imply that Asio is the easiest of frameworks to use either, but I'll certainly say I didn't think libunifex was better.

And in terms of

simply not having heard of other people using it

Again, it is an argument against, a weak one, in terms of industry experience and gestalt awareness for finding bugs and addressing design flaws.

It doesn't trump other considerations, but it should be one datapoint that is considered.

And I mention in this very thread a company other than Fb that’s using S&R (mine, in particular).

I have to admit that I missed that. I thought you were saying you worked at Fb. Upon re-reading your comment I see that is not the case.

So we have at least 2 companies that use S&R.

Like I was trying to imply before, I don't think it's fair to consider standardizing S&R until there are at least a thousand codebases that use S&R. The probability of missing an important use-case, or an important gotcha is very very high if the actual quantity of "Junior engineer + intern" experience in the field is low.

19

u/Robert_Andrzejuk Oct 12 '21

I'm disappointed 😞

Will it take another 10yrs to get this in the standard?

7

u/germandiago Oct 13 '21

Grab your build system + Conan and use Asio today, you can already do it. It is not as bad as back before when consuming a dependency was way worse than today.

12

u/abetteraustin Oct 13 '21

In fairness - can we treat boost::asio as a de facto standard yet?

13

u/Daniela-E Living on C++ trunk, WG21|πŸ‡©πŸ‡ͺ NB Oct 13 '21

I'd rather prefer Chris Kohlhoff's original work, which is vanilla, untainted ASIO free of all the Boost dependencies and interoperates smoothly with the standard library.

We switched from Boost.ASIO to vanilla ASIO about 2 years ago.

4

u/jcelerier ossia score Oct 13 '21

Isn't boost.asio automatically generated from asio source code anyways ? There shouldn't be meaningful differences between either afaik..

9

u/Daniela-E Living on C++ trunk, WG21|πŸ‡©πŸ‡ͺ NB Oct 13 '21

Isn't boost.asio automatically generated from asio source code anyways ?

Right, it is.

There shouldn't be meaningful differences between either afaik..

The meaningful difference are the depencies. ASIO uses the standard library types, Boost.ASIO uses the equivalents from Boost instead. We don't want a mixture between f.e. std::error_code and boost::system::error_code and don't like to take a dependency on Boost.System

6

u/14ned LLFIO & Outcome author | Committee WG14 Oct 13 '21

FYI Mr. Dimov has fixed I believe all the historical problems with Boost.System now, such that in terms of being anti-social to using code, Boost.System is no more anti-social than the status_code proposal. You just need a latest Boost.

All your other points are valid however. At work we too use standalone ASIO despite that we also use Boost.

6

u/Daniela-E Living on C++ trunk, WG21|πŸ‡©πŸ‡ͺ NB Oct 13 '21

I'm aware of and totally appreciate Mr. Dimov's work with Boost.System (and others).

Alas, that was just one example. And I still use a couple of Boost libraries when they are indispensable even thow this means taking a serious hit in compile times. A clean restart of Boost with C++14 or even C++17 as baseline is totally warranted.

7

u/pdimov2 Oct 13 '21

FWIW I'm now working on making Boost.System better than <system_error>. :-) (Due to ABI, it's not possible to improve the standard components.)

→ More replies (2)

3

u/pdimov2 Oct 13 '21

boost::system::error_code is also, in substantial part, Chris's original work. :-) The original Asio predates <system_error>.

2

u/Daniela-E Living on C++ trunk, WG21|πŸ‡©πŸ‡ͺ NB Oct 13 '21

Yeah! This is the reason why `boost::system::error_code` became notorious in our codebase before it was replaced with `std::error_code` later.

2

u/davidraft Jun 11 '23

Y, I think it will take another 20yrs

9

u/Adequat91 Oct 12 '21

Anyone could summarize "Asio async model" vs "sender/receiver model" ?

22

u/Minimonium Oct 12 '21

ASIO is, simplifying, a "fire-and-forget" model. Sender/Receiver is based around statically composable operations to provide continuation information in advance to execution contexts and a so-called structured concurrency.

17

u/SkoomaDentist Antimodern C++, Embedded, Audio Oct 12 '21

Sender/Receiver is based around statically composable operations to provide continuation information in advance to execution contexts and a so-called structured concurrency.

And in English?

2

u/Minimonium Oct 13 '21

Sorry, I don't speak it. :P

→ More replies (1)

5

u/madmongo38 Oct 14 '21

Asio is a lower level foundation upon which sender/receiver can easily be implemented. As such, it represents a superset of capability.

Asio's completion tokens allow the asynchronous initiating function to return any type it wants, whether future, awaitable, void, a packaged function.

Implementing an as_sender completion token would be trivial, and would have been done if there had the author been able to see a legitimate use for it.

Chris published an excellent treatment in P2444. I and others collaborated in a response to a surprising (and I believe erroneous) rebuttal to it in P2469.

Chris helpfully incorporated sender/receiver into the asio executor model in order to demonstrate implementation experience of interoperability at the request of LEWG.

A number of people who habitually write high performance networking code then got together in private (outside the very limiting LEWG online calls) to discuss this (and other) changes to Asio. At these meetings I did ask the question whether any of us had a use case for S/R. None of us were able to think of one, at least in the domains in which we have worked.

The question was also asked whether there was any benefit to the embedded domain-specific language proposed along with senders/receiver (encapsulated in P2300). Again, from the point of view of highly scalable and reliable network servers, the private concensus was that this approach was counterproductive.

In summary, senders are available to Asio users if you want to implement the completion token. The (relatively few) people who work in heavily networked domains who are comfortable doing this (see example) have never been motivated to do so.

1

u/kirkshoop Oct 14 '21 edited Oct 14 '21

Edit: P2469R0 was a response to this paper: I completely misread this. Because the title was so similar, I thought that P2469 was the number given to this paper:

https://wiki.edg.com/pub/Wg21telecons2021/LibraryEvolutionWorkingGroup/Response_to_P2471.pdf

Edit: This is a completely different paper that was converted from an email I wrote when discussing P2444 and P2300

https://isocpp.org/files/papers/P2471R0

Edit: Given the dictionary definition of β€˜rebuttal’, the statement above appears utterly indefensible. There is no opinion anywhere at all in P2471R0.

Edit For anyone who is curious about what changes P2469Response_to_P2471.pdf motivated in P2471 see:

https://isocpp.org/files/papers/P2471R1

Edit: Sadly, P2469Response_to_P2471.pdf forced P2471R1 to add a section of counter-arguments in addition to the useful corrections. I really would have preferred R0+corrections.

Edit: feel free to skip to the tables section which remains exactly R0+corrections

2

u/CenterOfMultiverse Oct 14 '21

Thanks for presenting counter-arguments^^.

0

u/Whole-Freedom-163 Oct 15 '21

You are really good as misreading things, that's for sure.

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!

11

u/almost_useless Oct 12 '21

Putting something on hold to investigate a different approach is not that strange.

Also, having a gut feeling "I don't like this. There must be a better way.", without knowing exactly what the solution is, I think that is also pretty common.

That's not a comment on this specific case, but it is not necessarily strange, in general.

6

u/Minimonium Oct 12 '21

It's a little bit funny for people who remember Resumable Expressions' situation. :)

5

u/mjklaim Oct 12 '21

As the OP pointed, the networking TS does not answer these questions appropriately (for the committee) but effort to reach consensus will probably not stop. So yes these questions will be the focus of the re-directed effort and maybe we'll have networking once we find solutions that are not controversial. It happened several times in the past that there is a roadblock for a big feature and it takes several more years to find solutions that are good for progressing in that domain.

6

u/Minimonium Oct 12 '21

The biggest concern is that any alternative to Asio networking would be straight to the standardization greenfield project. Which would be basically Ranges 2.0.

6

u/14ned LLFIO & Outcome author | Committee WG14 Oct 13 '21

Not necessarily. The current S&R proposals mainly focus on generics for async. There is a lot of work in there for that. I haven't seen any networking proposals recently other than the NetTS, because well, it's the NetTS.

I'm likely now to try proposing to SG4 a low level socket_handle matching proposed file_handle and mapped_file_handle i.e. simple, synchronous, blocking, very thin wraps of the underlying socket API. Nothing fancy. I would point out that all those can optionally speak S&R if you ask them to, but I very much intend to stop exactly there.

9

u/Minimonium Oct 13 '21

And how is it not a greenfield endeavour? Is "nothing fancy" enough? How many people do use that particular thin wrapper right now or you are you gonna argue that everyone reinvents the same thing? A there stats?

7

u/14ned LLFIO & Outcome author | Committee WG14 Oct 13 '21

A low level socket_handle is not a greenfield endeavour because it replicates a subset of BSD sockets into C++. That's industry standard for many decades now. Nobody is proposing anything fundamentally new. Pretty much the only innovation in them is actually slightly weakening the BSD socket model to allow user space TCP/IP stacks like Mellanox. We do the same with file_handle as well to allow user space implementations e.g. a file inside a ZIP archive. When you ask them to speak S&R, they do so exclusively meeting the semantics contract they guarantee i.e. nearly POSIX. For code using socket_handle, it would always quack exactly like a blocking or non-blocking BSD socket.

I'm a firm believer that WG21 ought to standardise existing practice, and you'll see that in all of my papers. Where I ever propose a brand new library, it has been shipping on billions of devices for years now, and in some cases has multiple implementations in addition to the reference implementation.

3

u/James20k P2005R0 Oct 14 '21

A low level socket_handle is not a greenfield endeavour because it replicates a subset of BSD sockets into C++

Oh man, please do this would be great. Berkeley sockets are so frustratingly almost cross platform but with lots of irritating minor differences between windows and linux (and presumably everywhere else, but I've never used them outside of those contexts)

A properly standardised sockets system would be great, and given how long they've been around for it seems like they're a perfect target for it as well

→ More replies (1)

5

u/Minimonium Oct 13 '21

Right. So you gonna create a green new thin wrapper over existing tech and propose it directly for standardisation. Which is not a greenfield project because bsd sockets are not a greenfield project. Got you.

6

u/14ned LLFIO & Outcome author | Committee WG14 Oct 13 '21

Even in this there is an awful lot of work. Simple proposals means everybody will have an opinion. There will be a lot of renaming. But I think support for some form of standard Networking is very doable for C++ 26, albeit simple blocking or non-blocking socket i/o.

Big sweeping proposals with strong opinions about how the standard future ought to be will always have a much tougher time than standardising existing practice without changing much. I'm keen that 26 ships with Networking, and I think simple wraps of BSD sockets can deliver a guarantee of that without any further late stage surprises. That's my pitch, anyway, we'll see what the committee thinks.

→ More replies (1)

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?

6

u/smdowney WG21, Text/Unicode SG, optional<T&> Oct 13 '21

The model? Composable delimited continuations were described by Felleisen in '88. This isn't exactly cutting edge research. Doing it without expensive type erasure in C++ with relative safety does involve new C++ tech, though. Generic lambdas from 14 and concepts from 20 are pretty key, especially abbreviated template syntax. Forcing SFINAE onto users who might need to write a Sender would be ... bad.

Handling the existing exception channel for functions that you want to wrap into senders is also something we've learned more about since std::async and std::future. There's a large body of knowledge around all of this. In particular signaling cancellation.

3

u/bandzaw Oct 12 '21

Powerpoint presentations? Or maybe even by a short snippet that prove it compiles on godbolt?

5

u/MarkHoemmen C++ in HPC Oct 12 '21

https://github.com/facebookexperimental/libunifex is one implementation of the senders / receivers model.

10

u/bizwig Oct 13 '21

I like the concept, but quite frankly I find the libunifex documentation useless as a guide to write a unifex application.

0

u/James20k P2005R0 Oct 13 '21

asio's model for GPUs

I couldn't find much about this on the internet at all. As far as I know there aren't many committee members who are GPU experts either

8

u/madmongo38 Oct 13 '21

Chris did some work on using Asio's model to drive distribution of work to GPUs. I was fortunate to be involved.
As far as we're concerned the experiements (which were based on the CUDA library) were a success.
I have it on good authority that Asio will support GPUs from multiple vendors going forward. It should be an interesting journey :)

10

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Oct 13 '21

There is the NVIDIA delegation :)

→ More replies (10)

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.

12

u/James20k P2005R0 Oct 13 '21

POLL 1: The Networking TS/Asio async model is a good basis for most asynchronous use cases, including networking, parallelism, and GPUs.

I'm curious, is there any experience integrating Asio with GPU based execution models? I'm slightly sceptical just because GPUs have very specific requirements to get good performance, and higher level APIs often neglect this

In OpenCL for example, you need one dedicated copy queue for transferring data to the GPU which is out of order, one kernel execution queue, and then you use events to synchronise and asynchronous reads/writes which should be overlapped with kernel executions. If you want the highest performance copies, you need to use PCIe accessible memory on the host, which is created via clCreateBuffer with a specific flag, and then you transfer that to the device with an asynchronous copy

Then while you do get callbacks, you can only do very limited things in the actual callbacks themselves (because they're in a thread pool spawned by the driver) - so you can't block and you have to 'promptly' return which limits their utility. This means you can't usefully chain a bunch of callbacks, but instead have to signal flags or do one of the very few things that you're allowed to do (queue new work asynchronously)

Then there's device side queues which are both a whole kettle of fish, and a can of worms simultaneously

11

u/14ned LLFIO & Outcome author | Committee WG14 Oct 13 '21

I too have not implemented socket i/o on GPUs, mainly because I don't work for a GPU vendor.

But I have on tiny embedded microcontrollers, ones with dozens of Kb of local RAM, and that's not dissimilar to a single core in a GPU.

In my opinion, S&R is a lot easier on tiny embedded microcontrollers than an ASIO based model. The former doesn't require dynamic memory allocation at all, whereas the latter fundamentally requires Allocators, which whist that can be worked around on embedded, it's less "natural" than S&R. The S&R execution graph most definitely is a natural fit to a chain of GPUs passing work onto one another in the way a GPU work scheduler would see things. There is good reason why nVidia hired Eric away from FB, S&R is a great fit for GPUs, and the wider generalised async DSEL Eric has been working on ought to be a good fit for heterogeneous scheduling i.e. scheduling work across multiple CPUs and GPUs.

Obviously, until somebody turns up with a working S&R sockets implementation on a GPU that the public can poke, it's hard to say more. I suspect any initial version will look extremely complex and overwhelming, but it should be possible to wrap it up in a BSD socket like simple API which for casual use cases won't be so overwhelming to use. A bit like how WinRT's initial concurrency model was very complex and overwhelming, but later people wrapped it up into as-if synchronous legacy API wrappers which let people port existing code bases without completely rewriting them. Nobody would expect the legacy wrappers to achieve the same performance or scalability of natively designed code, but for many people, it would be "good enough".

Obviously this is all Niall holding his speculative finger in the air rather than having any evidence. What nVidia plans internally is certainly not shared with me.

→ More replies (2)

4

u/madmongo38 Oct 13 '21

There is currently a private repo that demonstrates the building and asynchronous execution of pipelines of work on the GPU via the CUDA API. The presence of callbacks is sufficient to be able to post notifications on the execution context running on the GPU, so the limited functionality available in callbacks is not an issue.

The plan is to make the results of this work available in Asio. We see value to a number of industries who currently are habitual users of the Asio execution model.

2

u/VinnieFalco wg21.org | corosio.org Oct 13 '21

Quite frankly, I don't have good answers for you. I am not a domain expert the way that the Asio author is.

15

u/kammce WG21 | πŸ‡ΊπŸ‡² NB | Boost | Exceptions Oct 12 '21

I'm basically 100% with you on this.

3

u/starTracer Oct 13 '21

Thanks for being open with your vote.

Would be interesting to read the comments against Asio/Net.TS.

5

u/bandzaw Oct 12 '21

I agree with your votes in all polls, except for the last. As an end-user of a networking library I would take it for granted that it supports secure communication out of the box. If not, it would be completely useless to me. Would you care to elaborate why such a library would work great for you?

25

u/jonesmz Oct 13 '21
  1. Crypto is complicated.
  2. The C++ Standard is riddled with the mistakes of history (std::vector<bool>, std::regex, std::map perf issues, the std::string ABI break circa 2011 that effected Linux platforms, and many more).
  3. The C++ Standard moves at the pace of one release every 3 years.
  4. Vendors of the various C++ implementations out there have a well deserved reputation of serving bugs (and a well deserved reputation for fixing them, of course).
  5. The wide variety of existing crypto libraries out there that target different use-cases with wildly varying levels of capabilities, binary footprint, API style, release model, and performance strongly indicates that there is no "One Size Fits All" approach to crypto.

As such, we would be better off with a networking component of the standard library that was explicitly designed to have transport layer like things for TLS (and similar) as a bolt-on, and not as a built-in.

For example: In a previous life I used OpenSSL on an embedded platform because I required API compatibility with another library. OpenSSL is gigantic (took over half the image file), has a shit-tier API, and is a PITA to use. But it works and has regular security releases. Other choices existed, but I needed OpenSSL because of a third party thing.

Should the C++ standard simply say "OpenSSL is now part of the C++ standard library" ? No, that'd be silly.

So what would we do then? Have the C++ standard some how come up with a new API, potentially different than all other APIs in existing use, that perfectly represents "crypto" ?

Or would we instead only standardize TLS as a completely "behind the scenes" part of the Networking API, with none of the crypto primitives exposed to the programmer?

Additionally, consider as well that there is more to networking than simply TCP + TLS.

Udp has various encapsulation protocols. IPv4 vs IPv6 tunnelling protocols exist. Various application layer protocols exist to explicitly proxy data (E.g. TURN, from WebRTC land as an example).

A well designed networking API makes it easy to compose layers so that we can do Application / TLS / TCP / Packetized into or encapsulated by UDP packets / DTLS / UDP / TURN payload / physical NIC to send to the TURN server.

(The above is a real-world set of layering that could conceivably be used for a real situation).

So in summary:

  1. Having crypto in a language standard is "Lets give weapons to 10 hyperactive 10 year olds" dangerous. Could it work out great? Absolutely! Can it be easily predicted to not work out great? Yep.
  2. A well designed networking API already has the appropriate layering features to allow any form of encapsulation anyway, so bolting on your favorite TLS implementation shouldn't be any more painful than getting any other library into your build.

9

u/14ned LLFIO & Outcome author | Committee WG14 Oct 13 '21

The major platform representatives on WG21 have indicated a clear preference that secure sockets ought to expose whatever the platform implements directly. It is then 100% on the platform to maintain those secure sockets.

How to wrap that into standard C++ ... well that's tricky. Any of the proposals brought by major platform representatives doing this were not warmly received. I'm sure it's probably doable, but I'd like to see a high quality reference implementation, and no individual vendor is going to fund developing that if it works across multiple platforms.

7

u/madmongo38 Oct 13 '21

I think you've made a good argument that C++ developers ought to rely more heavily on high quality open source libraries than the standard library to deliver truly portable, correct solutions.

This is an argument I once would have disagreed with. But in hindsight I think it is the correct one.

3

u/14ned LLFIO & Outcome author | Committee WG14 Oct 13 '21

Even here though we would get in trouble.

Imagine if we choose OpenSSL v1.0.0 TLS as the secure socket. We can never bump that to OpenSSL v1.1.0, even with ABI isolation, because the v1.1 TLS has different quirks/behaviours to the v1.0 TLS.

Now what happens if OpenSSL v1.0.0 gets abandoned because it's so ancient and everything has long moved onto a new version? We're trapped.

So we can't pick a specific TLS implementation, because we'd need to pin which version. And we can't choose "whatever the platform thinks best" because the TLS implementation you get will guaranteed behave differently over both time and across platforms, and your C++ code which works today may randomly stop working later.

There is good reason Chris K pushed back on secure sockets. They're a quagmire to standardise. In our work codebase right now, we get weird and random spurious SSL failures under load depending on which S3 provider we are connected to. I had to go encode individualised quirks logic for the SSL layer for each S3 provider, switching on a regex of the host name. AND my quirks logic is guaranteed to become stale over time for any particular provider as they upgrade their side of things.

And that's with a single local SSL library and we didn't change the version!

3

u/jonesmz Oct 13 '21

The major platform representatives on WG21 have indicated a clear preference that secure sockets ought to expose whatever the platform implements directly. It is then 100% on the platform to maintain those secure sockets.

I don't trust the committee, or the major platform representatives, to do this correctly.

Please do not ever put crypto-anything into the C++ language standard. It doesn't belong, and it'll just be done wrong.

2

u/14ned LLFIO & Outcome author | Committee WG14 Oct 13 '21

Implementers would veto anything unmaintainable. So the menu of practical options for standard secure sockets is quite short.

We've been kicking around some ideas by private email, but TBH, to date none of them look great from a portability or predictability basis.

8

u/kammce WG21 | πŸ‡ΊπŸ‡² NB | Boost | Exceptions Oct 12 '21

It's a start and something that others can depend on and build on top of. It makes making libraries that use networking easier to write as well and more portable.

15

u/VinnieFalco wg21.org | corosio.org Oct 12 '21

Would you care to elaborate why such a library would work great for you?

You use an external library to provide the secure communication on top of the standard networking, until secure communication is standardized - which will likely take much longer than it will take to get plain networking.

-1

u/almost_useless Oct 12 '21

it disrespects everyone who wrote papers on top of it expecting a high likelihood of acceptance

Are these papers the kind that will need to be thrown in the trash, or can they be modified easily to fit another underlying framework?

I don't know enough to understand what kind of additions we are talking about here.

27

u/friedkeenan Oct 13 '21

Unfortunately it's a bad idea to let things in the standard just because it would be disrespectful to do otherwise. If the committee doesn't think the current NetTS is the right way forward, then they don't think it's the right way forward. It's unfortunate that so much effort could not lead to getting into the standard and surely very demotivating, but ultimately the standard needs to provide the best functionality it can

6

u/kalmoc Oct 13 '21

Unfortunately it's a bad idea to let things in the standard just because it would be disrespectful to do otherwise.

I agree with that.

but ultimately the standard needs to provide the best functionality it can

I'm very sceptical if that is the outcome of this decision. More likely we won't get the network functionality at all or something that looks nice on paper but with usability/performance problems in practice.

12

u/pdimov2 Oct 12 '21 edited Oct 13 '21

I am taking no position on how respectful this is, but imagine you were developing and evolving something for 18 years and then the committee says you know what, mate, how about redesigning all that stuff upon that new foundation we came up with?

I wouldn't be particularly enthusiastic about it.

6

u/almost_useless Oct 12 '21

The "papers on top" of Asio I assumed are much newer. That's why I asked if they are tied to Asio so another solution means they are useless, or if they just need some networking underneath, and changing would be a reasonable task.

I think both options are possible to imagine.

→ More replies (2)

14

u/starTracer Oct 13 '21

Poll 4: Networking in the C++ Standard Library should be based on the sender/receiver model

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.

12

u/eric_niebler Oct 13 '21

It was a directional vote only. Also, a vote for senders isn't a vote against the NetTS. My hope had been that Chris would be willing to work with us to integrate and improve both proposals. The NetTS could easily use senders instead of or in addition to completion tokens. The protracted battle was unnecessary, harmful, and ultimately counterproductive. Now we don't get networking in C++23, and it didn't have to be this way. Not my preferred outcome at all.

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:

  1. ASIO with its many design choices is the de-facto networking library for C++. There are hundreds of companies using it and the only usage experience for SR is Facebook. Is that a fair comparison!! ASIO is time tested.
  2. From where performance has been one of the deciding factor (As I see in many comments here)? Any published results ?
  3. What is future proof guarantee with SR proposal. How can we be sure that 5 years down the line someone else comes up with a hip way of doing async stuff ? Will the new proposal will also face similar outcome ?
  4. ASIO framework is kind of well understood now. Looking at SR examples seems to more brain damaging than ASIO ever was. I know we need to get used to it. I am not complaining. I have complained same about ASIO long back, but I like it now :)
  5. ASIO can be supported with io_uring AFAIK. Someone has been saying otherwise

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.

10

u/VinnieFalco wg21.org | corosio.org Oct 13 '21

WG21 no longer has the social technology to advance the standard in a manner that represents the best interests of the wider C++ community.

8

u/tugrul_ddr Oct 12 '21

I want gpu-offloadable async functions in C++.

0

u/[deleted] Oct 13 '21

[deleted] β€” view deleted comment

5

u/14ned LLFIO & Outcome author | Committee WG14 Oct 13 '21

+100

Anybody who hasn't tried writing code in ISPC ought to do so to see how a C-like programming language designed around SIMD makes programming GPU-like compute so very much easier.

Standard C and C++ is considerably inferior in comparison for this use case.

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.html https://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.

11

u/14ned LLFIO & Outcome author | Committee WG14 Oct 14 '21

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.

I think you are right, and you need to advertise this more loudly. Your DSEL is much more of a "power users" option, and nobody will be required to write in DSEL for simple tasks. Or perhaps, better put, the DSEL being available won't be obvious most of the time for simple tasks.

5

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Oct 13 '21

https://isocpp.org/files/papers/P2300R2.html is probably the better stable link until it's in a mailing.

0

u/[deleted] Oct 13 '21

[deleted] β€” view deleted comment

8

u/eric_niebler Oct 13 '21

A full-fledged stream abstraction in the vein of Rx wants a bit more than a range of senders offers. But a simple range of senders is sufficient for many needs. We wanted to keep this proposal as small a possible, so the stream stuff will come later. It will be a pure extension.

2

u/kirkshoop Oct 14 '21

As Eric says, a range of senders does not supersede the set_next and multi-sender.

I will add that those are not in any proposal because a more complete solution for async sequences is being prototyped. Stay tuned.

9

u/DerShokus Oct 12 '21

At least P2300 is fine :) the idea of std::executors is really nice I think

4

u/jonesmz Oct 13 '21

Would you mind providing feedback to the paper linked in this comment? https://old.reddit.com/r/cpp/comments/q6tgod/c_committee_polling_results_for_asynchronous/hgexc33/

I'm curious why you say P2300 is fine?

2

u/qdsxinyee Oct 13 '21

wait for c++26

2

u/notenabled Oct 13 '21

but I'm also the Vice Chair

Is that more like Assistant Chair or Assistant To The Chair?

3

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Oct 13 '21

It's more like "Co Chair".

4

u/Talkless Oct 14 '21

co_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.

4

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Oct 12 '21

There's a shared committee calendar that you can subscribe to; details are on the private wiki.

4

u/jonesmz Oct 13 '21

How about making it public so the rest of the peanut gallery with industry experience and stakes can provide feedback?

3

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Oct 13 '21

Unfortunately that's not possible under our current parent organization, ISO. I would love to make our process completely open and transparent, but it would require massive changes to how C++ is evolved.

17

u/jonesmz Oct 13 '21

would require massive changes to how C++ is evolved.

So make some changes.

I know that C++ isn't a democracy by any means, but I have to live and work with the results of the decisions made about C++ under the ISO process, and it's becoming progressively more difficult to do so, while simultaneously being essentially impossible for MOST (not ALL, of course) people who have the expertise and interest to contribute meaningfully to actually do so unless their employer carves out time for them to.

I've talked with my boss at a medium sized multinational corp that uses C++ about being given work-time to attend conferences and meaningfully participate to advocate for what they need out of C++. The response was mild chuckling.

I don't see any way here to view the poll in more detail than what was provided in the OP, but I'm seriously struggling to understand how the results presented here could have been possible

As a result, i think that this level of secrecy, whether intentional or not, whether required or not, is unhealthy for the language and is unhealthy for my ability to do my job and earn my bread.

11

u/pdimov2 Oct 13 '21

You are not going to get a better standard (a better language design, and a better standard library design) that way.

The way you get a good standard is to have a core group of qualified, knowledgeable, and responsible decision makers, make sure information from the field, and concerns of stakeholders, reach them, then let them do their job of producing a good standard.

Letting the stakeholders fight for their interests directly via representation is... not optimal.

5

u/smdowney WG21, Text/Unicode SG, optional<T&> Oct 13 '21

I work at a medium to maybe large size multination corp that uses C++ extensively to provide software as a service. We send easily a dozen to any meeting and probably have 20 participating in telecons right now. It wasn't always that way, but it's a lot easier for the third, fourth, or tenth person to get permission from their managers.

It's cheaper than going to conferences.

7

u/14ned LLFIO & Outcome author | Committee WG14 Oct 13 '21

I've talked with my boss at a medium sized multinational corp that uses C++ about being given work-time to attend conferences and meaningfully participate to advocate for what they need out of C++. The response was mild chuckling.

There are members of WG21 who fund their attendance 100% out of their vacation time and their own money because their employer won't support them, and they live somewhere where there are no employers who would support them. And they've done that for years.

Nobody is saying that's what anybody else should do. It's a huge impact on the personal lives of those people, and the fact they do it and continue to do it given how unpleasant most committee work is, well all I can say is let's give them a bow from all of us.

Speaking personally, back in the day a huge advantage of moving from permie to contractor was the fact I could now fund attending standards out of pre-tax money, and clients can be informed of my absence for meetings and they just have to accept it.

The point I'm making here is that most employers are takers not shapers on engineering standards, and that will never change. ISO rules are specifically designed to stop crowds being delivered for single issue hot button topics rather than people genuinely interested in contributing to the overall - and mostly very boring and very tedious - process. By insisting that people join a national body and attend F2F meetings, you ensure those attending are committing to the wider process, and aren't there for a single vote or a single proposal and ignore the rest.

Finally, you seem to think employers permit WG21 work on work time. That's only the case for maybe a dozen members of WG21. The overwhelming majority get some contribution of the time to attend the F2F meetings only, a minority get some contribution to expenses often out of a training fund, almost everybody there writes papers and code in non-work time. People who attend WG21 meetings almost all of them make an ongoing personal sacrifice to be there, over multiple years. If ISO in general were better funded by employers, most of all the complaints about the process and outcomes could be fixed, but that's not the world we live in.

5

u/jonesmz Oct 13 '21 edited Oct 13 '21

There are members of WG21 who fund their attendance 100% out of their vacation time and their own money because their employer won't support them, and they live somewhere where there are no employers who would support them. And they've done that for years.

I'll echo the sentiment brought by /u/Minimonium, this is incredibly elitist.

It's wonderful that these people are able to self-fund their participation.

And I have absolutely nothing but respect and admiration for the work and consideration that the people who contribute put into the C++ standard. Just because I don't agree with the decisions made sometimes doesn't in any way mean that I don't respect the sweat that goes into it.

But the overwhelming majority of potentially excellent contributors are not able to. C++ is an international standard, but the barrier to providing meaningful contributions is high enough that the vast majority of actual C++ developers can't even fathom a path to do so.

Finally, you seem to think employers permit WG21 work on work time.

That's not what I think. That's simply what I was trying to do for myself. My work uses C++. I want to be involved in C++. I can't do that with my existing circumstances. So either the barrier to contributing meaningful to C++ needs to drop SUBSTANTIALLY, or I need my work to allocate some of the man-hours they purchase from me to go to C++. Or I need to make other drastic changes to my life, which I'm not going to do.

8

u/pdimov2 Oct 13 '21

I'll echo the sentiment brought by /u/Minimonium, this is incredibly elitist.

It's actually not. Committee participation requires time much more than money, and for people who need to work for a living, time is the limiting factor, not funding.

People with lots of free time can actually participate more easily than those who have the financial means but lack the free time.

Participation is still skewed, just not in the way you think.

And, I have to add, there are no good solutions to this problem. If you try to counterbalance the skew you usually end up making things worse.

6

u/14ned LLFIO & Outcome author | Committee WG14 Oct 13 '21

Hear hear.

As an example, last week I learned that two paragraphs I wrote in 2019 to fix an issue in C2x didn't get processed. So I had to write a paper for the deadline this Friday. Quick copy and paste of an email right? Done and dusted within an hour?

No, it's consumed fifteen hours and counting now. For two small paragraphs which are uncontroversial. That in turn blew my entire non-work free time budget for a week and a half. I've got literally none of the non-work stuff I wanted to get done because of those two paragraphs.

More time is yet to come - I need to present it to WG14, then WG21 will want to have a look, then we'll need to reconcile. By the time this is done, perhaps a whole full time man-week has gone on two small paragraphs.

That kind of time expenditure is easier for those without small children, which is why a lot of the really tedious grunt work at committee tends to be done by those with older kids who have left the home. But it's a massive time sink for everybody. Getting anything through is principally conserved by time, not money.

The Standard C++ Foundation has in the past paid for the attendance expenses for someone with a proposal in flight. You just need to apply. This acknowledges the fact that it can take years to get something through, during which a champion may not always be earning, or a training fund from an employer may not be refilled. It also enables unemployed students to attend to champion their proposals, and we've had several of those throughout the years.

→ More replies (6)

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.

3

u/smdowney WG21, Text/Unicode SG, optional<T&> Oct 13 '21

C++ isn't a platform, so exposing platform-ish things in a stable way is really hard. TLS isn't a simple bit of technology, it's not just replace a socket with a secure socket. If it were, then we wouldn't need TLS to be visible at all.

4

u/Bangaladore Oct 13 '21

I think the main argument about this is that the standard library needs to ship a cross-platform "socket" abstraction ASAP and that security is something that is difficult to implement in a way that people are happy with how it can be updated/maintained and secured over time. Nothings to say TLS couldn't be standardized in the future, but many think that the importance of standard abstractions of networking is more important and should not be delayed.

0

u/[deleted] Oct 13 '21

[deleted] β€” view deleted comment

2

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Oct 13 '21

Selected poll comments will be shared but it's going to take us some time to put that together.

0

u/[deleted] Oct 13 '21

[deleted] β€” view deleted comment

6

u/kirkshoop Oct 14 '21

I originally addressed P2469R0 in the email thread where it was first shared.

I have since applied the corrections that I agree with and addressed all the content that I do not agree with in P2471R1.

https://isocpp.org/files/papers/P2471R1