You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/02/05 13:02:00 UTC

[jira] [Commented] (FLINK-8559) Exceptions in RocksDBIncrementalSnapshotOperation#takeSnapshot cause job to get stuck

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

ASF GitHub Bot commented on FLINK-8559:
---------------------------------------

GitHub user zentol opened a pull request:

    https://github.com/apache/flink/pull/5412

    [FLINK-8559][RocksDB] Release resources if snapshot operation fails

    ## What is the purpose of the change
    
    This PR ensures that RocksDB resources are released if `RocksDBIncrementalSnapshotOperation#takeSnapshot` throws an Exception.
    
    We now catch the exception, cancel the SnapshotOperation, and re-throw the original exception.
    
    ## Verifying this change
    
    I've verified this manually by running `JobManagerHACheckpointRecoveryITCase` on Windows where `takeSnapshot` fails due to FLINK-8557.
    
    I couldn't come up with proper test. The method hardly does anything in the first place and every solution i could think of would depend a lot on implementation details (like mocking `Checkpoint.create()` to throw an exception).
    
    ## 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, Yarn/Mesos, ZooKeeper: (no)
      - 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)
    
    @StefanRRichter 

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/zentol/flink 8559

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/5412.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #5412
    
----
commit 05f0ff5e353117894af4ba7dc096c3256d80450b
Author: zentol <ch...@...>
Date:   2018-02-05T12:15:29Z

    [FLINK-8559][RocksDB] Release resources if snapshot operation fails

----


> Exceptions in RocksDBIncrementalSnapshotOperation#takeSnapshot cause job to get stuck
> -------------------------------------------------------------------------------------
>
>                 Key: FLINK-8559
>                 URL: https://issues.apache.org/jira/browse/FLINK-8559
>             Project: Flink
>          Issue Type: Bug
>          Components: State Backends, Checkpointing, Tests
>    Affects Versions: 1.4.0, 1.5.0
>            Reporter: Chesnay Schepler
>            Priority: Blocker
>
> In the {{RocksDBKeyedStatebackend#snapshotIncrementally}} we can find this code
>  
> {code:java}
> final RocksDBIncrementalSnapshotOperation<K> snapshotOperation =
> 	new RocksDBIncrementalSnapshotOperation<>(
> 		this,
> 		checkpointStreamFactory,
> 		checkpointId,
> 		checkpointTimestamp);
> snapshotOperation.takeSnapshot();
> return new FutureTask<KeyedStateHandle>(
> 	new Callable<KeyedStateHandle>() {
> 		@Override
> 		public KeyedStateHandle call() throws Exception {
> 			return snapshotOperation.materializeSnapshot();
> 		}
> 	}
> ) {
> 	@Override
> 	public boolean cancel(boolean mayInterruptIfRunning) {
> 		snapshotOperation.stop();
> 		return super.cancel(mayInterruptIfRunning);
> 	}
> 	@Override
> 	protected void done() {
> 		snapshotOperation.releaseResources(isCancelled());
> 	}
> };
> {code}
> In the constructor of RocksDBIncrementalSnapshotOperation we call {{aquireResource()}} on the RocksDB {{ResourceGuard}}. If {{snapshotOperation.takeSnapshot()}} fails with an exception these resources are never released. When the task is shutdown due to the exception it will get stuck on releasing RocksDB.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)