Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does the rockermq-client-python support IPv6? #470

Open
Jasongsq opened this issue Apr 25, 2024 · 1 comment
Open

Does the rockermq-client-python support IPv6? #470

Jasongsq opened this issue Apr 25, 2024 · 1 comment

Comments

@Jasongsq
Copy link

My rocketMQ install rocketmq v4.9.3, when I used rocketmq-client-python-2.0.0, SDK throw error like this "No route info of this topic xxx,error:"-1"", My topic name is correct and is exist in blocker。 When I access RocketMQ in an IPv4 network, there are no issues and I can send and consume messages normally. However, when connecting to RocketMQ in an IPv6 network, the above error occurs. Is this because the rockermq-client-python does not support IPv6? If I want to connect to RocketMQ over IPv6, what improvements are needed?

@ifplusor
Copy link
Contributor

ifplusor commented Apr 25, 2024

FYI:

TcpConnectStatus TcpTransport::connect(const string& strServerURL, int timeoutMillis) {
string hostname;
short port;
LOG_DEBUG("connect to [%s].", strServerURL.c_str());
if (!UtilAll::SplitURL(strServerURL, hostname, port)) {
LOG_INFO("connect to [%s] failed, Invalid url.", strServerURL.c_str());
return TCP_CONNECT_STATUS_FAILED;
}
{
std::lock_guard<std::mutex> lock(m_eventLock);
struct sockaddr_in sin;
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
try {
sin.sin_addr.s_addr = getInetAddr(hostname);
} catch (const MQClientException& e) {
LOG_INFO("connect to %s failed, %s", strServerURL.c_str(), e.what());
setTcpConnectStatus(TCP_CONNECT_STATUS_FAILED);
return TCP_CONNECT_STATUS_FAILED;
}
sin.sin_port = htons(port);
m_event.reset(EventLoop::GetDefaultEventLoop()->createBufferEvent(-1, BEV_OPT_CLOSE_ON_FREE | BEV_OPT_THREADSAFE,
m_enableSsl, m_sslPropertyFile));
m_event->setCallback(readNextMessageIntCallback, nullptr, eventCallback, shared_from_this());
m_event->setWatermark(EV_READ, 4, 0);
m_event->enable(EV_READ | EV_WRITE);
setTcpConnectStatus(TCP_CONNECT_STATUS_WAIT);
if (m_event->connect((struct sockaddr*)&sin, sizeof(sin)) < 0) {

It seems the TcpTransport::connect method is not compatible with IPv6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants