GitHub user ajantha-bhat opened a pull request: https://github.com/apache/carbondata/pull/2675
[CARBONDATA-2901] Fixed JVM crash in Load scenario when unsafe memory allocation is failed. Problem: Jvm crash in Load scenario when unsafe memory allocation is failed. scenario: a) Have many cores while loading. suggested more than 10. [carbon.number.of.cores.while.loading] b) Load huge data with local sort, more than 5GB (keeping default unsafe memory manager as 512 MB) c) when task failes due to not enough unsafae memory, JVM crashes with SIGSEGV. root casue: while sorting, all iterator threads are waiting at UnsafeSortDataRows.addRowBatch as all iterator works on one row page. Only one iterator thread will try to allocate memory. Before that it has freed current page in handlePreviousPage(). When allocate memory failed, row page will still have that old reference. next thread will again use same reference and call handlePreviousPage(). So, Jvm crashes as freed memory is accessed. solution: When allocation failed, set row page reference to null. So, that next thread will not do any operation. You can merge this pull request into a Git repository by running: $ git pull https://github.com/ajantha-bhat/carbondata master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/carbondata/pull/2675.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2675 ---- commit 8ec20643726db944d1ee8bcc0d5e75568888a83c Author: ajantha-bhat <ajanthabhat@...> Date: 2018-08-30T14:18:34Z [CARBONDATA-2901] Fixed JVM crash in Load scenario when unsafe memory allocation is failed. Problem: Jvm crash in Load scenario when unsafe memory allocation is failed. scenario: a) Have many cores while loading. suggested more than 10. [carbon.number.of.cores.while.loading] b) Load huge data with local sort, more than 5GB (keeping default unsafe memory manager as 512 MB) c) when task failes due to not enough unsafae memory, JVM crashes with SIGSEGV. root casue: while sorting, all iterator threads are waiting at UnsafeSortDataRows.addRowBatch as all iterator works on one row page. Only one iterator thread will try to allocate memory. Before that it has freed current page in handlePreviousPage(). When allocate memory failed, row page will still have that old reference. next thread will again use same reference and call handlePreviousPage(). So, Jvm crashes as freed memory is accessed. solution: When allocation failed, set row page reference to null. So, that next thread will not do any operation. ---- ---