Skip to content

Conversation

@mruddy
Copy link
Contributor

@mruddy mruddy commented Jul 4, 2018

According to the libzmq API docs for version 4.2.3 (the version that we currently depend on) and later:
http://api.zeromq.org/master:zmq-init is deprecated by http://api.zeromq.org/master:zmq-ctx-new
http://api.zeromq.org/master:zmq-ctx-destroy is deprecated by http://api.zeromq.org/master:zmq-ctx-term

The one I/O thread set on zmq_init is the default for zmq_ctx_new, so no further change is necessary.
I don't believe anything is changing beyond function naming with zmq_ctx_new and zmq_ctx_term -- the API docs read basically the same for the before and after functions.

I also added a log message to output the exact version of ZMQ being used by the node.

Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be called before context creation?

Copy link
Contributor Author

@mruddy mruddy Jul 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in practice, it seems that it can be. The reason why I still put it after context creation is because of this quote in the API docs at http://api.zeromq.org/master:zmq: Before using any ØMQ library functions you must create a ØMQ context.

edit: I just looked at the code. Yeah, I might have been too pedantic. As long as the API doc is not a contract, it's safe to move the call earlier: https://github.com/zeromq/libzmq/blob/master/src/zmq.cpp#L109-L114
Doesn't matter much to me. If it helps get it accepted, I'll change it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can matter if zmq_ctx_new fails for some reason, then you don't get the version in the logs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Updated, thanks!

@fanquake
Copy link
Member

fanquake commented Jul 5, 2018

@mruddy ZeroMQ 4.2.3 is currently used in the depends system, but that doesn't necessarily mean it's the minimum version required to build Core. We don't currently have a minimum required version stated in the docs, but I assume the use of these functions should introduce one.

Having a quick look at the zmq api docs, it looks like they are both available from 3.2.x onwards. I can't see mention of either in the 2.2 stable or 3.1 branches.

@mruddy
Copy link
Contributor Author

mruddy commented Jul 5, 2018

@fanquake Good point. Yep, they've been around for a while (since 2012 - 2013).

I found a mention in https://github.com/zeromq/libzmq/blob/master/NEWS in section 3.2.0 (RC1), released on 2012/06/05.

I also found that the commits for zmq_ctx_term zeromq/libzmq@edd43e1 and zmq_ctx_new zeromq/libzmq@6e71a54 have the v4.2.0 tag. So, I'd say that's at least a minimum based on those two functions with this PR applied. I think it's reasonable to require a dependency to be at least that new. There has to be some other bug that requires a newer version, right :) ?

@mruddy mruddy force-pushed the zmq-deprecation-update branch from 7a0ac39 to 7d16ac4 Compare July 5, 2018 11:18
@fanquake
Copy link
Member

fanquake commented Jul 5, 2018

In that case, please update dependencies.md with what would be the new minimum required version.

I'd also suggest combining these changes into #13578, so that the zmq bump, testing, and any minimum version requirement discussion can happen together.

@mruddy
Copy link
Contributor Author

mruddy commented Jul 6, 2018

@fanquake Sure, I'll combine this with #13578. I did more digging. We already require 4.x or later in the configure script. That aligns with Debian and Ubuntu packages for still supported releases (see https://packages.ubuntu.com/search?keywords=libzmq3-dev and https://packages.debian.org/search?keywords=libzmq3-dev). The nice thing is that the ZMQ project has repos for common distros that would make it easier for us to raise the minimum version (see http://zeromq.org/area:download and https://build.opensuse.org/repositories/network:messaging:zeromq:release-stable). Although, from what I've found, the functions that I'm switching to were around before, or with 4.0.0. We're already covered there. It's just a matter of whether to bump the minimum requirement, and if so, how far? I'm inclined to not mandate a minimum version bump right now. I do encourage using the latest version.

@mruddy mruddy closed this Jul 6, 2018
@mruddy mruddy deleted the zmq-deprecation-update branch July 6, 2018 03:25
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants