Comments (4)
Also no luck via client._set_timeout(0)
or client._handle_timeout()
.
from tornado.
Tornado has never had good support for cancellation; this is actually one of our oldest open bugs: #157 (closing this as a duplicate of that one). Currently the best you can do is just let the request run to completion and manage your timeouts and max_clients parameter accordingly.
from tornado.
@bdarnell
well, unfortunate I have to do more than your suggestions, so I am client.close()
ing the connection of CurlAsyncHTTPClient
manually.
That should be allowed, right? As the close()
method is publicly documented.
That closing works fine except that I run into follow up errors with new instances of the client:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/tornado/http1connection.py", line 735, in _server_request_loop
ret = yield conn.read_response(request_delegate)
File "/usr/lib/python3/dist-packages/tornado/gen.py", line 1133, in run
value = future.result()
File "/usr/lib/python3/dist-packages/tornado/gen.py", line 1147, in run
yielded = self.gen.send(value)
File "/usr/lib/python3/dist-packages/tornado/http1connection.py", line 245, in _read_message
self.stream.set_close_callback(self._on_connection_close)
File "/usr/lib/python3/dist-packages/tornado/iostream.py", line 606, in set_close_callback
self._maybe_add_error_listener()
File "/usr/lib/python3/dist-packages/tornado/iostream.py", line 1128, in _maybe_add_error_listener
self._add_io_state(ioloop.IOLoop.READ)
File "/usr/lib/python3/dist-packages/tornado/iostream.py", line 1158, in _add_io_state
self.fileno(), self._handle_events, self._state)
File "/usr/lib/python3/dist-packages/tornado/platform/asyncio.py", line 76, in add_handler
raise ValueError("fd %s added twice" % fd)
ValueError: fd 17 added twice
Could it be that the close()
doesn't unregister the socket from asyncio and if the same file descriptor number is then re-used by the kernel the above exception happens?
Is there some call I should do to unregister the socket(s)?
I think curl should already do this via:
self._multi.setopt(pycurl.M_SOCKETFUNCTION, self._handle_socket)
and
115 if event == pycurl.POLL_REMOVE:
116 if fd in self._fds:
117 self.io_loop.remove_handler(fd)
118 del self._fds[fd]
from tornado.
CurlAsyncHTTPClient.close
is documented, but it's not very well tested; in particular I don't think I've ever tested closing an HTTP client unless either there are no active requests or the entire process is terminating. So it looks like you've found a bug; I don't know what's required to close out an active curl http client cleanly.
from tornado.
Related Issues (20)
- ERROR An open stream object is being garbage collected HOT 3
- Test failures with Python 3.12 b1 & b2 HOT 1
- locale doesn't preserve territory and doesn't do error handling
- Assertion errors causing exceptions that kill Jupyter kernels HOT 3
- Header: 'latin-1' codec can't encode characters
- WSGI support HOT 1
- AttributeError: '_NullFuture' object has no attribute 'add_done_callback' HOT 5
- Patch to compile on gnu/hurd HOT 1
- public way to disable atexit callback for AddThreadSelectorEventLoop HOT 3
- support IOLoop.close() when called after asyncio.run HOT 1
- Docker + tornado.ioloop.IOLoop.current().start() HOT 2
- RFE: please start making github releases HOT 4
- wsgi: Overloaded thread pool blocks longer than expected HOT 2
- Incorrect header validation HOT 3
- RFE: please start making github releases HOT 2
- Exclude test files from install HOT 6
- Incorrect type annotation on chain_future method
- Python 3.12 manylinux wheels HOT 2
- tornado 6.3.3 with gevent 23.7.0 hangup HOT 1
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 tornado.