You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The message sent using publish_tcp doesn't reach the nsqd and neither does it throw an error. However, the second message I send through publish_tcp raises a gnsq.errors.NSQSocketError: [Errno 107] Socket is not connected. I think this error should be raised on the first message and not the second.
System Info
gnsq version
0.3.3
operating system and version
$ uname -a
Linux ant-Dell-n411z 3.13.0-93-generic #140-Ubuntu SMP Mon Jul 18 21:21:05 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 14.04.4 LTS
Release: 14.04
Codename: trusty
nsqd versions
I've noticed this happening on nsqd v0.3.8 (built w/go1.6.2) and nsqd v0.2.30 (built w/go1.3)
Scripts to reproduce behaviour
test_gnsq.py
fromgeventimportmonkey; monkey.patch_all()
importgnsqimportgeventdefon_error(reader, error):
print"got error %s"%errordefon_close(reader):
print"closed..."conn=gnsq.Nsqd(address="127.0.0.1", tcp_port=4150, http_port=4151)
conn.ping()
conn.connect()
conn.on_error.connect(on_error)
conn.on_close.connect(on_close)
try:
print"publising message 1"conn.publish_tcp("TestTopic", "Did you get message 1?")
print"successfully published message 1"# sleep for two minutes in main threadprint"sleeping for 1 minute and 2 seconds"gevent.sleep(62)
print"awake!"print"publishing message 2"conn.publish_tcp("TestTopic", "Did you get message 2?")
print"successfully published message 2"print"publishing message 3"conn.publish_tcp("TestTopic", "Did you get message 3?")
print"successfully published message 2"finally:
conn.close()
@wtolson after some digging, I found out that nsqd doesn't read the underlying socket, only writes.
After looking at https://github.com/wtolson/gnsq/blob/master/gnsq/reader.py , I found that I have to spawn a gevent greenlet to conn.listen , which makes sense because it needs to listen to heartbeats when idle and respond with NOP.
Is it worth making Nsqd spawn the conn.listen by itself ?
Should there be a writer abstraction just like reader which utilizies nsqd and spawns the conn.listen thread ? On closing, it gracefully kills the thread, closes stream etc.
When I connect to nsqd using
gnsq.Nsqd
, 60 seconds after the connection, I see the following on nsqd logsThe message sent using
publish_tcp
doesn't reach the nsqd and neither does it throw an error. However, the second message I send throughpublish_tcp
raises agnsq.errors.NSQSocketError: [Errno 107] Socket is not connected
. I think this error should be raised on the first message and not the second.System Info
gnsq version
0.3.3
operating system and version
nsqd versions
I've noticed this happening on
nsqd v0.3.8 (built w/go1.6.2)
andnsqd v0.2.30 (built w/go1.3)
Scripts to reproduce behaviour
test_gnsq.py
run.sh
commands and output
Alternatively, you could run
bash run.sh /usr/bin
if nsq binaries are present there.output
The entire output is available here https://gist.github.com/algrebe/5d715eb031f110905b9b2335e0ca52fe
Here are the relevant portions
The text was updated successfully, but these errors were encountered: