pebbe / zmq4

A Go interface to ZeroMQ version 4
BSD 2-Clause "Simplified" License
1.18k stars 163 forks source link

Weird exception when I try to run http requests concurrently #69

Closed lancecarlson closed 8 years ago

lancecarlson commented 8 years ago

I'm trying to use zmq like Mongrel2 where I push/pull and pub/sub and I seem to have it working except that when I try to run ab -c 2 (or anything higher than 1), my server crashes. Any ideas? ab -c 1 -n x seems to work fine.

https://gist.github.com/lancecarlson/d1454fce1ed56f429cb2

pebbe commented 8 years ago

A Socket is not thread safe. You can't use it from more than one goroutine.

lancecarlson commented 8 years ago

Ah interesting! Are there some built on things in the library that can help me create a pool of connections in different goroutines or is this something I would have to do myself?

pebbe commented 8 years ago

You have to do it yourself.