You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Zakelly (via GitHub)" <gi...@apache.org> on 2024/07/15 10:37:28 UTC

[PR] [FLINK-28984][checkpoint] Fix concurrency issue between `close` and `flushToFile` in `FsCheckpointStateOutputStream` [flink]

Zakelly opened a new pull request, #25088:
URL: https://github.com/apache/flink/pull/25088

   ## What is the purpose of the change
   
   As title said, there is concurrency issue  between `close` and `flushToFile` of `FsCheckpointStateOutputStream`, which cause a file leak.
   
   
   ## Brief change log
   
    - Add `synchronized` on method that may manipulate the files.
   
   ## Verifying this change
   
   This is a concurrency issue which is not easy to reproduce. I manually tested it via an IT case with small cp interval and cancelling the job when a cp is on-going. Then check if there is a file leak.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: no
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: yes
     - The S3 file system connector: no
   
   ## Documentation
   
     - Does this pull request introduce a new feature? no
     - If yes, how is the feature documented? not applicable
   


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-28984][checkpoint] Fix concurrency issue between `close` and `flushToFile` in `FsCheckpointStateOutputStream` [flink]

Posted by "showuon (via GitHub)" <gi...@apache.org>.
showuon commented on PR #25088:
URL: https://github.com/apache/flink/pull/25088#issuecomment-2230840099

   > @showuon Well I'm not a fan of credit, I just thought we could collaborate in a better way. Let's move our discussion to your new PR.
   
   Yes, it could be a better collaboration...>.<


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-28984][checkpoint] Fix concurrency issue between `close` and `flushToFile` in `FsCheckpointStateOutputStream` [flink]

Posted by "Zakelly (via GitHub)" <gi...@apache.org>.
Zakelly commented on PR #25088:
URL: https://github.com/apache/flink/pull/25088#issuecomment-2230817117

   @showuon Well I'm not a fan of credit, I just thought we could collaborate in a better way. Let's move our discussion to your new PR.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-28984][checkpoint] Fix concurrency issue between `close` and `flushToFile` in `FsCheckpointStateOutputStream` [flink]

Posted by "Zakelly (via GitHub)" <gi...@apache.org>.
Zakelly commented on PR #25088:
URL: https://github.com/apache/flink/pull/25088#issuecomment-2230685212

   Hi @showuon , thanks for you contribution.
   
   I'm afraid the bottleneck of checkpointing is the synchronous I/O, which is apparently significantly much slower than any CPU operation. So the optimization we are talking about is small. But any optimization is welcome, so I'd +1 for your proposal.
   
   But I can't treat your PR as 'another solution'. The main difference is the lock usage in `write`. Why you directly submit a PR instead of providing a suggestion, when I'm still active in community? Actually I'm open for any suggestion, it would be fine if you do so.
   
   I'm closing this PR since you have a better one. 


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-28984][checkpoint] Fix concurrency issue between `close` and `flushToFile` in `FsCheckpointStateOutputStream` [flink]

Posted by "Zakelly (via GitHub)" <gi...@apache.org>.
Zakelly closed pull request #25088: [FLINK-28984][checkpoint] Fix concurrency issue between `close` and `flushToFile` in `FsCheckpointStateOutputStream`
URL: https://github.com/apache/flink/pull/25088


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-28984][checkpoint] Fix concurrency issue between `close` and `flushToFile` in `FsCheckpointStateOutputStream` [flink]

Posted by "Zakelly (via GitHub)" <gi...@apache.org>.
Zakelly commented on PR #25088:
URL: https://github.com/apache/flink/pull/25088#issuecomment-2228200858

   I found this issue when the file-merging tests failed (FLINK-35843). @1996fanrui would you please take a look, since you have reviewed #20689 . @ChangjiGuo hope you don't mind I take over this issue.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-28984][checkpoint] Fix concurrency issue between `close` and `flushToFile` in `FsCheckpointStateOutputStream` [flink]

Posted by "showuon (via GitHub)" <gi...@apache.org>.
showuon commented on PR #25088:
URL: https://github.com/apache/flink/pull/25088#issuecomment-2230745919

   > But I can't treat your PR as 'another solution'. The main difference is the lock usage in write. Why you directly submit a PR instead of providing a suggestion, when I'm still active in community? Actually I'm open for any suggestion, it would be fine if you do so.
   
   Sorry @Zakelly , I didn't mean to take over your credit! Actually, My original thought is to add test for this PR. Then, change the solution to this: https://github.com/apache/flink/compare/master...showuon:flink:FLINK-28984_2?expand=1 . The main point is:
   1. Don't lock in `write` method
   2. Only lock when first time entering `flushToFile` method.
   3. Lock `close` and `closeAndGetHandle`
   4. With this, we can always make sure the stream will be closed correctly, while the lock overhead will be kept low.
   
   But after re-checking your PR and description, I found we need to lock `write` because there could be possible that the stream is closed, but data is only partially written. So I changed it again, to the version you saw right now. You're right, this is not another solution at all. I should have left comments directly. Sorry about that! I've added you as co-author in my PR. Sorry again!
   
   


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-28984][checkpoint] Fix concurrency issue between `close` and `flushToFile` in `FsCheckpointStateOutputStream` [flink]

Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #25088:
URL: https://github.com/apache/flink/pull/25088#issuecomment-2228198168

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "d163ff06714895eb03e4a9e1c3bea581d543add8",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "d163ff06714895eb03e4a9e1c3bea581d543add8",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d163ff06714895eb03e4a9e1c3bea581d543add8 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org