Hi Oleg,

That condition (i.e., using of flush call) will hold good if I have already
have data in buffer, but in this case I am trying to produce data i.e.,
first time using buffer to add data and it gets hanged.

Now the tests will pass with out any changes except for decrementing the
data chunck to be written to less that 1024 (I.e., 1023 or smaller and no
flush call used).

This implies that even tough enough capacity is there buffer is unable to
take data of chuncks 1024 or above bytes.

Regards
Sreenivas

On Thu, Mar 30, 2023, 4:22 PM Oleg Kalnichevski <ol...@apache.org> wrote:

> On Thu, 2023-03-30 at 15:53 +0530, sreenivas somavarapu wrote:
> > Hi Oleg,
> >
> > You conveyed that flush is missing and  I have stated it is first
> > write to
> > buffer then how come we can do flush without any data and there was a
> > reply
> > stating write our own custom implementation.
>
> One needs to flush shared data from _another_ thread of execution.
> There must be at least two concurrent threads of execution: one
> producing and one consuming or visa versa. This is the reason the write
> operation blocks. I also told you to look at the test cases for the
> shared buffers in the project test suite in order to see how they are
> intended to be used but you would not listen.
>
> Oleg
>
>
> >
> > What I am trying to convey is there is a genuine issue with buffer
> > implementation which could be reproducible which are mentioned in my
> > mail.
> > Even when buffer has capacity we will not be able to write data into
> > buffer
> > if data we are trying to write is of 1024 bytes and less that buffer
> > capacity available.
> >
> > Regards,
> > Sreenivas
> >
> >
> > On Thu, Mar 30, 2023, 3:01 PM Oleg Kalnichevski <ol...@apache.org>
> > wrote:
> >
> > > I already answered your question some while ago and explained what
> > > you
> > > were doing incorrectly. You basically dismissed my answer and keep
> > > on
> > > posting the same query over and over again. This is not going to
> > > help.
> > >
> > > Oleg
> > >
> > >
> > > On Thu, 2023-03-30 at 14:39 +0530, sreenivas somavarapu wrote:
> > > > Hi Team,
> > > >
> > > > There is a hang issue happening with SharedOutputBuffer when
> > > > trying
> > > > to
> > > > insert data chunck of 1024 bytes or above. However this works
> > > > fine if
> > > > data
> > > > chunck being inserted is less that 1024 bytes.
> > > >
> > > > Simple way to reproduce the problem is
> > > > - Create SharedOutputBuffer with 4096 bytes of capacity
> > > > - Now try to write 1024 bytes of data chunck to above created
> > > > buffer
> > > >
> > > > Second step will cause hang and by looking at code it looks like
> > > > below
> > > > condition is causing problem
> > > >
> > > > if (src.remaining() < 1024 && buffer().remaining() >
> > > > src.remaining())
> > > > {
> > > >
> > > > Problem with this above condition is that even though buffer has
> > > > capacity
> > > > to store complete contents of src, this condition will not
> > > > satisfy if
> > > > src
> > > > has 1024 bytes or more data (may well be in limit of actual size
> > > > provided
> > > > during creation of buffer) to be written to buffer
> > > >
> > > > second step still will cause in a hang as first if condition is
> > > > not
> > > > satisfied due to src.remaining() < 1024 even though there is
> > > > enough
> > > > capacity to store data and it proceeds to second condition which
> > > > will
> > > > cause
> > > > the program to wait on a condition for flush (even though this is
> > > > the
> > > > first
> > > > write we are performing)
> > > >
> > > > if (buffer().position() > 0 || dataStreamChannel == null) {
> > > >                          waitFlush();
> > > > }
> > > >
> > > > Regards,
> > > > Sreenivas
> > >
> > >
> > > -------------------------------------------------------------------
> > > --
> > > To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
> > > For additional commands, e-mail:
> > > httpclient-users-h...@hc.apache.org
> > >
> > >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
> For additional commands, e-mail: httpclient-users-h...@hc.apache.org
>
>

Reply via email to