You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/05/14 12:00:11 UTC

[GitHub] [flink] aljoscha opened a new pull request #12151: [FLINK-16383] Set close = true in monitor/lock scope in KafkaProducer

aljoscha opened a new pull request #12151:
URL: https://github.com/apache/flink/pull/12151


   Before, the flag was changed outside the lock, which would allow the
   case that the flag is set to true while someone else is holding the
   "close lock".


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] StephanEwen commented on a change in pull request #12151: [FLINK-16383] Set close = true in monitor/lock scope in KafkaProducer

Posted by GitBox <gi...@apache.org>.
StephanEwen commented on a change in pull request #12151:
URL: https://github.com/apache/flink/pull/12151#discussion_r425134302



##########
File path: flink-connectors/flink-connector-kafka-0.11/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/FlinkKafkaProducer.java
##########
@@ -190,17 +192,19 @@ public void sendOffsetsToTransaction(Map<TopicPartition, OffsetAndMetadata> offs
 
 	@Override
 	public void close() {
-		closed = true;
 		synchronized (producerClosingLock) {
 			kafkaProducer.close();
+			LOG.debug("Closed internal KafkaProducer {}. Stacktrace: {}", System.identityHashCode(this), Joiner.on("\n").join(Thread.currentThread().getStackTrace()));

Review comment:
       This uses eager string concatenation in a lazy parameter, which is typically a blocker.
   Now, this is not a performance critical path, but I would still suggest to avoid this, because it sets a bad example for other contributors to immitate (in then more critical parts).




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] aljoscha commented on a change in pull request #12151: [FLINK-16383] Set close = true in monitor/lock scope in KafkaProducer

Posted by GitBox <gi...@apache.org>.
aljoscha commented on a change in pull request #12151:
URL: https://github.com/apache/flink/pull/12151#discussion_r425137936



##########
File path: flink-connectors/flink-connector-kafka-0.11/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/FlinkKafkaProducer.java
##########
@@ -190,17 +192,19 @@ public void sendOffsetsToTransaction(Map<TopicPartition, OffsetAndMetadata> offs
 
 	@Override
 	public void close() {
-		closed = true;
 		synchronized (producerClosingLock) {
 			kafkaProducer.close();
+			LOG.debug("Closed internal KafkaProducer {}. Stacktrace: {}", System.identityHashCode(this), Joiner.on("\n").join(Thread.currentThread().getStackTrace()));

Review comment:
       Yes, that's why I left it there but I agree that we should set good examples? So I should put an `if (LOG.isDebugEnabled()) {}` around it?




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #12151: [FLINK-16383] Set close = true in monitor/lock scope in KafkaProducer

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #12151:
URL: https://github.com/apache/flink/pull/12151#issuecomment-628592688


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit c38ce628f6d041da0daa96d2faa881df60caef35 (Thu May 14 12:12:01 UTC 2020)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
    * **This pull request references an unassigned [Jira ticket](https://issues.apache.org/jira/browse/FLINK-16383).** According to the [code contribution guide](https://flink.apache.org/contributing/contribute-code.html), tickets need to be assigned before starting with the implementation work.
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] aljoscha commented on pull request #12151: [FLINK-16383] Set close = true in monitor/lock scope in KafkaProducer

Posted by GitBox <gi...@apache.org>.
aljoscha commented on pull request #12151:
URL: https://github.com/apache/flink/pull/12151#issuecomment-628609324


   @becketqin I added some debug logging.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] becketqin commented on pull request #12151: [FLINK-16383] Set close = true in monitor/lock scope in KafkaProducer

Posted by GitBox <gi...@apache.org>.
becketqin commented on pull request #12151:
URL: https://github.com/apache/flink/pull/12151#issuecomment-628588687


   Thanks for the patch, Aljoscha. LGTM.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] aljoscha commented on pull request #12151: [FLINK-16383] Set close = true in monitor/lock scope in KafkaProducer

Posted by GitBox <gi...@apache.org>.
aljoscha commented on pull request #12151:
URL: https://github.com/apache/flink/pull/12151#issuecomment-628664053


   Thanks for the swift reviews!


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #12151: [FLINK-16383] Set close = true in monitor/lock scope in KafkaProducer

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #12151:
URL: https://github.com/apache/flink/pull/12151#issuecomment-628604664


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "c38ce628f6d041da0daa96d2faa881df60caef35",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "c38ce628f6d041da0daa96d2faa881df60caef35",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * c38ce628f6d041da0daa96d2faa881df60caef35 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #12151: [FLINK-16383] Set close = true in monitor/lock scope in KafkaProducer

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12151:
URL: https://github.com/apache/flink/pull/12151#issuecomment-628604664


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "c38ce628f6d041da0daa96d2faa881df60caef35",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1294",
       "triggerID" : "c38ce628f6d041da0daa96d2faa881df60caef35",
       "triggerType" : "PUSH"
     }, {
       "hash" : "383465d8d25a80f84ad043963c44217a12b08657",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "383465d8d25a80f84ad043963c44217a12b08657",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * c38ce628f6d041da0daa96d2faa881df60caef35 Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1294) 
   * 383465d8d25a80f84ad043963c44217a12b08657 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #12151: [FLINK-16383] Set close = true in monitor/lock scope in KafkaProducer

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12151:
URL: https://github.com/apache/flink/pull/12151#issuecomment-628604664


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "c38ce628f6d041da0daa96d2faa881df60caef35",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1294",
       "triggerID" : "c38ce628f6d041da0daa96d2faa881df60caef35",
       "triggerType" : "PUSH"
     }, {
       "hash" : "383465d8d25a80f84ad043963c44217a12b08657",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "383465d8d25a80f84ad043963c44217a12b08657",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * c38ce628f6d041da0daa96d2faa881df60caef35 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1294) 
   * 383465d8d25a80f84ad043963c44217a12b08657 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] aljoscha closed pull request #12151: [FLINK-16383] Set close = true in monitor/lock scope in KafkaProducer

Posted by GitBox <gi...@apache.org>.
aljoscha closed pull request #12151:
URL: https://github.com/apache/flink/pull/12151


   


----------------------------------------------------------------
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:
users@infra.apache.org