Skip to content

Envoy fails on Bazel CI with Bazel@HEAD #8626

Closed

Description

@buchgr

Hey @brandjon,

we are seeing a Python error with Bazel@HEAD that we are not seeing with Bazel 0.26.1

UnicodeEncodeError: 'ascii' codec can't encode character '\U0001f60e' in position 190: ordinal not in range(128)

I believe you updated the Python rules to pick python3 instead of python2 by default in master?

Executing tests from //test/extensions/filters/network/thrift_proxy:integration_test
-----------------------------------------------------------------------------
WARNING: Perftools heap leak checker is active -- Performance may suffer
[==========] Running 98 tests from 2 test suites.
[----------] Global test environment set-up.
[----------] 96 tests from TransportAndProtocol/ThriftConnManagerIntegrationTest
[ RUN      ] TransportAndProtocol/ThriftConnManagerIntegrationTest.Success/FramedBinary
ERROR:root:Unexpected exception in handler
Traceback (most recent call last):
  File "/var/lib/buildkite-agent/builds/bk-docker-spqt/bazel-downstream-projects/envoy/test/extensions/filters/network/thrift_proxy/driver/generated/example/Example.py", line 239, in process_execute
    result.success = self._handler.execute(args.input)
  File "/var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/d1c957111778f6d978cec2005bbaba74/sandbox/linux-sandbox/4808/execroot/envoy/bazel-out/k8-fastbuild/bin/test/extensions/filters/network/thrift_proxy/integration_test.runfiles/envoy/test/extensions/filters/network/thrift_proxy/driver/server.py", line 33, in execute
    print("server: execute({0})".format(param))
UnicodeEncodeError: 'ascii' codec can't encode character '\U0001f60e' in position 190: ordinal not in range(128)
client exception: 6: Internal error
test/extensions/filters/network/thrift_proxy/integration_test.cc:197: Failure
Expected equality of these values:
  1U
    Which is: 1
  counter->value()
    Which is: 0
[  FAILED  ] TransportAndProtocol/ThriftConnManagerIntegrationTest.Success/FramedBinary, where GetParam() = (4-byte object <00-00 00-00>, 4-byte object <00-00 00-00>, false) (742 ms)

Activity

  1. added
    team-Rules-Python
    on Jun 13, 2019
  2. brandjon commented on Jun 13, 2019

    @brandjon
    Member

    Yep, Python 2 vs 3 errors are likely from my change. The fix is to ensure the target properly declares itself as PY2 if that's the version its source code requires. This can be done by setting python_version = "PY2" for py_binary/py_test targets. If it's a py_binary used in the host config then you need --host_force_python=PY2. See #7899 for more migration info.

  3. assigned and unassigned on Jun 13, 2019
  4. keith commented on Jun 13, 2019

    @keith
    Member

    I should be able to fix this on the envoy side when I'm back in the office next week

  5. buchgr commented on Jun 13, 2019

    @buchgr
    ContributorAuthor

    thanks @keith!

  6. added
    untriaged
    on Jun 13, 2019
  7. lizan commented on Jun 18, 2019

    @lizan
  8. keith commented on Jun 18, 2019

    @keith
    Member

    I've submitted a PR to re-enable it on CI here bazelbuild/continuous-integration#729

  9. added a commit that references this issue on Jun 19, 2019
  10. c-parsons commented on Jun 20, 2019

    @c-parsons
    Contributor

    Since this test was re-enabled, it hasn't had a green run with Bazel@HEAD

    The errors continue to look like python issues.

      File "/var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/06fadb9199abde754fea02f0bf6240b7/sandbox/linux-sandbox/4812/execroot/envoy/bazel-out/k8-fastbuild/bin/test/extensions/filters/network/thrift_proxy/integration_test.runfiles/com_github_twitter_common_rpc/twitter/common/rpc/finagle/trace.py", line 36, in from_value
        elif isinstance(value, (int, long)):
    NameError: name 'long' is not defined
    

    and

    Traceback (most recent call last):
      File "/var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/06fadb9199abde754fea02f0bf6240b7/sandbox/linux-sandbox/4403/execroot/envoy/bazel-out/k8-fastbuild/bin/test/integration/hotrestart_test.runfiles/envoy/tools/socket_passing.py", line 13, in <module>
        import httplib
    ModuleNotFoundError: No module named 'httplib'
    

    https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/1045#18e29d9e-99e1-484b-8e11-0730630ceebf

  11. brandjon commented on Jun 20, 2019

    @brandjon
    Member

    That "client" target you updated with python_version = "PY2" appears to still be using Python 3. That probably means it's being used in the host config and you need to add --host_force_python=PY2 to the top-level bazelrc (for the "build" command).

  12. added a commit that references this issue on Jun 20, 2019
  13. keith commented on Jun 20, 2019

    @keith
    Member

    I'm trying to use that flag, but based on @lizan's PR that only set a few of our py_binary targets to PY2, so I'm not sure it will work still. envoyproxy/envoy#7337

    Is there any way we can trigger that bazel job against this PR if it does end up being green on normal envoy CI?

  14. 1 remaining item

  15. keith commented on Jun 20, 2019

    @keith
    Member

    Well my PR was merged upstream so we can wait for the next run and see if that fixed this case.

  16. meteorcloudy commented on Jun 21, 2019

    @meteorcloudy
    Member

    We have no way to trigger a CI build with Bazel@HEAD for a PR from envoy. But it's easy to get a Bazel binary built from HEAD.

    wget https://storage.googleapis.com/bazel-builds/artifacts/ubuntu1404/<bazel commit>/bazel
    
  17. removed
    untriaged
    on Jun 21, 2019
  18. assigned and unassigned on Jun 21, 2019
  19. added
    P1
    on Jun 21, 2019
  20. brandjon commented on Jun 25, 2019

    @brandjon
    Member

    @keith, looks like the httplib failure is still there at head, which is why the downstream pipeline hasn't picked up your other change.

    File "/var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/ec321eb2cc2d0f8f91b676b6d4c66c29/sandbox/linux-sandbox/4706/execroot/envoy/bazel-out/k8-fastbuild/bin/test/integration/hotrestart_test.runfiles/envoy/tools/socket_passing.py", line 13, in
    import httplib
    ModuleNotFoundError: No module named 'httplib'

    It sounds like socket_passing needs to be declared python_version = "PY2".

  21. brandjon commented on Jun 25, 2019

    @brandjon
    Member

    See also this comment about how to ensure httplib is available in the Python environment. But it sounds like you already have httplib available for PY2 and just need to make this target PY2.

  22. keith commented on Jun 25, 2019

    @keith
    Member

    This should be fixed by envoyproxy/envoy#7391

  23. keith commented on Jun 26, 2019

    @keith
    Member

    Envoy CI is now on 0.27.0, so I'm hoping we're good on the next bazel CI run now

  24. meteorcloudy commented on Jun 27, 2019

    @meteorcloudy
    Member

    Envoy is green on Bazel CI! Thanks for the fix!

  25. added a commit that references this issue on Jul 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1team-Rules-Pythontype: support / not a bug (process)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions