[ 
https://issues.apache.org/jira/browse/BEAM-8300?focusedWorklogId=317552&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-317552
 ]

ASF GitHub Bot logged work on BEAM-8300:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Sep/19 14:51
            Start Date: 24/Sep/19 14:51
    Worklog Time Spent: 10m 
      Work Description: aromanenko-dev commented on pull request #9640: 
[BEAM-8300]: KinesisIO.write throws NPE because producer is null
URL: https://github.com/apache/beam/pull/9640#discussion_r327662059
 
 

 ##########
 File path: 
sdks/java/io/kinesis/src/main/java/org/apache/beam/sdk/io/kinesis/KinesisIO.java
 ##########
 @@ -633,6 +634,13 @@ private synchronized void initKinesisProducer() {
         producer = spec.getAWSClientsProvider().createKinesisProducer(config);
       }
 
+      private void readObject(ObjectInputStream is) throws IOException, 
ClassNotFoundException {
+        is.defaultReadObject();
+        if (producer == null) {
 
 Review comment:
   I meant just to add this check:
   ```
   if (producer == null) {
     initKinesisProducer();
   }
   ```
   directly into `KinesisWriterFn.startBundle()`. Beam will guarantee that the 
whole bundle will be processed on the same worker and the object won't be 
serialised/deserialised until 
    this bundle will be finished. Though, I think `readObject` should do the 
same job. Wdyt?
   
   Regarding the test, I believe that all Kinesis.Write tests are in 
`KinesisMockWriteTest`, but now I started to doubt if it's possible to test 
such regression in unit tests. Wdyt?
 
----------------------------------------------------------------
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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 317552)
    Time Spent: 1h 10m  (was: 1h)

> KinesisIO.write causes NPE as the producer is null
> --------------------------------------------------
>
>                 Key: BEAM-8300
>                 URL: https://issues.apache.org/jira/browse/BEAM-8300
>             Project: Beam
>          Issue Type: Bug
>          Components: io-java-kinesis
>    Affects Versions: 2.15.0
>            Reporter: Ankit Jhalaria
>            Assignee: Ankit Jhalaria
>            Priority: Minor
>             Fix For: Not applicable
>
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> While using KinesisIO.write(), we encountered a NPE with the following stack 
> traceĀ 
> {code:java}
> org.apache.beam.runners.flink.translation.wrappers.streaming.io.UnboundedSourceWrapper.run(UnboundedSourceWrapper.java:297)\n\tat
>  
> org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:93)\n\tat
>  
> org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:57)\n\tat
>  
> org.apache.flink.streaming.runtime.tasks.SourceStreamTask.run(SourceStreamTask.java:97)\n\tat
>  
> org.apache.flink.streaming.runtime.tasks.StoppableSourceStreamTask.run(StoppableSourceStreamTask.java:45)\n\tat
>  
> org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:300)\n\tat
>  org.apache.flink.runtime.taskmanager.Task.run(Task.java:711)\n\tat 
> java.lang.Thread.run(Thread.java:748)\nCaused by: 
> java.lang.NullPointerException: null\n\tat 
> org.apache.beam.sdk.io.kinesis.KinesisIO$Write$KinesisWriterFn.flushBundle(KinesisIO.java:685)\n\tat
>  
> org.apache.beam.sdk.io.kinesis.KinesisIO$Write$KinesisWriterFn.finishBundle(KinesisIO.java:669){code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to