You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "shunping (via GitHub)" <gi...@apache.org> on 2026/05/29 13:40:46 UTC

[PR] Disable gRPC fork support in PortableRunnerTestWithSubprocesses [beam]

shunping opened a new pull request, #38744:
URL: https://github.com/apache/beam/pull/38744

   Applying the fix in #38566 to its parent class.
   
   Redundant setup and teardown in the multi-worker subclass are removed to inherit them cleanly.
   
   Test failure example:
   https://github.com/apache/beam/actions/runs/26552726280/job/78218062486
   
   ```
   ________ PortableRunnerTestWithSubprocesses.test_custom_merging_window _________
   [gw5] darwin -- Python 3.12.10 /Users/runner/work/beam/beam/sdks/python/target/.tox/py312-macos/bin/python
   
   self = <apache_beam.runners.portability.portable_runner_test.PortableRunnerTestWithSubprocesses testMethod=test_custom_merging_window>
   
       def test_custom_merging_window(self):
   >     with self.create_pipeline() as p:
              ^^^^^^^^^^^^^^^^^^^^^^
   
   target/.tox/py312-macos/lib/python3.12/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner_test.py:1284: 
   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
   target/.tox/py312-macos/lib/python3.12/site-packages/apache_beam/pipeline.py:654: in __exit__
       self.result.wait_until_finish()
   target/.tox/py312-macos/lib/python3.12/site-packages/apache_beam/runners/portability/portable_runner.py:572: in wait_until_finish
       raise self._runtime_exception
   target/.tox/py312-macos/lib/python3.12/site-packages/apache_beam/runners/portability/portable_runner.py:581: in _observe_state
       for state_response in self._state_stream:
                             ^^^^^^^^^^^^^^^^^^
   target/.tox/py312-macos/lib/python3.12/site-packages/grpc/_channel.py:538: in __next__
       return self._next()
              ^^^^^^^^^^^^
   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
   
   self = <_MultiThreadedRendezvous of RPC that terminated with:
   	status = StatusCode.DEADLINE_EXCEEDED
   	details = "Stream removed (Deadline Exceeded)"
   	debug_error_string = "DEADLINE_EXCEEDED:Stream removed (Deadline Exceeded)"
   >
   
    ...
   
   target/.tox/py312-macos/lib/python3.12/site-packages/grpc/_channel.py:956: _MultiThreadedRendezvous
   ----------------------------- Captured stderr call -----------------------------
   INFO:apache_beam.runners.portability.abstract_job_service:Running job 'job-b448bab8-ee74-4885-804c-2fbb1c2fc353'
   INFO:apache_beam.runners.portability.fn_api_runner.worker_handlers:starting control server on port 51713
   INFO:apache_beam.runners.portability.fn_api_runner.worker_handlers:starting data server on port 51714
   INFO:apache_beam.runners.portability.fn_api_runner.worker_handlers:starting state server on port 51715
   INFO:apache_beam.runners.portability.fn_api_runner.worker_handlers:starting logging server on port 51716
   I0528 03:33:05.777477  106607 fork_posix.cc:71] Other threads are currently calling into gRPC, skipping fork() handlers
   ```


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Disable gRPC fork support in PortableRunnerTestWithSubprocesses [beam]

Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping commented on code in PR #38744:
URL: https://github.com/apache/beam/pull/38744#discussion_r3324730505


##########
sdks/python/apache_beam/runners/portability/portable_runner_test.py:
##########
@@ -295,6 +295,22 @@ def create_options(self):
 class PortableRunnerTestWithSubprocesses(PortableRunnerTest):
   _use_subprocesses = True
 
+  # TODO(https://github.com/grpc/grpc/issues/37710): Remove once fixed.
+  @classmethod
+  def setUpClass(cls):
+    cls._old_fork_support = os.environ.get('GRPC_ENABLE_FORK_SUPPORT')
+    os.environ['GRPC_ENABLE_FORK_SUPPORT'] = 'false'
+    super().setUpClass()
+
+  # TODO(https://github.com/grpc/grpc/issues/37710): Remove once fixed.
+  @classmethod
+  def tearDownClass(cls):
+    if cls._old_fork_support is None:
+      os.environ.pop('GRPC_ENABLE_FORK_SUPPORT', None)
+    else:
+      os.environ['GRPC_ENABLE_FORK_SUPPORT'] = cls._old_fork_support
+    super().tearDownClass()

Review Comment:
   ack



-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Disable gRPC fork support in PortableRunnerTestWithSubprocesses [beam]

Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on code in PR #38744:
URL: https://github.com/apache/beam/pull/38744#discussion_r3324700758


##########
sdks/python/apache_beam/runners/portability/portable_runner_test.py:
##########
@@ -295,6 +295,22 @@ def create_options(self):
 class PortableRunnerTestWithSubprocesses(PortableRunnerTest):
   _use_subprocesses = True
 
