Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-7258

IllegalArgumentException in Netty bootstrap with large memory state segment size

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.3.1
    • Fix Version/s: 1.4.0, 1.3.2
    • Component/s: Network
    • Labels:
      None

      Description

      In NettyBootstrap we configure the low and high watermarks in the following order:

      bootstrap.childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, config.getMemorySegmentSize() + 1);
      bootstrap.childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, 2 * config.getMemorySegmentSize());
      

      When the memory segment size is higher than the default high water mark, this throws an `IllegalArgumentException` when a client tries to connect. Hence, this unfortunately only happens during runtime when a intermediate result is requested. This doesn't fail the job, but logs a warning and ignores the failed configuration attempt, potentially resulting in degraded performance because of a lower than expected watermark.

      A simple fix is to first configure the high water mark and only then configure the low watermark.

        Issue Links

          Activity

          Hide
          uce Ufuk Celebi added a comment -

          Fixed in 96ccffd (release-1.3), 038a9ac (master).

          Show
          uce Ufuk Celebi added a comment - Fixed in 96ccffd (release-1.3), 038a9ac (master).
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

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

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/flink/pull/4391
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user uce commented on the issue:

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

          Thanks for the review @zhijiangW and @zentol. Merging this for `1.3` and `master`.

          Show
          githubbot ASF GitHub Bot added a comment - Github user uce commented on the issue: https://github.com/apache/flink/pull/4391 Thanks for the review @zhijiangW and @zentol. Merging this for `1.3` and `master`.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user zentol commented on the issue:

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

          +1.

          Show
          githubbot ASF GitHub Bot added a comment - Github user zentol commented on the issue: https://github.com/apache/flink/pull/4391 +1.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user zhijiangW commented on the issue:

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

          @uce , really good to see this fix. I remembered meeting this problem in our production before and changed the sequence then.

          Show
          githubbot ASF GitHub Bot added a comment - Github user zhijiangW commented on the issue: https://github.com/apache/flink/pull/4391 @uce , really good to see this fix. I remembered meeting this problem in our production before and changed the sequence then.
          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user uce opened a pull request:

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

          FLINK-7258 [network] Fix watermark configuration order

            1. Purpose
              This PR changes the order in which low and high watermarks are configured for Netty server child connections (high first). That way we avoid running into an `IllegalArgumentException` when the low watermark is larger than the high watermark (relevant if the configured memory segment size is larger than the default).

          This situation surfaced only as a logged warning and the low watermark configuration was ignored.

            1. Changelog
          • Configure high watermark before low watermark in `NettyServer`
          • Configure high watermark before low watermark in `KvStateServer`
            1. Verifying this change
          • The change is pretty trivial with an extended `NettyServerLowAndHighWatermarkTest` that now checks the expected watermarks.
          • I didn't add a test for `KvStateServer`, because the watermarks can't be configured there manually.
          • To verify, you can run `NettyServerLowAndHighWatermarkTest` with logging before and after this change and verify that no warning is logged anymore.
            1. 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*
            1. Documentation
          • Does this pull request introduce a new feature? *no*
          • If yes, how is the feature documented? *not applicable*

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

          $ git pull https://github.com/uce/flink 7258-watermark_config

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

          https://github.com/apache/flink/pull/4391.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 #4391


          commit 73998ba1328d4bf61ee979ed327b0a684ed03aa7
          Author: Ufuk Celebi <uce@apache.org>
          Date: 2017-07-24T16:47:23Z

          FLINK-7258 [network] Fix watermark configuration order

          When configuring larger memory segment sizes, configuring the
          low watermark before the high watermark may lead to an
          IllegalArgumentException, because the low watermark will
          temporarily be higher than the high watermark. It's necessary
          to configure the high watermark before the low watermark.

          For the queryable state server in KvStateServer I didn't
          add an extra test as the watermarks cannot be configured there.


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user uce opened a pull request: https://github.com/apache/flink/pull/4391 FLINK-7258 [network] Fix watermark configuration order Purpose This PR changes the order in which low and high watermarks are configured for Netty server child connections (high first). That way we avoid running into an `IllegalArgumentException` when the low watermark is larger than the high watermark (relevant if the configured memory segment size is larger than the default). This situation surfaced only as a logged warning and the low watermark configuration was ignored. Changelog Configure high watermark before low watermark in `NettyServer` Configure high watermark before low watermark in `KvStateServer` Verifying this change The change is pretty trivial with an extended `NettyServerLowAndHighWatermarkTest` that now checks the expected watermarks. I didn't add a test for `KvStateServer`, because the watermarks can't be configured there manually. To verify, you can run `NettyServerLowAndHighWatermarkTest` with logging before and after this change and verify that no warning is logged anymore. 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 * Documentation Does this pull request introduce a new feature? * no * If yes, how is the feature documented? * not applicable * You can merge this pull request into a Git repository by running: $ git pull https://github.com/uce/flink 7258-watermark_config Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/4391.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 #4391 commit 73998ba1328d4bf61ee979ed327b0a684ed03aa7 Author: Ufuk Celebi <uce@apache.org> Date: 2017-07-24T16:47:23Z FLINK-7258 [network] Fix watermark configuration order When configuring larger memory segment sizes, configuring the low watermark before the high watermark may lead to an IllegalArgumentException, because the low watermark will temporarily be higher than the high watermark. It's necessary to configure the high watermark before the low watermark. For the queryable state server in KvStateServer I didn't add an extra test as the watermarks cannot be configured there.

            People

            • Assignee:
              uce Ufuk Celebi
              Reporter:
              uce Ufuk Celebi
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development