Comments (4)
But that is exactly the purpose of the non_blocking_adapter?
When a nonblocking sink returns 0 it should mean to try again later, and that's what it does.
In case if a permanent error, the sink must in fact return -1. I've not found that documented, but the code seems clear and consistent about this...
So why does the sink not return -1? If it can't know it's broken there is nothing that can be done really, since it's not possible to detect something is wrong.
from iostreams.
According to https://www.boost.org/doc/libs/1_76_0/libs/iostreams/doc/functions/write.html , iostreams::write
simply returns t.rdbuf()->sputn(s, n)
in this case. sputn
can only return zero or greater, which looks like not being able to exit at any write error.
To detect whether the failure is permanent, do you think it should also check the fail/bad bit?
from iostreams.
It's a bit hard to say without knowing why the sink device would become "broken" and how it is designed to report that.
It could throw an exception when it breaks.
Or it could signal it via pubsync() returning -1, which maybe should be called if the write unexpectedly returns 0?
Though I am not sure if the combination of streambuf and non-blocking is making sense in the first place.
from iostreams.
Looking at this again, https://www.boost.org/doc/libs/1_76_0/libs/iostreams/doc/guide/exceptions.html suggests that exceptions should be used to report errors.
However iostream's own file_sink/source report read errors with -1 and write errors not at all.
Does anyone have any idea/suggestion how this kind of issue could be fixed?
E.g. full disk currently results in endless loop consuming 100% CPU.
from iostreams.
Related Issues (20)
- [Feature request] Request the ability to `sync` single component of chain
- No const overloads for getting the underlying device of boost::iostream::stream
- Using Boost.Iostreams and Bzip2 with link-time optimization can lead to a segmentation fault HOT 1
- iostreams\detail\streambuf\indirect_streambuf.hpp(440) : warning C4702: unreachable code HOT 3
- Cannot disable zstd with "bjam -sNO_ZSTD" in boost/1.78.0 HOT 1
- cannot create an unsigned char bzip2 compressor HOT 5
- Double close possible in file_descriptor_impl::close_impl() HOT 4
- BOOST_DELETED_FUNCTION(...); produces 1683 "extra ‘;’ [-Wpedantic]" warnings. HOT 4
- gzip_decompressor() Segmentation fault HOT 1
- Gzip decompressor throws non-gzip_error HOT 12
- `file_descriptor` device leaks fd on Windows when constructed from int fd
- there is no warning number 4231 4660 HOT 2
- Object Lifetimes documentation missing.
- zstd filter: add support for parallel processing HOT 7
- boost::iostreams::stream<boost::iostreams::array> fails for size > 2GB when calling tellp HOT 5
- Incorrect comment about line ending characters
- Documentation format
- BOOST_ASSERT() in gzip.hpp triggers clang warning -Wstring-conversion
- No way to detect the return code of pubsync() during close()
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iostreams.