question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CPP SDK did not respond to request 307 during lookup

See original GitHub issue

Describe the bug

A normal broker cluster, suppose I now create a topic with 128 partitions to ensure that each broker node is distributed with a certain number of partitions. At this time, start the cpp client to send and consume data, everything is normal.

At this point, we kill one of the brokers and restart the broker. We can see that the cpp sdk keeps reporting the following error

2021-11-19 13:39:08.838 ERROR [140028414940928] HTTPLookupService:262 | Response failed for url http://pulsar-q4822m9k7ej8.tdmq.ap-ru.public.tencenttdmq.com:8080/lookup/v2/topic/persistent/pulsar-q4822m9k7ej8/test-ns/test-topic-1-partition-82. Error Code 22
2021-11-19 13:39:13.220 ERROR [140028406548224] HTTPLookupService:262 | Response failed for url http://pulsar-q4822m9k7ej8.tdmq.ap-ru.public.tencenttdmq.com:8080/lookup/v2/topic/persistent/pulsar-q4822m9k7ej8/test-ns/test-topic-1-partition-16. Error Code 22
2021-11-19 13:39:14.291 ERROR [140028406548224] HTTPLookupService:262 | Response failed for url http://pulsar-q4822m9k7ej8.tdmq.ap-ru.public.tencenttdmq.com:8080/lookup/v2/topic/persistent/pulsar-q4822m9k7ej8/test-ns/test-topic-1-partition-50. Error Code 22
2021-11-19 13:39:15.372 ERROR [140028406548224] HTTPLookupService:262 | Response failed for url http://pulsar-q4822m9k7ej8.tdmq.ap-ru.public.tencenttdmq.com:8080/lookup/v2/topic/persistent/pulsar-q4822m9k7ej8/test-ns/test-topic-1-partition-54. Error Code 22
2021-11-19 13:39:16.451 ERROR [140028406548224] HTTPLookupService:262 | Response failed for url http://pulsar-q4822m9k7ej8.tdmq.ap-ru.public.tencenttdmq.com:8080/lookup/v2/topic/persistent/pulsar-q4822m9k7ej8/test-ns/test-topic-1-partition-58. Error Code 22
2021-11-19 13:39:18.497 ERROR [140028406548224] HTTPLookupService:262 | Response failed for url http://pulsar-q4822m9k7ej8.tdmq.ap-ru.public.tencenttdmq.com:8080/lookup/v2/topic/persistent/pulsar-q4822m9k7ej8/test-ns/test-topic-1-partition-33. Error Code 22
2021-11-19 13:39:19.238 ERROR [140028414940928] HTTPLookupService:262 | Response failed for url http://pulsar-q4822m9k7ej8.tdmq.ap-ru.public.tencenttdmq.com:8080/lookup/v2/topic/persistent/pulsar-q4822m9k7ej8/test-ns/test-topic-1-partition-88. Error Code 22
2021-11-19 13:39:19.567 ERROR [140028406548224] HTTPLookupService:262 | Response failed for url http://pulsar-q4822m9k7ej8.tdmq.ap-ru.public.tencenttdmq.com:8080/lookup/v2/topic/persistent/pulsar-q4822m9k7ej8/test-ns/test-topic-1-partition-24. Error Code 22
2021-11-19 13:39:20.343 ERROR [140028414940928] HTTPLookupService:262 | Response failed for url http://pulsar-q4822m9k7ej8.tdmq.ap-ru.public.tencenttdmq.com:8080/lookup/v2/topic/persistent/pulsar-q4822m9k7ej8/test-ns/test-topic-1-partition-89. Error Code 22
2021-11-19 13:39:21.653 ERROR [140028406548224] HTTPLookupService:262 | Response failed for url http://pulsar-q4822m9k7ej8.tdmq.ap-ru.public.tencenttdmq.com:8080/lookup/v2/topic/persistent/pulsar-q4822m9k7ej8/test-ns/test-topic-1-partition-13. Error Code 22
2021-11-19 13:39:22.722 ERROR [140028406548224] HTTPLookupService:262 | Response failed for url http://pulsar-q4822m9k7ej8.tdmq.ap-ru.public.tencenttdmq.com:8080/lookup/v2/topic/persistent/pulsar-q4822m9k7ej8/test-ns/test-topic-1-partition-12. Error Code 22
2021-11-19 13:39:23.040 ERROR [140028414940928] HTTPLookupService:262 | Response failed for url http://pulsar-q4822m9k7ej8.tdmq.ap-ru.public.tencenttdmq.com:8080/lookup/v2/topic/persistent/pulsar-q4822m9k7ej8/test-ns/test-topic-1-partition-91. Error Code 22

Since it is using HTTP Lookup service, it uses the libcurl warehouse. At this time, we use the curl command locally to simulate the processing behavior of the cpp code:

curl -i http://pulsar-q4822m9k7ej8.ap-public.com:8080/lookup/v2/topic/persistent/pulsar-q4822m9k7ej8/test-ns/test-topic-1-partition-33 -H 'Authorization: Bearer eyJrZXlJZCI6Ixxxxxx'

We got the following wrong output:

image

At this point, we continue to use curl to execute the Location returned last time, as follows:

curl -i http://1.62.3.1:1001/lookup/v2/topic/persistent/pulsar-q4822m9k7ej8/test-ns/test-topic-1-partition-30 -H 'Authorization: Bearer eyJrZXlJZCI6InB1bHNhci1xcccccxxxxx'

Output as follows:

{"brokerUrl":"pulsar://1.14.81.60:6650","httpUrl":"http://1.14.81.60:8080","nativeUrl":"pulsar://1.14.81.60:6650","netAddressJson":"pulsar://1.14.81.60:6650:6650","brokerUrlSsl":""}

Through the return value, we can see that the broker returned the correct owner broker address to the cpp client, but the cpp sdk did not respond to the 307 request, causing the lookup to continue to fail.

image

Desktop (please complete the following information):

  • CPP SDK version: 2.7.2
  • Broker version: 2.7.2

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
wolfstudycommented, Nov 19, 2021

ping @BewareMyPower PTAL thanks

0reactions
billowqiucommented, Dec 3, 2021

When restart one broker,i use tcpdump to capture packet,it show that libcurl follow new url without auth token header wecom-temp-734f584adac9a9f900e67e1ff04289ea wecom-temp-38c19b01c3bd6bba29650e0f6dba76df

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected response code 307 for GET request for local service
It's working on the emulator's chrome browser but when I call it using JsonObjectRequest inside my app it fails on 307 response code....
Read more >
AWS_CSM_ENABLED with DefaultMonitoring Does ... - GitHub
AWS_CSM_ENABLED with DefaultMonitoring Does not work because Header Look Up is case-sensitive and fails to pick up a needed key #1536.
Read more >
AWS SDK for C++ Version 1.8 is Now Generally Available
We're happy to share that version 1.8 of AWS SDK for C++ is now ... With the first request, the SDK will get...
Read more >
307 Temporary Redirect - HTTP - MDN Web Docs
HTTP 307 Temporary Redirect redirect status response code indicates that the resource requested has been temporarily moved to the URL given ...
Read more >
SDK Known Issues List - Valve Developer Community
cpp :57: error: 'SendProxy_Angles' was not declared in this scope. Ambiguous function pointer. One probable fix could be to add '0, ' before...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found