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

Create HTTP Lookup for CPP Client #307

Closed
jai1 opened this issue Mar 22, 2017 · 6 comments
Closed

Create HTTP Lookup for CPP Client #307

jai1 opened this issue Mar 22, 2017 · 6 comments
Assignees
Labels
type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
Milestone

Comments

@jai1
Copy link
Contributor

jai1 commented Mar 22, 2017

In order to do a smooth production roll out we want to bring HTTP Lookup in CPP Client - using libcurl.

@jai1 jai1 added c++ type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages labels Mar 22, 2017
@jai1 jai1 added this to the 1.17 milestone Mar 22, 2017
@jai1 jai1 self-assigned this Mar 22, 2017
@jai1
Copy link
Contributor Author

jai1 commented Mar 22, 2017

Can't use boost::asio since we are using bost 1.41 which doesn't have support for native handle

@merlimat merlimat modified the milestones: 1.17, 1.18 Mar 31, 2017
@jai1
Copy link
Contributor Author

jai1 commented Apr 2, 2017

@saandrews @msb-at-yahoo
I was able to get libcurl (Version 7.19.7) with boost (Version 1.41) using curl_multi_socket_action -
https://github.com/jai1/CPlusPlus-Learn/blob/master/curlExamples/old_curl_asio_without_socket_reuse.cpp

but when I ran it with valgrind I saw memory leaks https://gist.github.com/jai1/950d93198eea07ab5522833b40bfd9f6

I think this is an issue with the old curl library since
a. I saw checked curl github issues where someone complained about similar memory leak and was instructed to use the new library version.
b. I built and linked the code to the latest version curl library - I see no leaks.

So I am going ahead with Matteo's suggestion and creating a thread pool with block curl calls (using easy interface). Let me know if you want me to change the approach.

@msb-at-yahoo
Copy link
Contributor

i suggest you default the thread pool size to 1.

@jai1
Copy link
Contributor Author

jai1 commented Apr 4, 2017

I ran into this issue with libcurl - https://www.redhat.com/archives/libvir-list/2012-October/msg00210.html

#0 0x00007ffff68ab70b in addbyter (output=110, data=0x7fffcabfbca0) at /home/jai1/curl-master/lib/mprintf.c:998
#1 0x00007ffff68aa543 in dprintf_formatf (data=0x7fffcabfbca0, stream=0x7ffff68ab6d2 , format=0x7ffff68ea1e1 "name lookup timed out", ap_save=0x7fffcabfbce0)
at /home/jai1/curl-master/lib/mprintf.c:631
#2 0x00007ffff68ab78b in curl_mvsnprintf (buffer=0x0, maxlength=16384, format=0x7ffff68ea1e1 "name lookup timed out", ap_save=0x7fffcabfbce0) at /home/jai1/curl-master/lib/mprintf.c:1016
#3 0x00007ffff688df85 in Curl_failf (data=0x8bc530, fmt=0x7ffff68ea1e1 "name lookup timed out") at /home/jai1/curl-master/lib/sendf.c:248
#4 0x00007ffff687ec72 in Curl_resolv_timeout (conn=0x7ffff737bf3f, hostname=0x7fffcabfbe20 "@\276\277\312\377\177", port=32767, entry=0x7fffb0019368, timeoutms=140737341013673)
at /home/jai1/curl-master/lib/hostip.c:622
#5 0x00000000008d9b58 in ?? ()
#6 0x00007fffcabfbfd0 in ?? ()

@merlimat
Copy link
Contributor

merlimat commented Apr 4, 2017

@jai1 Did you see these tips for libcurl in multi-thread apps?
https://curl.haxx.se/libcurl/c/threadsafe.html

@jai1
Copy link
Contributor Author

jai1 commented Apr 4, 2017

@msb-at-yahoo @merlimat

  • Sorry to cause a storm in a teacup, I had not read the document that Matteo sent

The implementation is done and passes the cms-qa tests - can you please review it and give a +1.
#317

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
Projects
None yet
Development

No branches or pull requests

3 participants