You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/02/12 11:04:00 UTC

[jira] [Work logged] (BEAM-11807) SDK Worker with multithreading causes boto3 the KeyError(endpoint_resolver)

     [ https://issues.apache.org/jira/browse/BEAM-11807?focusedWorklogId=551759&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-551759 ]

ASF GitHub Bot logged work on BEAM-11807:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 12/Feb/21 11:03
            Start Date: 12/Feb/21 11:03
    Worklog Time Spent: 10m 
      Work Description: ferryvg opened a new pull request #13977:
URL: https://github.com/apache/beam/pull/13977


   **Please** add a meaningful description for your change here
   When using external worker and S3 storage you may got an `KeyError('endpoint_resolver')` error. That caused because Boto3 default session is not thread-safe.
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [ ] [**Choose reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and mention them in a comment (`R: @username`).
    - [ ] Format the pull request title like `[BEAM-XXX] Fixes bug in ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
    - [ ] Update `CHANGES.md` with noteworthy changes.
    - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://beam.apache.org/contribute/#make-reviewers-job-easier).
   
   Post-Commit Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   
   Lang | SDK | Dataflow | Flink | Samza | Spark | Twister2
   --- | --- | --- | --- | --- | --- | ---
   Go | [![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/) | --- | [![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Go_VR_Flink/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Go_VR_Flink/lastCompletedBuild/) | --- | [![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Go_VR_Spark/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Go_VR_Spark/lastCompletedBuild/) | ---
   Java | [![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/) | [![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/)<br>[![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Java_VR_Dataflow_V2/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Java_VR_Dataflow_V2/lastCompletedBuild/)<br>[![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Java11/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Java11/lastCompletedBuild/) | [![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/)<br>[![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink_Java11/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink_Java11/lastCompletedBuild/)<br>[![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/)<br>[![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/) | [![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/) | [![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark/lastCompletedBuild/)<br>[![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Java_PVR_Spark_Batch/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Java_PVR_Spark_Batch/lastCompletedBuild/)<br>[![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_SparkStructuredStreaming/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_SparkStructuredStreaming/lastCompletedBuild/) | [![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Twister2/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Twister2/lastCompletedBuild/)
   Python | [![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Python36/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Python36/lastCompletedBuild/)<br>[![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Python37/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Python37/lastCompletedBuild/)<br>[![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Python38/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Python38/lastCompletedBuild/) | [![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Py_VR_Dataflow/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Py_VR_Dataflow/lastCompletedBuild/)<br>[![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Py_VR_Dataflow_V2/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Py_VR_Dataflow_V2/lastCompletedBuild/)<br>[![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Py_ValCont/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Py_ValCont/lastCompletedBuild/) | [![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_Python_PVR_Flink_Cron/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_Python_PVR_Flink_Cron/lastCompletedBuild/)<br>[![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Python_VR_Flink/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Python_VR_Flink/lastCompletedBuild/) | --- | [![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Python_VR_Spark/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Python_VR_Spark/lastCompletedBuild/) | ---
   XLang | [![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_XVR_Direct/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_XVR_Direct/lastCompletedBuild/) | [![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_XVR_Dataflow/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_XVR_Dataflow/lastCompletedBuild/) | [![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_XVR_Flink/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_XVR_Flink/lastCompletedBuild/) | --- | [![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_XVR_Spark/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_XVR_Spark/lastCompletedBuild/) | ---
   
   Pre-Commit Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   
   --- |Java | Python | Go | Website | Whitespace | Typescript
   --- | --- | --- | --- | --- | --- | ---
   Non-portable | [![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_Java_Cron/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_Java_Cron/lastCompletedBuild/) | [![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_Python_Cron/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_Python_Cron/lastCompletedBuild/)<br>[![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_PythonLint_Cron/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_PythonLint_Cron/lastCompletedBuild/)<br>[![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_PythonDocker_Cron/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_PythonDocker_Cron/lastCompletedBuild/) <br>[![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_PythonDocs_Cron/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_PythonDocs_Cron/lastCompletedBuild/) | [![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_Go_Cron/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_Go_Cron/lastCompletedBuild/) | [![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_Website_Cron/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_Website_Cron/lastCompletedBuild/) | [![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_Whitespace_Cron/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_Whitespace_Cron/lastCompletedBuild/) | [![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_Typescript_Cron/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_Typescript_Cron/lastCompletedBuild/)
   Portable | --- | [![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_Portable_Python_Cron/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_Portable_Python_Cron/lastCompletedBuild/) | --- | --- | --- | ---
   
   See [.test-infra/jenkins/README](https://github.com/apache/beam/blob/master/.test-infra/jenkins/README.md) for trigger phrase, status and link of all Jenkins jobs.
   
   
   GitHub Actions Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   [![Build python source distribution and wheels](https://github.com/apache/beam/workflows/Build%20python%20source%20distribution%20and%20wheels/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
   [![Python tests](https://github.com/apache/beam/workflows/Python%20tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Java tests](https://github.com/apache/beam/workflows/Java%20Tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
   
   See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI.
   


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


Issue Time Tracking
-------------------

            Worklog Id:     (was: 551759)
    Remaining Estimate: 0h
            Time Spent: 10m

> SDK Worker with multithreading causes boto3 the KeyError(endpoint_resolver)
> ---------------------------------------------------------------------------
>
>                 Key: BEAM-11807
>                 URL: https://issues.apache.org/jira/browse/BEAM-11807
>             Project: Beam
>          Issue Type: Bug
>          Components: io-py-aws, sdk-py-harness
>    Affects Versions: 2.28.0, 2.29.0
>            Reporter: Evgeniy
>            Priority: P2
>              Labels: AWS, S3, multi-threading
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> [https://github.com/boto/botocore/issues/1776]
> {noformat}
> Traceback (most recent call last):
>   File "/tmp/beam/sdks/python/apache_beam/runners/worker/sdk_worker.py", line 289, in _execute
>     response = task()
>   File "/tmp/beam/sdks/python/apache_beam/runners/worker/sdk_worker.py", line 362, in <lambda>
>     lambda: self.create_worker().do_instruction(request), request)
>   File "/tmp/beam/sdks/python/apache_beam/runners/worker/sdk_worker.py", line 606, in do_instruction
>     return getattr(self, request_type)(
>   File "/tmp/beam/sdks/python/apache_beam/runners/worker/sdk_worker.py", line 644, in process_bundle
>     bundle_processor.process_bundle(instruction_id))
>   File "/tmp/beam/sdks/python/apache_beam/runners/worker/bundle_processor.py", line 1000, in process_bundle
>     input_op_by_transform_id[element.transform_id].process_encoded(
>   File "/tmp/beam/sdks/python/apache_beam/runners/worker/bundle_processor.py", line 229, in process_encoded
>     self.output(decoded_value)
>   File "/tmp/beam/sdks/python/apache_beam/runners/worker/operations.py", line 359, in output
>     cython.cast(Receiver, self.receivers[output_index]).receive(windowed_value)
>   File "/tmp/beam/sdks/python/apache_beam/runners/worker/operations.py", line 221, in receive
>     self.consumer.process(windowed_value)
>   File "/tmp/beam/sdks/python/apache_beam/runners/worker/operations.py", line 719, in process
>     delayed_application = self.dofn_runner.process(o)
>   File "/tmp/beam/sdks/python/apache_beam/runners/common.py", line 1241, in process
>     self._reraise_augmented(exn)
>   File "/tmp/beam/sdks/python/apache_beam/runners/common.py", line 1239, in process
>     return self.do_fn_invoker.invoke_process(windowed_value)
>   File "/tmp/beam/sdks/python/apache_beam/runners/common.py", line 587, in invoke_process
>     self.output_processor.process_outputs(
>   File "/tmp/beam/sdks/python/apache_beam/runners/common.py", line 1401, in process_outputs
>     self.main_receivers.receive(windowed_value)
>   File "/tmp/beam/sdks/python/apache_beam/runners/worker/operations.py", line 221, in receive
>     self.consumer.process(windowed_value)
>   File "/tmp/beam/sdks/python/apache_beam/runners/worker/operations.py", line 719, in process
>     delayed_application = self.dofn_runner.process(o)
>   File "/tmp/beam/sdks/python/apache_beam/runners/common.py", line 1241, in process
>     self._reraise_augmented(exn)
>   File "/tmp/beam/sdks/python/apache_beam/runners/common.py", line 1321, in _reraise_augmented
>     raise_with_traceback(new_exn)
>   File "/home/local/.local/lib/python3.8/site-packages/future/utils/__init__.py", line 446, in raise_with_traceback
>     raise exc.with_traceback(traceback)
>   File "/tmp/beam/sdks/python/apache_beam/runners/common.py", line 1239, in process
>     return self.do_fn_invoker.invoke_process(windowed_value)
>   File "/tmp/beam/sdks/python/apache_beam/runners/common.py", line 587, in invoke_process
>     self.output_processor.process_outputs(
>   File "/tmp/beam/sdks/python/apache_beam/runners/common.py", line 1374, in process_outputs
>     for result in results:
>   File "/tmp/beam/sdks/python/apache_beam/runners/worker/bundle_processor.py", line 1426, in process
>     initial_restriction = self.restriction_provider.initial_restriction(
>   File "/tmp/beam/sdks/python/apache_beam/io/iobase.py", line 1545, in initial_restriction
>     range_tracker = element_source.get_range_tracker(None, None)
>   File "/tmp/beam/sdks/python/apache_beam/io/filebasedsource.py", line 210, in get_range_tracker
>     return self._get_concat_source().get_range_tracker(
>   File "/tmp/beam/sdks/python/apache_beam/options/value_provider.py", line 200, in _f
>     return fnc(self, *args, **kwargs)
>   File "/tmp/beam/sdks/python/apache_beam/io/filebasedsource.py", line 145, in _get_concat_source
>     match_result = FileSystems.match([pattern])[0]
>   File "/tmp/beam/sdks/python/apache_beam/io/filesystems.py", line 209, in match
>     return filesystem.match(patterns, limits)
>   File "/tmp/beam/sdks/python/apache_beam/io/filesystem.py", line 765, in match
>     raise BeamIOError("Match operation failed", exceptions)
> apache_beam.io.filesystem.BeamIOError: Match operation failed with exceptions {'s3://bucket_name/pipeline_output/pipe-name/ImportExampleGen/examples/7/train/*': BeamIOError("List operation failed with exceptions {'s3://bucket_name/pipeline_output/pipe-name/ImportExampleGen/examples/7/train/': KeyError('endpoint_resolver')}")} [while running 'TFXIOReadAndDecode[TransformIndex1]/RawRecordBeamSource/ReadRawRecords/ReadFromTFRecord[0]/Read/SDFBoundedSourceReader/ParDo(SDFBoundedSourceDoFn)/PairWithRestriction0'] with exceptions None{noformat}
> {noformat}
> Traceback (most recent call last):
>   File "/tmp/beam/sdks/python/apache_beam/runners/worker/sdk_worker.py", line 289, in _execute
>     response = task()
>   File "/tmp/beam/sdks/python/apache_beam/runners/worker/sdk_worker.py", line 362, in <lambda>
>     lambda: self.create_worker().do_instruction(request), request)
>   File "/tmp/beam/sdks/python/apache_beam/runners/worker/sdk_worker.py", line 606, in do_instruction
>     return getattr(self, request_type)(
>   File "/tmp/beam/sdks/python/apache_beam/runners/worker/sdk_worker.py", line 644, in process_bundle
>     bundle_processor.process_bundle(instruction_id))
>   File "/tmp/beam/sdks/python/apache_beam/runners/worker/bundle_processor.py", line 1000, in process_bundle
>     input_op_by_transform_id[element.transform_id].process_encoded(
>   File "/tmp/beam/sdks/python/apache_beam/runners/worker/bundle_processor.py", line 229, in process_encoded
>     self.output(decoded_value)
>   File "/tmp/beam/sdks/python/apache_beam/runners/worker/operations.py", line 359, in output
>     cython.cast(Receiver, self.receivers[output_index]).receive(windowed_value)
>   File "/tmp/beam/sdks/python/apache_beam/runners/worker/operations.py", line 221, in receive
>     self.consumer.process(windowed_value)
>   File "/tmp/beam/sdks/python/apache_beam/runners/worker/operations.py", line 838, in process
>     delayed_applications = self.dofn_runner.process_with_sized_restriction(
>   File "/tmp/beam/sdks/python/apache_beam/runners/common.py", line 1247, in process_with_sized_restriction
>     return self.do_fn_invoker.invoke_process(
>   File "/tmp/beam/sdks/python/apache_beam/runners/common.py", line 748, in invoke_process
>     residual = self._invoke_process_per_window(
>   File "/tmp/beam/sdks/python/apache_beam/runners/common.py", line 886, in _invoke_process_per_window
>     self.output_processor.process_outputs(
>   File "/tmp/beam/sdks/python/apache_beam/runners/common.py", line 1374, in process_outputs
>     for result in results:
>   File "/tmp/beam/sdks/python/apache_beam/io/tfrecordio.py", line 187, in read_records
>     with self.open_file(file_name) as file_handle:
>   File "/tmp/beam/sdks/python/apache_beam/io/filebasedsource.py", line 177, in open_file
>     return FileSystems.open(
>   File "/tmp/beam/sdks/python/apache_beam/io/filesystems.py", line 249, in open
>     return filesystem.open(path, mime_type, compression_type)
>   File "/tmp/beam/sdks/python/apache_beam/io/aws/s3filesystem.py", line 190, in open
>     return self._path_open(path, 'rb', mime_type, compression_type)
>   File "/tmp/beam/sdks/python/apache_beam/io/aws/s3filesystem.py", line 154, in _path_open
>     raw_file = s3io.S3IO(options=self._options).open(
>   File "/tmp/beam/sdks/python/apache_beam/io/aws/s3io.py", line 67, in __init__
>     self.client = boto3_client.Client(options=options)
>   File "/tmp/beam/sdks/python/apache_beam/io/aws/clients/s3/boto3_client.py", line 60, in __init__
>     self.client = boto3.client(
>   File "/home/local/.local/lib/python3.8/site-packages/boto3/__init__.py", line 93, in client
>     return _get_default_session().client(*args, **kwargs)
>   File "/home/local/.local/lib/python3.8/site-packages/boto3/session.py", line 258, in client
>     return self._session.create_client(
>   File "/home/local/.local/lib/python3.8/site-packages/botocore/session.py", line 827, in create_client
>     endpoint_resolver = self._get_internal_component('endpoint_resolver')
>   File "/home/local/.local/lib/python3.8/site-packages/botocore/session.py", line 700, in _get_internal_component
>     return self._internal_components.get_component(name)
>   File "/home/local/.local/lib/python3.8/site-packages/botocore/session.py", line 928, in get_component
>     del self._deferred[name]
> KeyError: 'endpoint_resolver'{noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)