We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
free(): invalid pointer Aborted error when importing from google.cloud import bigquery  in python
I started facing this peculiar issue  while import importing BigQuery in python scripts as well as in the terminal. 
Can anyone help me out here?
I even tried to downgrade the bigquery package from 2.20 to 2.1 its still give me the same error

```
root@f6968ce75f9d:~# python 
Python 3.7.10 (default, May 28 2021, 10:36:10) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.cloud import bigquery
free(): invalid pointer
Aborted
```

<img width="858" alt="Screenshot 2021-06-07 at 10 31 45 PM" src="https://user-images.githubusercontent.com/20011105/121060374-2c9cb000-c7e0-11eb-8819-8153137ac41a.png">




--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setup.py`
Content:
```
1 # Copyright 2018 Google LLC
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 
15 import io
16 import os
17 
18 import setuptools
19 
20 
21 # Package metadata.
22 
23 name = "google-cloud-bigquery"
24 description = "Google BigQuery API client library"
25 
26 # Should be one of:
27 # 'Development Status :: 3 - Alpha'
28 # 'Development Status :: 4 - Beta'
29 # 'Development Status :: 5 - Production/Stable'
30 release_status = "Development Status :: 5 - Production/Stable"
31 dependencies = [
32     "google-api-core[grpc] >= 1.29.0, < 2.0.0dev",
33     "proto-plus >= 1.10.0",
34     "google-cloud-core >= 1.4.1, < 2.0dev",
35     "google-resumable-media >= 0.6.0, < 2.0dev",
36     "packaging >= 14.3",
37     "protobuf >= 3.12.0",
38     "requests >= 2.18.0, < 3.0.0dev",
39 ]
40 extras = {
41     "bqstorage": [
42         "google-cloud-bigquery-storage >= 2.0.0, <3.0.0dev",
43         # Due to an issue in pip's dependency resolver, the `grpc` extra is not
44         # installed, even though `google-cloud-bigquery-storage` specifies it
45         # as `google-api-core[grpc]`. We thus need to explicitly specify it here.
46         # See: https://github.com/googleapis/python-bigquery/issues/83 The
47         # grpc.Channel.close() method isn't added until 1.32.0.
48         # https://github.com/grpc/grpc/pull/15254
49         "grpcio >= 1.32.0, < 2.0dev",
50         "pyarrow >= 1.0.0, < 5.0dev",
51     ],
52     "pandas": ["pandas>=0.23.0", "pyarrow >= 1.0.0, < 5.0dev"],
53     "bignumeric_type": ["pyarrow >= 3.0.0, < 5.0dev"],
54     "tqdm": ["tqdm >= 4.7.4, <5.0.0dev"],
55     "opentelemetry": [
56         "opentelemetry-api >= 0.11b0",
57         "opentelemetry-sdk >= 0.11b0",
58         "opentelemetry-instrumentation >= 0.11b0",
59     ],
60 }
61 
62 all_extras = []
63 
64 for extra in extras:
65     # Exclude this extra from all to avoid overly strict dependencies on core
66     # libraries such as pyarrow.
67     # https://github.com/googleapis/python-bigquery/issues/563
68     if extra in {"bignumeric_type"}:
69         continue
70     all_extras.extend(extras[extra])
71 
72 extras["all"] = all_extras
73 
74 # Setup boilerplate below this line.
75 
76 package_root = os.path.abspath(os.path.dirname(__file__))
77 
78 readme_filename = os.path.join(package_root, "README.rst")
79 with io.open(readme_filename, encoding="utf-8") as readme_file:
80     readme = readme_file.read()
81 
82 version = {}
83 with open(os.path.join(package_root, "google/cloud/bigquery/version.py")) as fp:
84     exec(fp.read(), version)
85 version = version["__version__"]
86 
87 # Only include packages under the 'google' namespace. Do not include tests,
88 # benchmarks, etc.
89 packages = [
90     package
91     for package in setuptools.PEP420PackageFinder.find()
92     if package.startswith("google")
93 ]
94 
95 # Determine which namespaces are needed.
96 namespaces = ["google"]
97 if "google.cloud" in packages:
98     namespaces.append("google.cloud")
99 
100 
101 setuptools.setup(
102     name=name,
103     version=version,
104     description=description,
105     long_description=readme,
106     author="Google LLC",
107     author_email="googleapis-packages@google.com",
108     license="Apache 2.0",
109     url="https://github.com/googleapis/python-bigquery",
110     classifiers=[
111         release_status,
112         "Intended Audience :: Developers",
113         "License :: OSI Approved :: Apache Software License",
114         "Programming Language :: Python",
115         "Programming Language :: Python :: 3",
116         "Programming Language :: Python :: 3.6",
117         "Programming Language :: Python :: 3.7",
118         "Programming Language :: Python :: 3.8",
119         "Programming Language :: Python :: 3.9",
120         "Operating System :: OS Independent",
121         "Topic :: Internet",
122     ],
123     platforms="Posix; MacOS X; Windows",
124     packages=packages,
125     namespace_packages=namespaces,
126     install_requires=dependencies,
127     extras_require=extras,
128     python_requires=">=3.6, <3.10",
129     include_package_data=True,
130     zip_safe=False,
131 )
132
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -29,6 +29,7 @@
 # 'Development Status :: 5 - Production/Stable'
 release_status = "Development Status :: 5 - Production/Stable"
 dependencies = [
+    "grpcio >= 1.38.1, < 2.0dev",  # https://github.com/googleapis/python-bigquery/issues/695
     "google-api-core[grpc] >= 1.29.0, < 2.0.0dev",
     "proto-plus >= 1.10.0",
     "google-cloud-core >= 1.4.1, < 2.0dev",
@@ -46,7 +47,7 @@
         # See: https://github.com/googleapis/python-bigquery/issues/83 The
         # grpc.Channel.close() method isn't added until 1.32.0.
         # https://github.com/grpc/grpc/pull/15254
-        "grpcio >= 1.32.0, < 2.0dev",
+        "grpcio >= 1.38.1, < 2.0dev",
         "pyarrow >= 1.0.0, < 5.0dev",
     ],
     "pandas": ["pandas>=0.23.0", "pyarrow >= 1.0.0, < 5.0dev"],

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -29,6 +29,7 @@\n # 'Development Status :: 5 - Production/Stable'\n release_status = \"Development Status :: 5 - Production/Stable\"\n dependencies = [\n+    \"grpcio >= 1.38.1, < 2.0dev\",  # https://github.com/googleapis/python-bigquery/issues/695\n     \"google-api-core[grpc] >= 1.29.0, < 2.0.0dev\",\n     \"proto-plus >= 1.10.0\",\n     \"google-cloud-core >= 1.4.1, < 2.0dev\",\n@@ -46,7 +47,7 @@\n         # See: https://github.com/googleapis/python-bigquery/issues/83 The\n         # grpc.Channel.close() method isn't added until 1.32.0.\n         # https://github.com/grpc/grpc/pull/15254\n-        \"grpcio >= 1.32.0, < 2.0dev\",\n+        \"grpcio >= 1.38.1, < 2.0dev\",\n         \"pyarrow >= 1.0.0, < 5.0dev\",\n     ],\n     \"pandas\": [\"pandas>=0.23.0\", \"pyarrow >= 1.0.0, < 5.0dev\"],\n", "issue": "free(): invalid pointer Aborted error when importing from google.cloud import bigquery  in python\nI started facing this peculiar issue  while import importing BigQuery in python scripts as well as in the terminal. \r\nCan anyone help me out here?\r\nI even tried to downgrade the bigquery package from 2.20 to 2.1 its still give me the same error\r\n\r\n```\r\nroot@f6968ce75f9d:~# python \r\nPython 3.7.10 (default, May 28 2021, 10:36:10) \r\n[GCC 8.3.0] on linux\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> from google.cloud import bigquery\r\nfree(): invalid pointer\r\nAborted\r\n```\r\n\r\n<img width=\"858\" alt=\"Screenshot 2021-06-07 at 10 31 45 PM\" src=\"https://user-images.githubusercontent.com/20011105/121060374-2c9cb000-c7e0-11eb-8819-8153137ac41a.png\">\r\n\r\n\r\n\n", "before_files": [{"content": "# Copyright 2018 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport io\nimport os\n\nimport setuptools\n\n\n# Package metadata.\n\nname = \"google-cloud-bigquery\"\ndescription = \"Google BigQuery API client library\"\n\n# Should be one of:\n# 'Development Status :: 3 - Alpha'\n# 'Development Status :: 4 - Beta'\n# 'Development Status :: 5 - Production/Stable'\nrelease_status = \"Development Status :: 5 - Production/Stable\"\ndependencies = [\n    \"google-api-core[grpc] >= 1.29.0, < 2.0.0dev\",\n    \"proto-plus >= 1.10.0\",\n    \"google-cloud-core >= 1.4.1, < 2.0dev\",\n    \"google-resumable-media >= 0.6.0, < 2.0dev\",\n    \"packaging >= 14.3\",\n    \"protobuf >= 3.12.0\",\n    \"requests >= 2.18.0, < 3.0.0dev\",\n]\nextras = {\n    \"bqstorage\": [\n        \"google-cloud-bigquery-storage >= 2.0.0, <3.0.0dev\",\n        # Due to an issue in pip's dependency resolver, the `grpc` extra is not\n        # installed, even though `google-cloud-bigquery-storage` specifies it\n        # as `google-api-core[grpc]`. We thus need to explicitly specify it here.\n        # See: https://github.com/googleapis/python-bigquery/issues/83 The\n        # grpc.Channel.close() method isn't added until 1.32.0.\n        # https://github.com/grpc/grpc/pull/15254\n        \"grpcio >= 1.32.0, < 2.0dev\",\n        \"pyarrow >= 1.0.0, < 5.0dev\",\n    ],\n    \"pandas\": [\"pandas>=0.23.0\", \"pyarrow >= 1.0.0, < 5.0dev\"],\n    \"bignumeric_type\": [\"pyarrow >= 3.0.0, < 5.0dev\"],\n    \"tqdm\": [\"tqdm >= 4.7.4, <5.0.0dev\"],\n    \"opentelemetry\": [\n        \"opentelemetry-api >= 0.11b0\",\n        \"opentelemetry-sdk >= 0.11b0\",\n        \"opentelemetry-instrumentation >= 0.11b0\",\n    ],\n}\n\nall_extras = []\n\nfor extra in extras:\n    # Exclude this extra from all to avoid overly strict dependencies on core\n    # libraries such as pyarrow.\n    # https://github.com/googleapis/python-bigquery/issues/563\n    if extra in {\"bignumeric_type\"}:\n        continue\n    all_extras.extend(extras[extra])\n\nextras[\"all\"] = all_extras\n\n# Setup boilerplate below this line.\n\npackage_root = os.path.abspath(os.path.dirname(__file__))\n\nreadme_filename = os.path.join(package_root, \"README.rst\")\nwith io.open(readme_filename, encoding=\"utf-8\") as readme_file:\n    readme = readme_file.read()\n\nversion = {}\nwith open(os.path.join(package_root, \"google/cloud/bigquery/version.py\")) as fp:\n    exec(fp.read(), version)\nversion = version[\"__version__\"]\n\n# Only include packages under the 'google' namespace. Do not include tests,\n# benchmarks, etc.\npackages = [\n    package\n    for package in setuptools.PEP420PackageFinder.find()\n    if package.startswith(\"google\")\n]\n\n# Determine which namespaces are needed.\nnamespaces = [\"google\"]\nif \"google.cloud\" in packages:\n    namespaces.append(\"google.cloud\")\n\n\nsetuptools.setup(\n    name=name,\n    version=version,\n    description=description,\n    long_description=readme,\n    author=\"Google LLC\",\n    author_email=\"googleapis-packages@google.com\",\n    license=\"Apache 2.0\",\n    url=\"https://github.com/googleapis/python-bigquery\",\n    classifiers=[\n        release_status,\n        \"Intended Audience :: Developers\",\n        \"License :: OSI Approved :: Apache Software License\",\n        \"Programming Language :: Python\",\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"Operating System :: OS Independent\",\n        \"Topic :: Internet\",\n    ],\n    platforms=\"Posix; MacOS X; Windows\",\n    packages=packages,\n    namespace_packages=namespaces,\n    install_requires=dependencies,\n    extras_require=extras,\n    python_requires=\">=3.6, <3.10\",\n    include_package_data=True,\n    zip_safe=False,\n)\n", "path": "setup.py"}], "after_files": [{"content": "# Copyright 2018 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport io\nimport os\n\nimport setuptools\n\n\n# Package metadata.\n\nname = \"google-cloud-bigquery\"\ndescription = \"Google BigQuery API client library\"\n\n# Should be one of:\n# 'Development Status :: 3 - Alpha'\n# 'Development Status :: 4 - Beta'\n# 'Development Status :: 5 - Production/Stable'\nrelease_status = \"Development Status :: 5 - Production/Stable\"\ndependencies = [\n    \"grpcio >= 1.38.1, < 2.0dev\",  # https://github.com/googleapis/python-bigquery/issues/695\n    \"google-api-core[grpc] >= 1.29.0, < 2.0.0dev\",\n    \"proto-plus >= 1.10.0\",\n    \"google-cloud-core >= 1.4.1, < 2.0dev\",\n    \"google-resumable-media >= 0.6.0, < 2.0dev\",\n    \"packaging >= 14.3\",\n    \"protobuf >= 3.12.0\",\n    \"requests >= 2.18.0, < 3.0.0dev\",\n]\nextras = {\n    \"bqstorage\": [\n        \"google-cloud-bigquery-storage >= 2.0.0, <3.0.0dev\",\n        # Due to an issue in pip's dependency resolver, the `grpc` extra is not\n        # installed, even though `google-cloud-bigquery-storage` specifies it\n        # as `google-api-core[grpc]`. We thus need to explicitly specify it here.\n        # See: https://github.com/googleapis/python-bigquery/issues/83 The\n        # grpc.Channel.close() method isn't added until 1.32.0.\n        # https://github.com/grpc/grpc/pull/15254\n        \"grpcio >= 1.38.1, < 2.0dev\",\n        \"pyarrow >= 1.0.0, < 5.0dev\",\n    ],\n    \"pandas\": [\"pandas>=0.23.0\", \"pyarrow >= 1.0.0, < 5.0dev\"],\n    \"bignumeric_type\": [\"pyarrow >= 3.0.0, < 5.0dev\"],\n    \"tqdm\": [\"tqdm >= 4.7.4, <5.0.0dev\"],\n    \"opentelemetry\": [\n        \"opentelemetry-api >= 0.11b0\",\n        \"opentelemetry-sdk >= 0.11b0\",\n        \"opentelemetry-instrumentation >= 0.11b0\",\n    ],\n}\n\nall_extras = []\n\nfor extra in extras:\n    # Exclude this extra from all to avoid overly strict dependencies on core\n    # libraries such as pyarrow.\n    # https://github.com/googleapis/python-bigquery/issues/563\n    if extra in {\"bignumeric_type\"}:\n        continue\n    all_extras.extend(extras[extra])\n\nextras[\"all\"] = all_extras\n\n# Setup boilerplate below this line.\n\npackage_root = os.path.abspath(os.path.dirname(__file__))\n\nreadme_filename = os.path.join(package_root, \"README.rst\")\nwith io.open(readme_filename, encoding=\"utf-8\") as readme_file:\n    readme = readme_file.read()\n\nversion = {}\nwith open(os.path.join(package_root, \"google/cloud/bigquery/version.py\")) as fp:\n    exec(fp.read(), version)\nversion = version[\"__version__\"]\n\n# Only include packages under the 'google' namespace. Do not include tests,\n# benchmarks, etc.\npackages = [\n    package\n    for package in setuptools.PEP420PackageFinder.find()\n    if package.startswith(\"google\")\n]\n\n# Determine which namespaces are needed.\nnamespaces = [\"google\"]\nif \"google.cloud\" in packages:\n    namespaces.append(\"google.cloud\")\n\n\nsetuptools.setup(\n    name=name,\n    version=version,\n    description=description,\n    long_description=readme,\n    author=\"Google LLC\",\n    author_email=\"googleapis-packages@google.com\",\n    license=\"Apache 2.0\",\n    url=\"https://github.com/googleapis/python-bigquery\",\n    classifiers=[\n        release_status,\n        \"Intended Audience :: Developers\",\n        \"License :: OSI Approved :: Apache Software License\",\n        \"Programming Language :: Python\",\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"Operating System :: OS Independent\",\n        \"Topic :: Internet\",\n    ],\n    platforms=\"Posix; MacOS X; Windows\",\n    packages=packages,\n    namespace_packages=namespaces,\n    install_requires=dependencies,\n    extras_require=extras,\n    python_requires=\">=3.6, <3.10\",\n    include_package_data=True,\n    zip_safe=False,\n)\n", "path": "setup.py"}]}