getsentry / raven-python

Raven is the legacy Python client for Sentry (getsentry.com) — replaced by sentry-python
https://sentry.io
BSD 3-Clause "New" or "Revised" License
1.68k stars 657 forks source link

Sentry responded with an error: <urlopen error timed out> (url: https://sentry.io/api/xxxx/store/) #1314

Open jaykam opened 5 years ago

jaykam commented 5 years ago

Hello @dcramer @sabricot,

I'm facing this issue randomly, Sometimes it breaks and sometimes works

I'm running it on Lambda with python 2.7 and raven 6.3.0 and certifi 2016.2.28

   File "/tmp/dependencies/raven/transport/threaded.py", line 172, in send_sync
           super(ThreadedHTTPTransport, self).send(url, data, headers)
   File "/tmp/dependencies/raven/transport/http.py", line 43, in send
            ca_certs=self.ca_certs,
    File "/tmp/dependencies/raven/utils/http.py", line 66, in urlopen
            return opener.open(url, data, timeout)
    File "/usr/lib64/python2.7/urllib2.py", line 429, in open
            response = self._open(req, data)
    File "/usr/lib64/python2.7/urllib2.py", line 447, in _open
            '_open', req)
    File "/usr/lib64/python2.7/urllib2.py", line 407, in _call_chain
             result = func(*args)
   File "/tmp/dependencies/raven/utils/http.py", line 46, in https_open
            return self.do_open(ValidHTTPSConnection, req)
   File "/usr/lib64/python2.7/urllib2.py", line 1200, in do_open
            raise URLError(err)
            URLError: <urlopen error timed out>
untitaker commented 5 years ago

Hi, please use the synchronous transport from here: https://docs.sentry.io/clients/python/transports/#sync

AWS Lambda will suspend your entire machine after a request/function call has returned which leads to weird network errors (or just missing events)

jaykam commented 5 years ago

Hey @untitaker

Thanks for your quick reply

But I'm also using this synchronous transport As you can see below

from raven import Client
from raven.transport.http import HTTPTransport

class sentryClient:
    class __sentryClient:
        def __init__(self):
            self.client = Client(sentry_dsn, extra=None,
                                     enable_breadcrumbs=False,
                                     transport=HTTPTransport)

So here I've initialized the sentry Client and passing the sync transport.

I'm getting that error 3-4 times out of 10. According to me, this is something related to raven!

untitaker commented 5 years ago

I am not sure what's going on in your code but I am pretty sure you are not using the synchronous transport, as the first line of your stacktrace is from code that belongs to the threaded one.

My best guess is that you have two clients instantiated where one of them is broken.

jaykam commented 5 years ago

@untitaker

from raven import Client

Here I'm defining the Client and I guess this is the same for all type of transport If I follow this doc https://docs.sentry.io/clients/python/transports/#sync

Can you point me out where you're saying that I've defined the two Clients