On Wednesday, November 28, 2018 at 11:11:55 PM UTC-6, Lukasz Szybalski wrote: > > > > On Monday, October 8, 2018 at 12:10:20 PM UTC-5, Michael Merickel wrote: >> >> If you are doing loading of data at "first run of the function" then you >> have introduced a race condition in your app where unless you do >> appropriate locking, two threads (most wsgi servers serve a request per >> thread) may both consider themselves the first run and load the data. The >> only way to do this without locks is to do things at config-time like I >> suggested before. >> > > > Hello, > How would one handle the following? > We have added the initation of the class and establish connection at > config time in > __init__.py > ' > Any ideas on how to except raven/utils/serializer/manager.py", line 76, in transform return repr(value)
and properly reset the connection in below line? config.registry.MY <http://www.google.com/url?q=http%3A%2F%2Fconfig.registry.MY&sa=D&sntz=1&usg=AFQjCNGCsuhuBMye3HiX3Aod6uwwoptJXQ> = MYContract() Thanks Lucas > This definatelly works, but now we are getting into issues where we get > connection reset by peer. I guess in the other scenerio we connected every > time, so every time we established a new connection. Now we are re-using > the connection which causes below: > How can I try/except this at the __init__.py level in the config,...or > what do I do in views.py to except and redo "config.registry.MY = > MYContract()" to fix the connection issue. > > > > [Thu Nov 01 09:50:28.215262 2018] [wsgi:error] [pid 26861:tid > 140425465390848] [remote a] > [Thu Nov 01 09:50:28.215271 2018] [wsgi:error] [pid 26861:tid > 140425465390848] [remote a] Traceback (most recent call last): > [Thu Nov 01 09:50:28.215277 2018] [wsgi:error] [pid 26861:tid > 140425465390848] [remote a] File > "zzzzzzzzzzz/raven/utils/serializer/manager.py", line 76, in transform > [Thu Nov 01 09:50:28.215283 2018] [wsgi:error] [pid 26861:tid > 140425465390848] [remote a] return repr(value) > [Thu Nov 01 09:50:28.215295 2018] [wsgi:error] [pid 26861:tid > 140425465390848] [remote a] TypeError: __repr__ returned non-string (type > bytes) > [Thu Nov 01 09:50:28.215326 2018] [wsgi:error] [pid 26861:tid > 140425465390848] [remote a] > [Thu Nov 01 09:50:28.244058 2018] [wsgi:error] [pid 26861:tid > 140425465390848] [remote a] mod_wsgi (pid=26861): Exception occurred > processing WSGI script '/zzzzzzzzzzzzz.wsgi'. > ..........l, headers=headers) > [Thu Nov 01 09:50:28.247647 2018] [wsgi:error] [pid 26861:tid > 140425465390848] [remote a] File > "zzzzzzzzzzzz/python3.5/site-packages/httplib2/__init__.py", line 1322, in > request > [Thu Nov 01 09:50:28.247653 2018] [wsgi:error] [pid 26861:tid > 140425465390848] [remote a] (response, content) = self._request(conn, > authority, uri, request_uri, method, body, headers, redirections, cachekey) > [Thu Nov 01 09:50:28.247663 2018] [wsgi:error] [pid 26861:tid > 140425465390848] [remote a] File > "/zzzzzzzzz/python3.5/site-packages/httplib2/__init__.py", line 1072, in > _request > [Thu Nov 01 09:50:28.247669 2018] [wsgi:error] [pid 26861:tid > 140425465390848] [remote a] (response, content) = > self._conn_request(conn, request_uri, method, body, headers) > > [Thu Nov 01 09:50:28.247752 2018] [wsgi:error] [pid 26861:tid > 140425465390848] [remote a] self.send(msg) > [Thu Nov 01 09:50:28.247761 2018] [wsgi:error] [pid 26861:tid > 140425465390848] [remote a] File "/usr/lib/python3.5/http/client.py", > line 908, in send > [Thu Nov 01 09:50:28.247768 2018] [wsgi:error] [pid 26861:tid > 140425465390848] [remote a] self.sock.sendall(data) > [Thu Nov 01 09:50:28.247792 2018] [wsgi:error] [pid 26861:tid > 140425465390848] [remote a] ConnectionResetError: [Errno 104] Connection > reset by peer > > Thank you > Lucas > > > > > > -- >>>>> http://lucasmanual.com/ <http://lucasmanual.com/blog/> >>>>> >>>>> >>>>> >>> -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/7d46e5ae-9971-45b7-80f0-600ebe444860%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
