[ 
https://issues.apache.org/jira/browse/PIG-5160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15890203#comment-15890203
 ] 

Anyi Li commented on PIG-5160:
------------------------------

After changing the title, I think it should only focus on 
SchemaTupleFrontend.java instead to make pig thread safe. The static methods in 
the class will cause problems in you run pig in multithread environments. 
Hopefully this will remediate your concerns about this ticket. 

> SchemaTupleFrontend.java is not thread safe, cause PigServer thrown NPE in 
> multithread env
> ------------------------------------------------------------------------------------------
>
>                 Key: PIG-5160
>                 URL: https://issues.apache.org/jira/browse/PIG-5160
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.17.0
>            Reporter: Anyi Li
>            Assignee: Anyi Li
>              Labels: patch
>         Attachments: PIG_5160.patch
>
>
> Calling PigServer in multi-thread environment will randomly throw NPE at 
> {code}
> Caused by: org.apache.pig.backend.executionengine.ExecException: ERROR 0: 
> java.lang.NullPointerException
>     at 
> org.apache.pig.backend.hadoop.executionengine.HExecutionEngine.launchPig(HExecutionEngine.java:310)
>     at org.apache.pig.PigServer.launchPlan(PigServer.java:1390)
>     at 
> org.apache.pig.PigServer.executeCompiledLogicalPlan(PigServer.java:1375)
>     at org.apache.pig.PigServer.storeEx(PigServer.java:1034)
>     ... 6 more
> Caused by: java.lang.NullPointerException
>     at 
> org.apache.pig.data.SchemaTupleFrontend.registerToGenerateIfPossible(SchemaTupleFrontend.java:255)
>     at 
> org.apache.pig.newplan.logical.relational.LogToPhyTranslationVisitor.visit(LogToPhyTranslationVisitor.java:876)
>     at 
> org.apache.pig.newplan.logical.relational.LOForEach.accept(LOForEach.java:87)
>     at 
> org.apache.pig.newplan.DependencyOrderWalker.walk(DependencyOrderWalker.java:75)
>     at org.apache.pig.newplan.PlanVisitor.visit(PlanVisitor.java:52)
>     at 
> org.apache.pig.backend.hadoop.executionengine.HExecutionEngine.compile(HExecutionEngine.java:260)
>     at 
> org.apache.pig.backend.hadoop.executionengine.HExecutionEngine.launchPig(HExecutionEngine.java:295)
>     ... 9 more
> {code} 
> because SchemaTupleFrontend.java has lots of static methods which refer to 
> static variables. Need a patch to create threadlocal variables to make it 
> thread safe



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to