Hello.
I'm using sunburnt in a web application, and I'm reusing a sunburnt.SolrInterface object across different requests. This means that it will be used concurrently by many threads (in this case, Greenlets). Is this object safe to be used this way?
I'm asking this because I've recently caught an exception that seems to indicate otherwise.
File "/servers/python-environments/discosite/local/lib/python2.7/site-packages/sunburnt/sunburnt.py", line 175, in add
self.conn.update(str(update_message), **kwargs)
File "/servers/python-environments/discosite/local/lib/python2.7/site-packages/sunburnt/sunburnt.py", line 63, in update
headers=headers)
File "/servers/python-environments/discosite/local/lib/python2.7/site-packages/sunburnt/sunburnt.py", line 33, in request
return self.http_connection.request(*args, **kwargs)
File "/servers/python-environments/discosite/local/lib/python2.7/site-packages/httplib2/__init__.py", line 1544, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "/servers/python-environments/discosite/local/lib/python2.7/site-packages/httplib2/__init__.py", line 1294, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "/servers/python-environments/discosite/local/lib/python2.7/site-packages/httplib2/__init__.py", line 1231, in _conn_reques
conn.request(method, request_uri, body, headers)
File "/usr/lib/python2.7/httplib.py", line 962, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.7/httplib.py", line 996, in _send_request
self.endheaders(body)
File "/usr/lib/python2.7/httplib.py", line 958, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 818, in _send_output
self.send(msg)
File "/usr/lib/python2.7/httplib.py", line 794, in send
self.sock.sendall(data)
File "/servers/python-environments/discosite/local/lib/python2.7/site-packages/gevent/socket.py", line 478, in sendall
data_sent += self.send(_get_memory(data, data_sent), flags)
File "/servers/python-environments/discosite/local/lib/python2.7/site-packages/gevent/socket.py", line 456, in send
self._wait(self._write_event)
File "/servers/python-environments/discosite/local/lib/python2.7/site-packages/gevent/socket.py", line 290, in _wait
assert watcher.callback is None, 'This socket is already used by another greenlet: %r' % (watcher.callback, )
AssertionError: This socket is already used by another greenlet: <bound method Waiter.switch of <gevent.hub.Waiter object at 0x4a41cd0>>
Is seems that multiple threads tried to use the same socket.
Does this mean that I can't share the sunburnt.SolrInterface object and have to create a new one per-request?