protobuf 4 causes segmentation fault on Python 3.8 in unit test
Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/59643">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/59643">No</a>

<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Bug

### Have you reproduced the bug with TF nightly?

Yes

### Source

source

### Tensorflow Version

git HEAD

### Custom Code

No

### OS Platform and Distribution

CentOS 7

### Mobile device

n/a

### Python version

3.8.13

### Bazel version

5.3.0

### GCC/Compiler version

10.3.0

### CUDA/cuDNN version

n/a

### GPU model and memory

n/a

### Current Behaviour?

```shell
Unit test //tensorflow/dtensor/python/tests:spmd_test_cpu fails when run with Python 3.8 and protobuf 4 is installed.
Installing protobuf 3.20.3 resolves the issue.
```


### Standalone code to reproduce the issue

```shell
bazel test --config=mkl_aarch64_threadpool --test_env=TF_ENABLE_ONEDNN_OPTS=1 --cache_test_results=no --test_timeout=500,900,-1,-1 --copt="-mtune=generic" --copt="-march=armv8-a" --copt="-O3" --build_tag_filters=-no_oss,-oss_serial,-gpu,-tpu,-benchmark-test,-v1only,-no_aarch64,-requires-gpu --test_tag_filters=-no_oss,-oss_serial,-gpu,-tpu,-benchmark-test,-v1only,-no_aarch64,-requires-gpu --build_tests_only --jobs=100 -- //tensorflow/dtensor/python/tests:spmd_test_cpu
```


### Relevant log output

