Comments (7)
Can you share more information about how the test is set up?
I'm seeing Exception ignored
message, but we're intentionally ignore DeprecationWarning for Python 3.12.
from grpc.
googleapis/python-pubsub#1095 has reference to failure builds, if that helps.
from grpc.
I was able to re-create the resource warning with the following code. The warning only appears when using python 3.12
import grpc
from grpc import aio
print(grpc.__version__)
aio.secure_channel("http://localhost/", grpc.local_channel_credentials())
1.62.0
/usr/local/google/home/partheniou/.pyenv/versions/3.12.0/lib/python3.12/asyncio/base_events.py:703: ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False>
_warn(f"unclosed event loop {self!r}", ResourceWarning, source=self)
Object allocated at (most recent call last):
File "/usr/local/google/home/partheniou/.vscode-server/extensions/ms-python.debugpy-2024.0.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", lineno 39
cli.main()
File "/usr/local/google/home/partheniou/.vscode-server/extensions/ms-python.debugpy-2024.0.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", lineno 430
run()
File "/usr/local/google/home/partheniou/.vscode-server/extensions/ms-python.debugpy-2024.0.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", lineno 284
runpy.run_path(target, run_name="__main__")
File "/usr/local/google/home/partheniou/.vscode-server/extensions/ms-python.debugpy-2024.0.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", lineno 321
return _run_module_code(code, init_globals, run_name,
File "/usr/local/google/home/partheniou/.vscode-server/extensions/ms-python.debugpy-2024.0.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", lineno 135
_run_code(code, mod_globals, init_globals,
File "/usr/local/google/home/partheniou/.vscode-server/extensions/ms-python.debugpy-2024.0.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", lineno 124
exec(code, run_globals)
File "/usr/local/google/home/partheniou/git/python-pubsub/check.py", lineno 7
aio.secure_channel(target, grpc.local_channel_credentials())
File "/usr/local/google/home/partheniou/.pyenv/versions/3.12.0/envs/py3120env/lib/python3.12/site-packages/grpc/aio/_channel.py", lineno 597
return Channel(
File "/usr/local/google/home/partheniou/.pyenv/versions/3.12.0/envs/py3120env/lib/python3.12/site-packages/grpc/aio/_channel.py", lineno 367
self._loop = cygrpc.get_working_loop()
File "/usr/local/google/home/partheniou/.pyenv/versions/3.12.0/lib/python3.12/asyncio/events.py", lineno 716
return self._loop_factory()
from grpc.
@parthea I tried your code and not able to reproduce in both 3.12.0 and 3.12.1, is there other setup required to reproduce the issue?
from grpc.
Please can you try this code sample instead?
The following packages are needed
google-auth
requests
import grpc
from grpc import aio
print(grpc.__version__)
import google.auth
import google.auth.credentials
import google.auth.transport.grpc
import google.auth.transport.requests
default_scopes=('https://www.googleapis.com/auth/cloud-platform','https://www.googleapis.com/auth/pubsub')
credentials = google.auth.credentials.with_scopes_if_required(
google.auth.credentials.AnonymousCredentials(), scopes=[], default_scopes=default_scopes
)
request = google.auth.transport.requests.Request()
default_host='pubsub.googleapis.com'
metadata_plugin = google.auth.transport.grpc.AuthMetadataPlugin(
credentials,
request,
default_host=default_host,
)
google_auth_credentials = grpc.metadata_call_credentials(metadata_plugin)
target ='pubsub.googleapis.com:443'
grpc_creds = grpc.compute_engine_channel_credentials(google_auth_credentials)
options=[('grpc.max_send_message_length', -1), ('grpc.max_receive_message_length', -1), ('grpc.max_metadata_size', 4194304), ('grpc.keepalive_time_ms', 30000)]
aio.secure_channel(
target, grpc_creds, options
)
aio.secure_channel(
target, grpc_creds, options
)
aio.secure_channel(
target, grpc_creds, options
)
from grpc.
I see the warnings when I exit the python terminal
>>> exit()
/usr/local/lib/python3.12/asyncio/base_events.py:703: ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False>
_warn(f"unclosed event loop {self!r}", ResourceWarning, source=self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/usr/local/lib/python3.12/asyncio/base_events.py:703: ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False>
_warn(f"unclosed event loop {self!r}", ResourceWarning, source=self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
from grpc.
I can still reproduce the issue with #35974 (comment), but the warning only appears when I exit the terminal.
>>>
>>> aio.secure_channel("http://localhost/", grpc.local_channel_credentials())
<grpc.aio._channel.Channel object at 0x7fefed7d1e50>
>>> aio.secure_channel("http://localhost/", grpc.local_channel_credentials())
<grpc.aio._channel.Channel object at 0x7fefed7d0ec0>
>>> aio.secure_channel("http://localhost/", grpc.local_channel_credentials())
<grpc.aio._channel.Channel object at 0x7fefed7d1be0>
>>> aio.secure_channel("http://localhost/", grpc.local_channel_credentials())
<grpc.aio._channel.Channel object at 0x7fefed7d1e50>
>>> aio.secure_channel("http://localhost/", grpc.local_channel_credentials())
<grpc.aio._channel.Channel object at 0x7fefed7d0ec0>
>>> exit()
/usr/local/lib/python3.12/asyncio/base_events.py:703: ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False>
_warn(f"unclosed event loop {self!r}", ResourceWarning, source=self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/usr/local/lib/python3.12/asyncio/base_events.py:703: ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False>
_warn(f"unclosed event loop {self!r}", ResourceWarning, source=self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/usr/local/lib/python3.12/asyncio/base_events.py:703: ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False>
_warn(f"unclosed event loop {self!r}", ResourceWarning, source=self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/usr/local/lib/python3.12/asyncio/base_events.py:703: ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False>
_warn(f"unclosed event loop {self!r}", ResourceWarning, source=self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/usr/local/lib/python3.12/asyncio/base_events.py:703: ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False>
from grpc.
Related Issues (20)
- protobuf_generate_grpc_cpp_with_import_path_correction fails when using protobuf build via FetchContent HOT 2
- Systemd socket activation example does not work HOT 1
- BUG
- assertion next_bdp_ping_timer_handle kInvalid HOT 5
- Crash SIGSEGV in grpc_1.46.7 HOT 1
- [1.62.0RC1 and 1.62.0] build broken using GCC 14
- import grpc in a python file which imports a pybind11 shared object which has another set of grpc calls ( written in C++ ) causes a crash HOT 7
- dscp value set through GRPC_ARG_DSCP channel argument does not cause the socket options to be updated on the GRPC server side. HOT 2
- grpc_unsecure.lib(bdp_estimator.cc.obj) : Error LNK2001: unresolved external symbol __imp_rand... HOT 13
- We are getting 0xC0000005 in some hard to reproduce cases HOT 1
- Potential Crash in GRPC code grpc/grpc/src/core/lib/promise/activity.h HOT 5
- HelloWorld example project build fails for Windows 11 and Visual Studio
- abort() should raise grpc.RpcError HOT 3
- PollParticipantPromise and PollCompletion in core/lib/promise/party.h compile error: control reaches end of non-void function [-Werror=return-type] HOT 1
- SIGBUS error in MIPS 64 platform when tcp_annotate_error is used with GRPC_OS_ERROR HOT 2
- Minimal build option for CMake HOT 2
- Strange segfault observed since 1.59.0
- BUG: shared windows builds import/export setup not working
- Segmentation Fault pecl-gRPC-1.58.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grpc.