Hi Slawa, On 10/13/16 4:38 PM, Slawa Olhovchenkov wrote: > On Thu, Oct 13, 2016 at 01:56:21PM +0200, Julien Charbon wrote: >>>> Something like: >>> >>> Yes, thanks! >> >> Proposed changes added in the review: >> >> https://reviews.freebsd.org/D8211 >> >> tell me when you have three days without issue with this change. >> >>>> tcp_detach() { >>>> >>>> ... >>>> if (inp->inp_flags & INP_TIMEWAIT) { >>>> >>>> ... >>>> if (inp->inp_flags & INP_DROPPED) { >>>> >>>> in_pcbdetach(inp); >>>> if (__predict_true(tp == NULL)) { >>>> in_pcbfree(inp); >>>> } else { >>>> #ifdef INVARIANTS >>>> panic("tcp_detach: tp != NULL, That's not good because 'blah'\n"); >>>> #else >>>> log(LOG_ERR, "tcp_detach: tp != NULL, That's not good because >>>> 'blah'\n"); >>> >>> May be some more info in log can help to detect root cause of issuse? >>> I am don't know what info, may be flags or number of references? >> >> For this kind of issue, the useful part is the stacktrace. INVARIANT > > Like this? > > #ifdef KDB > kdb_backtrace(); > #endif > > as found in sys/netgraph/ng_base.c
It is overkill dtrace can do that. >> will give you that trace in the core, and without INVARIANT then it is >> better to use dtrace: >> >> $ cat tcp-twstart-dropped.d >> fbt::tcp_twstart:entry >> /args[0]->t_inpcb->inp_flags & 0x04000000/ >> { >> stack(); >> printf("INP_DROPPED in tcp_twstart: %x", args[0]->t_inpcb->inp_flags); >> } > > Same code may be insert there too, IMHO. Hmm, I don't think so: - If you have INVARIANT, the kernel will panic in tcp_twstart() or tcp_detach() and you will have everything you need to debug. - If you don't, dtrace is the right tool to use in all cases anyway. -- Julien
signature.asc
Description: OpenPGP digital signature