Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'cancel' #1720

Closed
julien-duponchelle opened this issue Mar 16, 2017 · 3 comments
Closed
Labels

Comments

@julien-duponchelle
Copy link
Contributor

Long story short

With recent 1.3 release we start to receive this kind of crash report.

AttributeError: 'NoneType' object has no attribute 'cancel'
  File "gns3server/controller/compute.py", line 502, in _run_http_query
    response = yield from self._session().request(method, url, headers=headers, data=data, auth=self._auth, chunked=chunked, timeout=timeout)
  File "aiohttp/client.py", line 583, in __iter__
    resp = yield from self._coro
  File "aiohttp/client.py", line 279, in _request
    resp.connection.add_callback(handle.cancel)

AttributeError: 'NoneType' object has no attribute 'cancel'

The problem start with this commit: 4be5043

The problem seem to arrive when we pass timeout=None to request. But it doesn't seem to be always the case.

The problem in _request is if you pass None to the TimeoutHandle you will get a None handle

# timeout is cumulative for all request operations
# (request, redirects, responses, data consuming)
tm = TimeoutHandle(timeout)
handle = tm.handle(self._loop)

And we will use this handle later:

        if resp.connection is not None:
            resp.connection.add_callback(handle.cancel)
        else:
            handle.cancel()

The code of handle in TimeoutHandle:

    def handle(self, loop):
        if self._timeout is not None and self._timeout > 0:
            at = ceil(loop.time() + self._timeout)
            return loop.call_at(at, self.__call__)

Is it wrong to pass None as a timeout?

fafhrd91 added a commit that referenced this issue Mar 16, 2017
@fafhrd91
Copy link
Member

fixed, I will make new release today

@julien-duponchelle
Copy link
Contributor Author

Thanks!

@lock
Copy link

lock bot commented Oct 28, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants