You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2020/09/07 21:14:09 UTC

[GitHub] [bookkeeper] francesco1997 opened a new issue #2411: BufferedChannel.write() method never ends if the BufferedChannel class is instantiated with capacity equal to 0

francesco1997 opened a new issue #2411:
URL: https://github.com/apache/bookkeeper/issues/2411


   **BUG REPORT**
   
   ***Describe the bug***
   
   If you instantiate a BufferedChannel with capacity equal to 0 and invoke the BufferedChannel.write() method, the execution of this method never finishes.
   
   
   ***To Reproduce***
   
   Steps to reproduce the behavior:
   1. Instantiate a BufferedChannel with 0 capacity
   2. Invoke the write() method with a non-empty bytes sequence in input
   
   I attach the class of tests that I used to reproduce the behavior [BufferedChannelWriteTest.zip](https://github.com/apache/bookkeeper/files/5184917/BufferedChannelWriteTest.zip)
   
   
   ***Expected behavior***
   
   Two possible behaviors:
   1. BufferedChannel raises an exception when you try to instantiate it with a null capacity (e.g. BufferedChannel raises IllegalArgumentException as when trying to instantiate the class with negative capacities)
   2. The BufferedChannel.write() method does not freeze and writes directly to the FileChannel
   
   
   ***Additional context***
   
   BufferedChannel.write() method writes a sequence of input bytes inside a write buffer (writeBuf). If this buffer has no space to contain other bytes (writeBuffer.isWritable() returns false) bytes inside writeBuf are flushed into FileChannel. The problem could arise in case buffer capacity is 0: in this case writeBuffer.isWritable() function does not return false because there are bytes inside that saturate its capacity but because the buffer has 0 capacity. The operation to flush bytes from writeBuf to FileChannel does not do anything because there are no bytes to write in FileChannel and this operation is performed until the buffer has no free space. Therefore the flush operation is executed infinitely, preventing the completion of the write() method.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] francesco1997 commented on issue #2411: BufferedChannel.write() method never ends if the BufferedChannel class is instantiated with capacity equal to 0

Posted by GitBox <gi...@apache.org>.
francesco1997 commented on issue #2411:
URL: https://github.com/apache/bookkeeper/issues/2411#issuecomment-689160915


   Journal class would freeze when writing data in its log file if Journal class initializes BufferedChannel class with 0 capacity. 
   
   I have no issue in production or in test environment. I found this bug while doing unit tests on BufferedChannel class.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] eolivelli closed issue #2411: BufferedChannel.write() method never ends if the BufferedChannel class is instantiated with capacity equal to 0

Posted by GitBox <gi...@apache.org>.
eolivelli closed issue #2411:
URL: https://github.com/apache/bookkeeper/issues/2411


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] eolivelli commented on issue #2411: BufferedChannel.write() method never ends if the BufferedChannel class is instantiated with capacity equal to 0

Posted by GitBox <gi...@apache.org>.
eolivelli commented on issue #2411:
URL: https://github.com/apache/bookkeeper/issues/2411#issuecomment-759260990


   I am closing this ticket as it does not affect production users


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] eolivelli commented on issue #2411: BufferedChannel.write() method never ends if the BufferedChannel class is instantiated with capacity equal to 0

Posted by GitBox <gi...@apache.org>.
eolivelli commented on issue #2411:
URL: https://github.com/apache/bookkeeper/issues/2411#issuecomment-688514268


   How does this fact affects BK?
   Do you have any issue in production or in test env?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org