[zeromq-dev] [PATCH] Fixed OOM handling while writing to a pipe
sustrik at 250bpm.com
Fri May 20 11:57:35 CEST 2011
> In case of OOM zmq_send will return EAGAIN, because there no way to
> return other error from pipe (writer_t). Do you think it's worth fixing?
> basically means writer_t::write should return 0 and set errno instead
> of returning bool. (Or should it return ENOMEM directly?)
Yes. Definitely. If error is to be returned it should be correct error.
As for returning the error the most common POSIX practice is to return
negative number and set errno. Return value of 0 is used for success.
> Sometimes write fail even if `more` is set on previous message, this
> will trigger some assertions in zeromq code (they will be fixed in the
> future patches),
What assertions? If send fails we should revert the state to what it was
before send() was called. That shouldn't trigger any assert.
> and probably can trigger assertions in user code.
Same as above.
One additional issue: If you change function prototype to return error,
you should check the error at each place the function is called from.
More information about the zeromq-dev