+  # TODO(https://github.com/grpc/grpc/issues/37710): Remove once fixed.
+  @classmethod
+  def setUpClass(cls):
+    cls._old_fork_support = os.environ.get('GRPC_ENABLE_FORK_SUPPORT')
+    os.environ['GRPC_ENABLE_FORK_SUPPORT'] = 'false'
+    super().setUpClass()
+
+  # TODO(https://github.com/grpc/grpc/issues/37710): Remove once fixed.
+  @classmethod
+  def tearDownClass(cls):
+    if cls._old_fork_support is None:
+      os.environ.pop('GRPC_ENABLE_FORK_SUPPORT', None)
+    else:
+      os.environ['GRPC_ENABLE_FORK_SUPPORT'] = cls._old_fork_support
+    super().tearDownClass()

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   If `super().setUpClass()` raises an exception, `tearDownClass` will not be executed by the test runner, which can leak the modified `GRPC_ENABLE_FORK_SUPPORT` environment variable to other test classes running in the same process.
   
   Using `self.addClassCleanup` (available in Python 3.8+) is a cleaner and more robust approach. It ensures that the cleanup function is executed even if `setUpClass` fails, and it allows us to completely eliminate the `tearDownClass` method.
   
   ```python
     @classmethod
     def setUpClass(cls):
       old_fork_support = os.environ.get('GRPC_ENABLE_FORK_SUPPORT')
       os.environ['GRPC_ENABLE_FORK_SUPPORT'] = 'false'
       def restore_fork_support():
         if old_fork_support is None:
           os.environ.pop('GRPC_ENABLE_FORK_SUPPORT', None)
         else:
           os.environ['GRPC_ENABLE_FORK_SUPPORT'] = old_fork_support
       cls.addClassCleanup(restore_fork_support)
       super().setUpClass()
   ```



-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Disable gRPC fork support in PortableRunnerTestWithSubprocesses [beam]

Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on PR #38744:
URL: https://github.com/apache/beam/pull/38744#issuecomment-4575867935

   ## Summary of Changes
   
   Hello, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
   
   This pull request addresses intermittent test failures caused by gRPC fork support issues during subprocess execution. By centralizing the environment configuration in the base class and cleaning up redundant overrides in subclasses, the test suite becomes more stable and maintainable.
   
   ### Highlights
   
   * **gRPC Fork Support**: Disabled gRPC fork support by setting the GRPC_ENABLE_FORK_SUPPORT environment variable to 'false' in the PortableRunnerTestWithSubprocesses class to prevent test failures.
   * **Code Cleanup**: Removed redundant setUpClass and tearDownClass methods from the PortableRunnerTestWithSubprocessesAndMultiWorkers subclass, allowing it to inherit the configuration cleanly from its parent.
   
   <details>
   <summary><b>New Features</b></summary>
   
   🧠 You can now enable **Memory** (public preview) to help **Gemini Code Assist** learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. **Click [here](https://codeassist.google/code-review/login) to enable Memory in your admin console.**
   </details>
   
   <details>
   <summary><b>Using Gemini Code Assist</b></summary>
   <br>
   
   The full guide for Gemini Code Assist can be found on our [documentation page](https://developers.google.com/gemini-code-assist/docs/review-github-code), here are some quick tips.
   
   <b>Invoking Gemini</b>
   
   You can request assistance from Gemini at any point by creating a comment using either `/gemini <command>` or `@gemini-code-assist <command>`. Below is a summary of the supported commands on the current page.
   
   Feature | Command | Description
   --- | --- | ---
   Code Review | `/gemini review` | Performs a code review for the current pull request in its current state.
   Pull Request Summary | `/gemini summary` | Provides a summary of the current pull request in its current state.
   Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in pull request comments and review comments.
   Help | `/gemini help` | Displays a list of available commands.
   
   <b>Customization</b>
   
   To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a `.gemini/` folder in the base of the repository. Detailed instructions can be found [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github).
   
   <b>Limitations & Feedback</b>
   
   Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up [here](https://google.qualtrics.com/jfe/form/SV_2cyuGuTWsEw84yG).
   </details>
   
   
   [^1]: Review the [Privacy Notices](https://policies.google.com/privacy), [Generative AI Prohibited Use Policy](https://policies.google.com/terms/generative-ai/use-policy), [Terms of Service](https://policies.google.com/terms), and learn how to configure Gemini Code Assist in GitHub [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github). Gemini can make mistakes, so double check it and [use code with caution](https://support.google.com/legal/answer/13505487).
   


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Disable gRPC fork support in PortableRunnerTestWithSubprocesses [beam]

Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping merged PR #38744:
URL: https://github.com/apache/beam/pull/38744


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Disable gRPC fork support in PortableRunnerTestWithSubprocesses [beam]

Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping commented on PR #38744:
URL: https://github.com/apache/beam/pull/38744#issuecomment-4575866448

   r: @derrickaw


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Disable gRPC fork support in PortableRunnerTestWithSubprocesses [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #38744:
URL: https://github.com/apache/beam/pull/38744#issuecomment-4575877859

   Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment `assign set of reviewers`


-- 
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: github-unsubscribe@beam.apache.org

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