Actually, I meet two kind of crash, “pthread_create failed" and “out of memory”.
But it’s kind of a heisenbug, I can’t always reproduce it. 
> 在 2017年1月7日,下午2:14,Michael Jones <michael.jo...@gmail.com> 写道:
> 
> It is difficult imagine "pthread_create failed" as the result of too many 
> goroutines.
> 
> On Fri, Jan 6, 2017 at 8:11 PM, Hoping White <baihaop...@gmail.com 
> <mailto:baihaop...@gmail.com>> wrote:
> Hi, all
> 
> I’m writing a chat server like program, and I must make a decision now.
> My business includes two kind of things:
> 1. request->response
> 2. push message
> 
> One solution is like every connection has 3 goroutines:
> 1. for read request
> 2. for write response
> 3. for execute request
> 
> But this kind of solution will cause too much goroutines. I have seen 
> “pthread_create failed”
> already. I digged net/rpc package code, and found that, rpc only use a long 
> run goroutine for
> read, and a short term routine for excuting request, and it has no push 
> requirement.
> 
> So there is another solution maybe
> 1 long run routine for read request
> 1 short term routine for execute request (request should be sequenced, how?)
> 1 short term routine for write response (response should be sequenced, how?)
> 
> My question is, is short term routine is a better practice than long run 
> ones. If so,
> how to meet the sequence requirement?
> 
> Thanks
> 
> --
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com 
> <mailto:golang-nuts%2bunsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.
> 
> 
> 
> -- 
> Michael T. Jones
> michael.jo...@gmail.com <mailto:michael.jo...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to