On Thu, 2023-03-30 at 23:23 +0530, sreenivas somavarapu wrote: > Hi Oleg, > > Yes I have looked at test cases and test data which it is trying to > write. > In tests cases it is trying to write only few bytes of data which is > way > less than 1024 bytes of data in a single write call which works > without any > problem. > > Now for my testing I have changed that test to create > SharedOutputBuffer of > initial size greater that 4 MB and tried to write chunck of data with > size > 1024 bytes. When we try to write 1024 bytes of data it hangs. > *Note*: I have used testcode present in *testBasis* function >
All right. Given that you refuses to listen I do not think I can help you any further. Oleg > > Regards, > Sreenivas > > > On Thu, Mar 30, 2023, 10:48 PM Oleg Kalnichevski <ol...@apache.org> > wrote: > > > On Thu, 2023-03-30 at 19:46 +0530, sreenivas somavarapu wrote: > > > Hi Oleg, > > > > > > I have copied code from *testBasis* function of > > > *TestSharedOutputBuffer.java* and ran the test with my data and > > > chunck size > > > of 1024 and it also hangs at first insert of data itself. So this > > > behavior > > > is irrespective of whether you use flush or not. If I use chunck > > > size > > > of > > > 1023 then test case passes without any hang. > > > > > > FYI. All the tests in that file tries to write few bytes of data > > > only > > > and > > > that to in a single write call. > > > > > > > > > _What on earth_ are talking about? Have you even bothered to look > > at > > the test code? Have you? > > > > This test case uses a tiny (20 bytes) shared buffer and performs > > multiple writes exceeding its total size several times over. > > > > > > https://github.com/apache/httpcomponents-core/blob/master/httpcore5/src/test/java/org/apache/hc/core5/http/nio/support/classic/TestSharedOutputBuffer.java#L141 > > > > Oleg > > > > > > > > > Regards, > > > Sreenivas > > > > > > On Thu, Mar 30, 2023, 6:55 PM sreenivas somavarapu > > > <soma.sreeni...@gmail.com> > > > wrote: > > > > > > > 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 > > > > > > > > > > > > > > > > ------------------------------------------------------------------- > > -- > > 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