Overview
| Artifact ID: | 97522a63267a0a35a87280bf55334c78d4aab8fe9c28cc938a00d371cf88e579 |
|---|---|
| Ticket: | 9b67dc961892c8494218ee7eef4b30b08ccef865
socket-14.11.* write before being notified that the channel is ready |
| User & Date: | sebres on 2024-08-27 08:10:33 |
Changes
- icomment:
This tests <code>socket-14.11.*</code> cover the failing flush by close, nothing else. However regarding the asynchronous write outside of writeable event... <i>>It is possible for an arbitrarily large amount of data to be buffered for a channel in non-blocking mode, which could consume a large amount of memory. </i> String "ok" is surely not large amount of data... No wasting or consumption of memory is expected by such small writes. Even a write of 100K outside or inside of writeable event is legitimate and completely fine, moreover does not differ from each other if reading side can read 1 byte only. Just because the notification about ready to read, doesn't tell us how many data it can read. By single, controlled write attempt, especially with small amount of data, it simply doesn't matter where and when exactly one'd do it (and whether the opposite side was ready to read or not). <i>> Therefore, socket-14.11.0 and 14.11.1 are testing undefined behaviour.</i> I already wrote what the tests doing, but...<br/> Neither it is an UB, nor it contradicts the documentation (but if so, the docu must be fixed), nor it is somehow wrong to do asynchronous write not from writable callback. It is fully legitimate to use such code snippets for known small data internally buffering in channel subsystem. Just consider it as simplest asynchronous write procedure - aka don't want/need to wait for the write.
- login: "sebres"
- mimetype: "text/x-fossil-wiki"