[ https://issues.apache.org/jira/browse/KAFKA-204?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13155857#comment-13155857 ]
Chris Burroughs commented on KAFKA-204: --------------------------------------- > I mean once you hit that all bets are off, you need to restart your > process...basically I think we shouldn't be messing with that. Yeah, the most important thing to do is get out of the way and let the process exit with a non-zero status code. So the options as I see it are: (1) Do something ugly (like pass the original fetch request to byteBufferAllocate) for the purposes of a valiant but possible futile logging attempt (there is no guarantee we will be able to allocate the logging Strings we are already asking for, everything we ad makes that less likely). (2) Just rethrow e after a logging attempt in byteBufferAllocate. My preference is (2), but if someone prefers (1) that's a reasonable trade off. > BoundedByteBufferReceive hides OutOfMemoryError > ----------------------------------------------- > > Key: KAFKA-204 > URL: https://issues.apache.org/jira/browse/KAFKA-204 > Project: Kafka > Issue Type: Bug > Affects Versions: 0.7 > Reporter: Chris Burroughs > Assignee: Chris Burroughs > Priority: Critical > Attachments: k204-v1.txt > > > private def byteBufferAllocate(size: Int): ByteBuffer = { > var buffer: ByteBuffer = null > try { > buffer = ByteBuffer.allocate(size) > } > catch { > case e: OutOfMemoryError => > throw new RuntimeException("OOME with size " + size, e) > case e2 => > throw e2 > } > buffer > } > This hides the fact that an Error occurred, and will likely result in some > log handler printing a message, instead of exiting with non-zero status. > Knowing how large the allocation was that caused an OOM is really nice, so > I'd suggest logging in byteBufferAllocate and then re-throwing > OutOfMemoryError -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira