curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: epoll() request drop issue

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 24 Jul 2017 18:44:39 +0200 (CEST)

On Mon, 24 Jul 2017, Tushar Pathare via curl-library wrote:

> Thank you for the reply.

You're still top-posting and quoting a series of unrelated posts in your
email. Please don't.

> I have removed curl_multi_perform() usage in epoll() implementation and used
> only curl_multi_socket_action(), but still i'm seeing request drop.

What exactly is a "request drop" according to you?

> Also I have reviewed my implementation for error logging, I have checked the
> return value of each called libcurl library function and added error
> logging. No any error observed in complete log.

So where do the "drops" happen if they're not errors?

> I have created epoll fd and multi-curl handle at thread level to make it
> thread safe.

If I were you, I'd be careful to make it work perfectly fine in a single
thread first before I try multi-threading...

> I have one more question, in epoll_wait(), when the actual data transfer
> start?

libcurl tells you what to wait for, you wait for that and then tell libcurl
what happened. You know when you start to receive data when the write callback
gets called!

> curl_multi_socket_action(multi, CURL_SOCKET_TIMEOUT, ev_bitmask,
> &running_handles);

The bitmask argument has no particular meaning when the socket fd argument is
a timeout, so you can just as well pass a zero instead of a bitmask.

Also, your code you showed us didn't include any socket or timeout callbacks,
which should be two fundamental building blocks in an event-based libcurl
using app.

> while(running_handles > 0 && waiting_time > 0) {
> struct epoll_event events[MAX_EVENTS];
> event_count = epoll_wait(epoll_fd, events, MAX_EVENTS, waiting_time);

What's MAX_EVENTS? That looks like a fixed value which seems very odd.

Are you setting the waiting_time with the timeout callback?

> for(it = 0; it < event_count; it++) {
> curl_multi_socket_action(multi, events[it].data.fd, ev_bitmask,
> &running_handles);

The ev_bitmask looks weird here. It should tell libcurl what event that
happened on each individual socket. It seems unlikely that numerous sockets
all had the same event at the same time...

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2017-07-24