```shell
Fatal Python error: Segmentation fault

Current thread 0x0000ffffb7906370 (most recent call first):
  File "/home/andrew/.cache/bazel/_bazel_andrew/c61c5f84d239689cb19a72cfde16be9f/execroot/org_tensorflow/bazel-out/aarch64-opt/bin/tensorflow/dtensor/python/tests/spmd_test_cpu.runfiles/org_tensorflow/tensorflow/python/eager/context.py", line 1108 in config
  File "/home/andrew/.cache/bazel/_bazel_andrew/c61c5f84d239689cb19a72cfde16be9f/execroot/org_tensorflow/bazel-out/aarch64-opt/bin/tensorflow/dtensor/python/tests/spmd_test_cpu.runfiles/org_tensorflow/tensorflow/python/eager/context.py", line 568 in ensure_initialized
  File "/home/andrew/.cache/bazel/_bazel_andrew/c61c5f84d239689cb19a72cfde16be9f/execroot/org_tensorflow/bazel-out/aarch64-opt/bin/tensorflow/dtensor/python/tests/spmd_test_cpu.runfiles/org_tensorflow/tensorflow/python/eager/context.py", line 1401 in remove_function
  File "/home/andrew/.cache/bazel/_bazel_andrew/c61c5f84d239689cb19a72cfde16be9f/execroot/org_tensorflow/bazel-out/aarch64-opt/bin/tensorflow/dtensor/python/tests/spmd_test_cpu.runfiles/org_tensorflow/tensorflow/python/eager/context.py", line 2739 in remove_function
  File "/home/andrew/.cache/bazel/_bazel_andrew/c61c5f84d239689cb19a72cfde16be9f/execroot/org_tensorflow/bazel-out/aarch64-opt/bin/tensorflow/dtensor/python/tests/spmd_test_cpu.runfiles/org_tensorflow/tensorflow/python/eager/polymorphic_function/monomorphic_function.py", line 172 in __del__
*** Received signal 11 ***
*** BEGIN MANGLED STACK TRACE ***
/home/andrew/.cache/bazel/_bazel_andrew/c61c5f84d239689cb19a72cfde16be9f/execroot/org_tensorflow/bazel-out/aarch64-opt/bin/tensorflow/dtensor/python/tests/spmd_test_cpu.runfiles/org_tensorflow/tensorflow/python/platform/../../../_solib_aarch64/_U_S_Stensorflow_Clibtensorflow_Uframework_Uimport_Ulib___Utensorflow/libtensorflow_framework.so.2(+0x15ae14c)[0xffff145de14c]
linux-vdso.so.1(__kernel_rt_sigreturn+0x0)[0xffffb78b07a0]
/lib64/libpthread.so.0(raise+0xac)[0xffffb71b2af4]
linux-vdso.so.1(__kernel_rt_sigreturn+0x0)[0xffffb78b07a0]
/lib64/libpython3.8.so.1.0(PyModule_GetState+0x4)[0xffffb72f9a3c]
/home/andrew/src/venv38/lib64/python3.8/site-packages/google/_upb/_message.abi3.so(+0xa390)[0xffff1527a390]
/home/andrew/src/venv38/lib64/python3.8/site-packages/google/_upb/_message.abi3.so(+0x13c9c)[0xffff15283c9c]
/lib64/libpython3.8.so.1.0(_PyObject_MakeTpCall+0x1a8)[0xffffb72ed9c0]
/lib64/libpython3.8.so.1.0(_PyEval_EvalFrameDefault+0x53f4)[0xffffb73c1114]
/lib64/libpython3.8.so.1.0(_PyEval_EvalCodeWithName+0xc8c)[0xffffb7371fe4]
/lib64/libpython3.8.so.1.0(_PyFunction_Vectorcall+0x474)[0xffffb73734b4]
/lib64/libpython3.8.so.1.0(+0x12662c)[0xffffb734662c]
/lib64/libpython3.8.so.1.0(PyObject_GetAttr+0x27c)[0xffffb7361e4c]
/lib64/libpython3.8.so.1.0(_PyEval_EvalFrameDefault+0xa08)[0xffffb73bc728]
/lib64/libpython3.8.so.1.0(_PyFunction_Vectorcall+0x1d0)[0xffffb7373210]
/lib64/libpython3.8.so.1.0(_PyEval_EvalFrameDefault+0x884)[0xffffb73bc5a4]
/lib64/libpython3.8.so.1.0(_PyFunction_Vectorcall+0x1d0)[0xffffb7373210]
/lib64/libpython3.8.so.1.0(_PyEval_EvalFrameDefault+0x884)[0xffffb73bc5a4]
/lib64/libpython3.8.so.1.0(_PyFunction_Vectorcall+0x1d0)[0xffffb7373210]
/lib64/libpython3.8.so.1.0(_PyEval_EvalFrameDefault+0x4de8)[0xffffb73c0b08]
/lib64/libpython3.8.so.1.0(_PyFunction_Vectorcall+0x1d0)[0xffffb7373210]
/lib64/libpython3.8.so.1.0(+0x133640)[0xffffb7353640]
/lib64/libpython3.8.so.1.0(+0x1f7248)[0xffffb7417248]
/lib64/libpython3.8.so.1.0(+0xcc72c)[0xffffb72ec72c]
/lib64/libpython3.8.so.1.0(_PyGC_CollectNoFail+0x38)[0xffffb745f060]
/lib64/libpython3.8.so.1.0(PyImport_Cleanup+0x394)[0xffffb745f40c]
/lib64/libpython3.8.so.1.0(Py_FinalizeEx+0x6c)[0xffffb7462c34]
/lib64/libpython3.8.so.1.0(Py_Exit+0x14)[0xffffb72cb01c]
/lib64/libpython3.8.so.1.0(+0xab060)[0xffffb72cb060]
/lib64/libpython3.8.so.1.0(+0xab0b8)[0xffffb72cb0b8]
/lib64/libpython3.8.so.1.0(PyRun_SimpleFileExFlags+0x3c4)[0xffffb72cbac0]
/lib64/libpython3.8.so.1.0(Py_RunMain+0x2b8)[0xffffb74645d0]
/lib64/libpython3.8.so.1.0(Py_BytesMain+0x3c)[0xffffb7464d1c]
/lib64/libc.so.6(__libc_start_main+0xdc)[0xffffb6f14384]
/home/andrew/src/venv38/bin/python3(+0x928)[0xaaaab41c0928]
*** END MANGLED STACK TRACE ***

*** Begin stack trace ***
        tsl::CurrentStackTrace[abi:cxx11]()

        __kernel_rt_sigreturn
        raise
        __kernel_rt_sigreturn
        PyModule_GetState


        _PyObject_MakeTpCall
        _PyEval_EvalFrameDefault
        _PyEval_EvalCodeWithName
        _PyFunction_Vectorcall

        PyObject_GetAttr
        _PyEval_EvalFrameDefault
        _PyFunction_Vectorcall
        _PyEval_EvalFrameDefault
        _PyFunction_Vectorcall
        _PyEval_EvalFrameDefault
        _PyFunction_Vectorcall
        _PyEval_EvalFrameDefault
        _PyFunction_Vectorcall



        _PyGC_CollectNoFail
        PyImport_Cleanup
        Py_FinalizeEx
        Py_Exit


        PyRun_SimpleFileExFlags
        Py_RunMain
        Py_BytesMain
        __libc_start_main

*** End stack trace ***
```
</details>