When I use beanstalkc with gevent, I hit the error
[E 160217 14:26:01 event:37 f5e11774ac61efb21a5b9e64006c544d:10] This socket is already used by another greenlet: <bound method Waiter.switch of <gevent.hub.Waiter object at 0x7fe0e514fc30>>
Traceback (most recent call last):
File "/data/apps/owl/owl/api/event.py", line 35, in create_event
beanstalk.put(job)
File "/data/apps/owl/owl/beanstalk.py", line 58, in put
self._conn.put(json_encode(job), delay=delay)
File "/data/apps/owl/eggs/beanstalkc-0.4.0-py2.7.egg/beanstalkc.py", line 136, in put
['INSERTED'], ['JOB_TOO_BIG','BURIED','DRAINING'])
File "/data/apps/owl/eggs/beanstalkc-0.4.0-py2.7.egg/beanstalkc.py", line 110, in _interact_value
return self._interact(command, expected_ok, expected_err)[0]
File "/data/apps/owl/eggs/beanstalkc-0.4.0-py2.7.egg/beanstalkc.py", line 87, in _interact
status, results = self._read_response()
File "/data/apps/owl/eggs/beanstalkc-0.4.0-py2.7.egg/beanstalkc.py", line 96, in _read_response
line = SocketError.wrap(self._socket_file.readline)
File "/data/apps/owl/eggs/beanstalkc-0.4.0-py2.7.egg/beanstalkc.py", line 41, in wrap
return wrapped_function(_args, *_kwargs)
File "/usr/local/lib/python2.7/socket.py", line 447, in readline
data = self._sock.recv(self._rbufsize)
File "/data/apps/owl/eggs/gevent-1.0.2-py2.7-linux-x86_64.egg/gevent/socket.py", line 394, in recv
self._wait(self._read_event)
File "/data/apps/owl/eggs/gevent-1.0.2-py2.7-linux-x86_64.egg/gevent/socket.py", line 294, 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 0x7fe0e514fc30>>
I think we can add a threading-safe connection pool to solve it, thanks
When I use beanstalkc with gevent, I hit the error
I think we can add a threading-safe connection pool to solve it, thanks