You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 20, 2026. It is now read-only.
The bsd spec for readv states that readv can return less bytes than requested, just like read.
The bug happens when a subsequent read() call blocks for more input when the stream is currently exhausted.
The readv() call remains blocked and doesn't return the previously read bytes.
The problem also assumedly happens for writev as they share an implementation.
possible fix: insert poll before each subsequent read()/write() call to release in case the stream is blocked. I'm linking a commit that does that.
Somewhat unrelated, probable bug found in the same function:
The Mutex refactoring changed the behavior of the mutex protecting both readv and writev. It used to be shared between the different implemation with a global static Lock but was replaced with a local static Mutex.
The change is significant because the templated function is instantiated for both Read and Write and both instances of the mutex are now unrelated and no longer protecting from reading and writing at the same time.
This change is annotated with a fixme about using a pthread_mutex instead because of blocking operations.
Questions for the qualified:
are there any concerns with using poll here ?
should I open an other issue for the mutex ? what should be done about it ?
The bsd spec for
readvstates that readv can return less bytes than requested, just like read.The bug happens when a subsequent
read()call blocks for more input when the stream is currently exhausted.The
readv()call remains blocked and doesn't return the previously read bytes.The problem also assumedly happens for
writevas they share an implementation.possible fix: insert
pollbefore each subsequentread()/write()call to release in case the stream is blocked. I'm linking a commit that does that.Somewhat unrelated, probable bug found in the same function:
The Mutex refactoring changed the behavior of the mutex protecting both readv and writev. It used to be shared between the different implemation with a global static Lock but was replaced with a local static Mutex.
The change is significant because the templated function is instantiated for both Read and Write and both instances of the mutex are now unrelated and no longer protecting from reading and writing at the same time.
This change is annotated with a fixme about using a pthread_mutex instead because of blocking operations.
Questions for the qualified:
pollhere ?