On Tuesday, October 9, 2018 at 11:08:35 AM UTC-5, Bert JW Regeer wrote: > > I would disagree, heavily. You want to create your globals once, then > fork. This way the memory used by said global can be shared between all of > the processes. Instagram even added the ability to freeze items so that > they don't go through the normal GC cycle and thus don't accidentally cause > COW on those objects: > > > https://instagram-engineering.com/copy-on-write-friendly-python-garbage-collection-ad6ed5233ddf > > > > On Oct 9, 2018, at 10:00, Tres Seaver <[email protected] > <javascript:>> wrote: > > > > On 10/09/2018 02:00 AM, Thierry Florac wrote: > > > >> And how do you handle such use case when working in a multi-process / > >> multi-hosts cluster configuration? > > > > Fork first, then run the configure step. Forking before creating > stateful > > globals is considered best practice for multi-processing. > > >
Hello, How would one handle the following? We have added the initation of the class and establish connection at config time in __init__.py config.registry.MY = MYContract() 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 10.74.11.1:25033] [Thu Nov 01 09:50:28.215271 2018] [wsgi:error] [pid 26861:tid 140425465390848] [remote 10.74.11.1:25033] Traceback (most recent call last): [Thu Nov 01 09:50:28.215277 2018] [wsgi:error] [pid 26861:tid 140425465390848] [remote 10.74.11.1:25033] 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 10.74.11.1:25033] return repr(value) [Thu Nov 01 09:50:28.215295 2018] [wsgi:error] [pid 26861:tid 140425465390848] [remote 10.74.11.1:25033] TypeError: __repr__ returned non-string (type bytes) [Thu Nov 01 09:50:28.215326 2018] [wsgi:error] [pid 26861:tid 140425465390848] [remote 10.74.11.1:25033] [Thu Nov 01 09:50:28.244058 2018] [wsgi:error] [pid 26861:tid 140425465390848] [remote 10.74.11.1:25033] 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 10.74.11.1:25033] 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 10.74.11.1:25033] (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 10.74.11.1:25033] 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 10.74.11.1:25033] (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 10.74.11.1:25033] self.send(msg) [Thu Nov 01 09:50:28.247761 2018] [wsgi:error] [pid 26861:tid 140425465390848] [remote 10.74.11.1:25033] 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 10.74.11.1:25033] self.sock.sendall(data) [Thu Nov 01 09:50:28.247792 2018] [wsgi:error] [pid 26861:tid 140425465390848] [remote 10.74.11.1:25033] ConnectionResetError: [Errno 104] Connection reset by peer Thank you Lucas -- 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/3831bc54-1b7c-4822-b73c-9702fb6cac79%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
