Hi all, To answer my own question that was a silly mistake on my side as it looks like. It was a matter of checking if the incoming vconnection was still open before asking for the Transform Output vconnection. I was checking for that right after I got called but that seems to not be enough as pointed out here: https://github.com/linkedin/atscppapi/blob/master/src/TransformationPlugin.cc#L301I previously though a connection could only be closed by the same transformation thread, but that doesn't make much sense since there are mutex for some related operations.
Thanks everybody. On Thu, Dec 5, 2013 at 9:00 AM, Daniel Morilha <dmori...@gmail.com> wrote: > Forgot to mention this is ats 402 9 and 401 7 thanks > On Dec 5, 2013 8:57 AM, "Daniel Morilha" <dmori...@gmail.com> wrote: > >> Hi, >> >> I am facing sporadic SEGFAULTS when calling TSVConnWrite from a custom >> plug-in that I am not able to easily reproduce. >> >> TSVConnWrite (connp=0x2aec640b5620, contp=0x2aec640b5da0, >> readerp=0x2aec7c110c88, nbytes=9223372036854775807) at InkAPI.cc:6258 >> >> Things make me believe this is coming from the FORCE_PLUGIN_MUTEX >> macro; if not it might be then subsequent call to vc->do_io_write(). >> >> I am able to see the contp has a "valid" mutex. >> >> Any ideas from here? Any good practices I should be taking before calling >> TSVConnWrite on my code? >> >> I am dumping a lot of data so it might ring the bells for people more >> familiar with the TS internals... >> >> Thanks in advance... >> >> >> >> >> *(gdb) bt* >> #0 0x0000000000000000 in ?? () >> #1 0x00000000004b33de in TSVConnWrite (connp=0x2aec640b5620, >> contp=0x2aec640b5da0, >> readerp=0x2aec7c110c88, nbytes=9223372036854775807) at InkAPI.cc:6258 >> #2 0x00002aec00ae11dc in write (s=9223372036854775807, r=<optimized >> out>, c=0x2aec640b5da0, >> v=<optimized out>) at ats.hpp:285 >> #3 write (r=<optimized out>, c=0x2aec640b5da0, v=<optimized out>) at >> ats.hpp:289 >> #4 Output (continuation=0x2aec640b5da0, consumer=<optimized out>, >> this=0x2aec3c03de50) at ats.hpp:1508 >> >> >> >> >> *(gdb) info line 6258* >> Line 6258 of "InkAPI.cc" >> starts at address 0x4b33c8 <TSVConnWrite(TSVConn, TSCont, >> TSIOBufferReader, int64_t)+136> >> and ends at 0x4b33e9 <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+169>. >> >> >> >> *(gdb) disas 0x00000000004b33b4,0x00000000004b3410* >> Dump of assembler code from 0x4b33b4 to 0x4b3410: >> 0x00000000004b33b4 <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+116>: callq 0x4850c8 <pthread_getspecific@plt> >> 0x00000000004b33b9 <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+121>: mov 0x18(%rbx),%rsi >> 0x00000000004b33bd <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+125>: mov %rax,%rdx >> 0x00000000004b33c0 <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+128>: mov %rsp,%rdi >> 0x00000000004b33c3 <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+131>: callq 0x4ba130 <MutexLock::set_and_take(ProxyMutex*, >> EThread*)> >> *0x00000000004b33c8* <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+136>: mov 0x0(%rbp),%rax >> 0x00000000004b33cc <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+140>: xor %r8d,%r8d >> 0x00000000004b33cf <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+143>: mov %r14,%rcx >> 0x00000000004b33d2 <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+146>: mov %r13,%rdx >> 0x00000000004b33d5 <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+149>: mov %rbx,%rsi >> 0x00000000004b33d8 <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+152>: mov %rbp,%rdi >> 0x00000000004b33db <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+155>: callq *0x18(%rax) >> *=> *0x00000000004b33de <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+158>: mov %rax,%rbx >> 0x00000000004b33e1 <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+161>: mov %rsp,%rdi >> 0x00000000004b33e4 <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+164>: callq 0x4ba5e0 <MutexLock::~MutexLock()> >> *0x00000000004b33e9* <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+169>: mov %rbx,%rax >> 0x00000000004b33ec <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+172>: mov 0x18(%rsp),%rbp >> 0x00000000004b33f1 <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+177>: mov 0x10(%rsp),%rbx >> 0x00000000004b33f6 <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+182>: mov 0x20(%rsp),%r12 >> 0x00000000004b33fb <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+187>: mov 0x28(%rsp),%r13 >> 0x00000000004b3400 <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+192>: mov 0x30(%rsp),%r14 >> 0x00000000004b3405 <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+197>: add $0x38,%rsp >> 0x00000000004b3409 <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+201>: retq >> 0x00000000004b340a <TSVConnWrite(TSVConn, TSCont, TSIOBufferReader, >> int64_t)+202>: nopw 0x0(%rax,%rax,1) >> End of assembler dump. >> >> >> >> *(gdb) info vtbl *vc* >> vtable for 'VConnection' @ 0x6adbd0 (subobject @ 0x2aec640b5620): >> [0]: 0x4bb740 <INKVConnInternal::~INKVConnInternal()> >> [1]: 0x4bb650 <INKVConnInternal::~INKVConnInternal()> >> [2]: 0x4b2390 <INKVConnInternal::do_io_read(Continuation*, long, >> MIOBuffer*)> >> *[3]: 0x4b2f70 <INKVConnInternal::do_io_write(Continuation*, long, >> IOBufferReader*, bool)>* >> [4]: 0x4b2510 <INKVConnInternal::do_io_close(int)> >> [5]: 0x4b9780 <INKVConnInternal::do_io_shutdown(ShutdownHowTo_t)> >> [6]: 0x5e8a20 <VConnection::set_continuation(VIO*, Continuation*)> >> [7]: 0x4b9310 <INKVConnInternal::reenable(VIO*)> >> [8]: 0x5e8a40 <VConnection::reenable_re(VIO*)> >> [9]: 0x4a4b20 <INKVConnInternal::get_data(int, void*)> >> [10]: 0x4a4b90 <INKVConnInternal::set_data(int, void*)> >> >> >> >> (gdb) set print object on >> (gdb) print *vc >> $1 = (INKVConnInternal) {<INKContInternal> = {<DummyVConnection> = >> {<VConnection> = {<Continuation> = {<force_VFPT_to_top> = >> {_vptr.force_VFPT_to_top = 0x6adbd0 <vtable for INKVConnInternal+16>}, >> handler = (int (Continuation::*)(Continuation * const, int, >> void *)) 0x4b9460 <INKVConnInternal::handle_event(int, void*)>, mutex >> = {m_ptr = 0x2aec28017a90}, >> link = {<SLink<Continuation>> = {next = 0x0}, prev = 0x0}}, >> lerrno = 0}, <No data fields>}, >> mdata = 0x2aec7c0bc060, >> m_event_func = 0x2aec00adfa90 <ts::continuation::(anonymous >> namespace)::handle<ts::Transaction::Transformer<(anonymous >> namespace)::SecureSearch> >(TSCont, TSEvent, void*)>, m_event_count = 1, >> m_closed = 0, >> m_deletable = 0, m_deleted = 0, m_free_magic = >> INKCONT_INTERN_MAGIC_ALIVE}, m_read_vio = { >> _cont = 0x0, nbytes = 0, ndone = 0, op = 0, buffer = {mbuf = 0x0, >> entry = 0x0}, vc_server = 0x0, >> mutex = {m_ptr = 0x0}}, m_write_vio = {_cont = 0x2aec50170750, nbytes >> = 9223372036854775807, >> ndone = 0, op = 2, buffer = {mbuf = 0x4214a00, entry = 0x4214a40}, >> vc_server = 0x2aec640b5620, >> mutex = {m_ptr = 0x2aec28017a90}}, m_output_vc = 0x2aec640bae40} >> >> >> >> >> -- >> Daniel Morilha (dmori...@gmail.com) >> > -- Daniel Morilha (dmori...@gmail.com)