Executing shell commands in pig scripts, may stuck due to Java buffer limitations.
%declare VAR `cat 100kbytes.txt`
2013-10-09 15:25:56,825 [main] INFO org.apache.pig.tools.parameters.PreprocessorContext - Executing command : cat 100kbytes.txt
The execution hungs, so you have to interrupt the program.
2013-10-09 15:26:10,066 [main] ERROR org.apache.pig.Main - ERROR 2999: Unexpected internal error. Error executing shell command: cat 100kbytes.txt. Command exit with exit code of 130
The problem lies in org.apache.pig.tools.parameters.PreprocessorContext#executeShellCommand method, line: 191 (trunk, at revision 1531874).
We wait for the process to complete before we get all the output, but the process waits for an indefinite amount of time, due to the fact that there is no space left in the buffer and the output can't be delivered.
I attach a test case that illustrates the problem and a patch as a solution. I would really like some comments.
|Status||Resolved [ 5 ]||Closed [ 6 ]|
|Status||Patch Available [ 10002 ]||Resolved [ 5 ]|
|Fix Version/s||0.13.0 [ 12324971 ]|
|Resolution||Fixed [ 1 ]|
|Assignee||Anastasis Andronidis [ andronat ]|
|Affects Version/s||0.12.0 [ 12323380 ]|
|Status||Open [ 1 ]||Patch Available [ 10002 ]|