users@grizzly.java.net

Re: Grizzly http client race condition

From: Oleksiy Stashok <oleksiy.stashok_at_oracle.com>
Date: Tue, 09 Jun 2015 18:32:44 +0200

Hi,

On 05.06.15 22:40, testn wrote:
> the part which is not thread-safe is in GrizzlyConnector.FeedAdapter where
> Buffers.wrap(MemoryManager.DEFAULT_MEMORY_MANAGER, b, off, len) is passed to
> AsyncWriteQueueRecord without copying it. Do you think
> AbstractNIOAsyncQueueWriter.write should copy the record when it needs to
> enqueue the record to the queue when it cannot write inline?
Hmm, I don't think async write queue should copy it, because there are
cases where it's better to copy the buffer to simplify some usecases
like the one we're talking about, but sometimes the buffer is some
internal buffer, which doesn't have to be copied, because the sender
doesn't plan to reuse it.
Considering above, we don't copy the buffer and rely on sender logic to
take care of this situation.

Please share your Feeder code and I'll try to help you.

Thanks.

WBR,
Alexey.