[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Fwd: Welcome to libevent-users



On Fri, Dec 04, 2015 at 03:19:08PM +0800, Anty Rao wrote:
> Hi Azat
> 
> There is not any special when enable libevent internal logging.
> I ask question on openssl mail list to verify whether it's the problem with
> openssl.
> The openssl guys said TCP will discard data on receiving RST if application
> couldn't fetch data from tcp stack in time.
> But after looking through the kernel code, linux seems don't discard data
> when receiving rst.
> I'm a little lost.

Hi Anty,

I'm not sure that discard-on-RST 100% related to this problem, however
IIUC linux has this (while I'm not sure 100% in my 15min digging):

net/ipv4/tcp_input.c::tcp_validate_incoming():
  if (th->rst) {
    /* RFC 5961 3.2 :
     * If sequence number exactly matches RCV.NXT, then
     *     RESET the connection
     * else
     *     Send a challenge ACK
     */
    if (TCP_SKB_CB(skb)->seq == tp->rcv_nxt)
      tcp_reset(sk);
    else 
      tcp_send_challenge_ack(sk);
    goto discard;
  }
...
discard:
  __kfree_skb(skb);


P.S. there are also a lot of cases like:
  if (th->rst)
    ... discard ...

Anyway, let's go back to your problem, do you have such behaviour only after
RST, in this case can you can use next things for validation:
- strace -ttt -o sample.strace -f ....
- tcpdump ...
- libevent debug log (but it will be good to have full log this time)

This is a lot of information that you can look through by your own, and also
send back (if you wish to).

Besides you can use netfilter queue to emulate such behaviour I guess, I did
something like this to reproduce behaviour of some badly written web-servers
that send RST instead of FIN --
https://github.com/azat/nfq-examples/blob/master/nfqnl_rst_fin.c
And a fix in libevent -- https://github.com/libevent/libevent/commit/0c7f0405e36c45c88139189dd4c720aa0c4903f5

And I'm not sure that this is the libevent bug already, but if you will provide
small reproducer I will definitely look into it.

Thanks,
Azat.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.