zeromq / czmq

High-level C binding for ØMQ
czmq.zeromq.org
Mozilla Public License 2.0
1.18k stars 525 forks source link

Update zlist/zlistx header comments to indicate memory exhaustion not possible error #2266

Closed chu11 closed 1 year ago

chu11 commented 1 year ago

I noticed a few comments in the headers for zlist/zlistx that mention errors are returned on out of memory conditions. I believe those errors are no longer possible, as czmq is built with asserts to bail if any internal memory allocation fails. Apologies if I'm wrong about this.

For zlist, I just changed the example error of "out of memory" to "invalid input", which is a real possible error. For zlistx, I just removed the offending text.

sphaero commented 1 year ago

I'm not sure if you are correct. Often an assert does nothing when you do a release build. So in that case a memory exhaustion can happen.

chu11 commented 1 year ago

generally speaking you are correct, but it appears czmq builds them in. see:

https://github.com/zeromq/czmq/issues/1193

unless czmq has changed since that thread.

I can minimally confirm to have hit some asserts in some czmq classes on some other random bugs using the czmq built by redhat.

https://github.com/zeromq/czmq/issues/2144

sphaero commented 1 year ago

Yeah, wouldn't wanna do without these asserts. Sorry for the delay in merging this PR. If you are a frequent user of czmq or other 0mq projects we could use some help handling these PR's.