[trafficserver] branch master updated: Reuse TSMutex for ts_lua_http_intercept_handler (#8687)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 1d850c16b Reuse TSMutex for ts_lua_http_intercept_handler (#8687) 1d850c16b is described below commit 1d850c16bca337e97540122d4211a6a1895ab115 Author: Oknet AuthorDate: Wed Apr 6 14:17:15 2022 +0800 Reuse TSMutex for ts_lua_http_intercept_handler (#8687) --- plugins/lua/ts_lua_http_intercept.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/plugins/lua/ts_lua_http_intercept.c b/plugins/lua/ts_lua_http_intercept.c index d03bd0cbc..af8672299 100644 --- a/plugins/lua/ts_lua_http_intercept.c +++ b/plugins/lua/ts_lua_http_intercept.c @@ -22,7 +22,7 @@ static int ts_lua_http_intercept(lua_State *L); static int ts_lua_http_server_intercept(lua_State *L); static int ts_lua_http_intercept_entry(TSCont contp, TSEvent event, void *edata); -static void ts_lua_http_intercept_process(ts_lua_http_intercept_ctx *ictx, TSVConn conn); +static void ts_lua_http_intercept_process(ts_lua_http_intercept_ctx *ictx, TSCont contp, TSVConn conn); static void ts_lua_http_intercept_setup_read(ts_lua_http_intercept_ctx *ictx); static void ts_lua_http_intercept_setup_write(ts_lua_http_intercept_ctx *ictx); static int ts_lua_http_intercept_handler(TSCont contp, TSEvent event, void *edata); @@ -144,7 +144,7 @@ ts_lua_http_intercept_entry(TSCont contp, TSEvent event, void *edata) break; case TS_EVENT_NET_ACCEPT: -ts_lua_http_intercept_process(ictx, (TSVConn)edata); +ts_lua_http_intercept_process(ictx, contp, (TSVConn)edata); break; default: @@ -156,10 +156,9 @@ ts_lua_http_intercept_entry(TSCont contp, TSEvent event, void *edata) } static void -ts_lua_http_intercept_process(ts_lua_http_intercept_ctx *ictx, TSVConn conn) +ts_lua_http_intercept_process(ts_lua_http_intercept_ctx *ictx, TSCont contp, TSVConn conn) { int n; - TSCont contp; lua_State *L; TSMutex mtxp; ts_lua_cont_info *ci; @@ -167,11 +166,9 @@ ts_lua_http_intercept_process(ts_lua_http_intercept_ctx *ictx, TSVConn conn) ci = >cinfo; mtxp = ictx->cinfo.routine.mctx->mutexp; - contp = TSContCreate(ts_lua_http_intercept_handler, TSMutexCreate()); - TSContDataSet(contp, ictx); - - ci->contp = contp; ci->mutex = TSContMutexGet(contp); + ci->contp = TSContCreate(ts_lua_http_intercept_handler, TSContMutexGet(contp)); + TSContDataSet(ci->contp, ictx); ictx->net_vc = conn;
[trafficserver] branch master updated: Follow the comments in I_Thread.h, add an independent ink_thread_key for EThread. (#6288)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 89dccb5 Follow the comments in I_Thread.h, add an independent ink_thread_key for EThread. (#6288) 89dccb5 is described below commit 89dccb5cf8cb095876b8ab7b7547bfd6159899a6 Author: Oknet AuthorDate: Mon Nov 2 14:30:23 2020 +0800 Follow the comments in I_Thread.h, add an independent ink_thread_key for EThread. (#6288) With this PR, the threads in the system (that have been created using a derived class) are registered with 2 different thread keys. One key from Thread class and another key from the derived class. The EThread or a derived class maintains its own independent key. Therefore, we can obtain thread-specific data through pthread_getspecific (independent key), and directly convert void * to derived class type via static_cast. We can also obtain the base class (Thread) object through pthread_getspecific (Thread::thread_data_key) because any derived class is also registered with Thread::thread_data_key, and directly convert void * to Thread type via static_cast. With this PR, the EThread class maintains 2 thread_keys, one is inherited from Thread class, another is an independent EThread key. All EThread are registered with these 2 keys. If there is an XThread class (derived from Thread), it also maintains 2 thread_keys, one is inherited from Thread class, another is an independent XThread key. All XThread are registered with these 2 keys. If we call pthread_getspecific (Thread::thread_data_key) or pthread_getspecific (EThread key) inside an EThread, we will get the same void * pointer to the EThread object. If we perform the same operation inside an XThread, the pthread_getspecific (Thread::thread_data_key) will return a void * pointer to the XThread object, the pthread_getspecific (EThread key) will return NULL. If we perform the same operation inside an thread which is not a Thread or derived from Thread class, the this_thread() and this_xthread() will return NULL. The this_thread() always returns the result of pthread_getspecific (Thread::thread_data_key). The this_ethread() always returns the result of pthread_getspecific (EThread key). The this_xthread() always returns the result of pthread_getspecific (XThread key). Different keys mean different derived object of Thread class. --- iocore/eventsystem/I_EThread.h | 2 ++ iocore/eventsystem/I_Thread.h | 2 +- iocore/eventsystem/P_UnixEThread.h | 5 - iocore/eventsystem/UnixEThread.cc | 39 +- proxy/http2/Makefile.am| 6 +++--- 5 files changed, 48 insertions(+), 6 deletions(-) diff --git a/iocore/eventsystem/I_EThread.h b/iocore/eventsystem/I_EThread.h index d8ee534..49d74d8 100644 --- a/iocore/eventsystem/I_EThread.h +++ b/iocore/eventsystem/I_EThread.h @@ -282,6 +282,8 @@ public: // Set the tail handler. void set_tail_handler(LoopTailHandler *handler); + void set_specific() override; + /* private */ Event *schedule_local(Event *e); diff --git a/iocore/eventsystem/I_Thread.h b/iocore/eventsystem/I_Thread.h index 2ab995a..f2f1b1c 100644 --- a/iocore/eventsystem/I_Thread.h +++ b/iocore/eventsystem/I_Thread.h @@ -110,7 +110,7 @@ public: */ Ptr mutex; - void set_specific(); + virtual void set_specific(); inkcoreapi static ink_thread_key thread_data_key; diff --git a/iocore/eventsystem/P_UnixEThread.h b/iocore/eventsystem/P_UnixEThread.h index 3d34208..f95868f 100644 --- a/iocore/eventsystem/P_UnixEThread.h +++ b/iocore/eventsystem/P_UnixEThread.h @@ -34,6 +34,7 @@ #include "I_EventProcessor.h" const ink_hrtime DELAY_FOR_RETRY = HRTIME_MSECONDS(10); +extern ink_thread_key ethread_key; TS_INLINE Event * EThread::schedule_imm(Continuation *cont, int callback_event, void *cookie) @@ -186,7 +187,9 @@ EThread::schedule_spawn(Continuation *c, int ev, void *cookie) TS_INLINE EThread * this_ethread() { - return static_cast(this_thread()); + // The `dynamic_cast` has a significant performace impact (~6%). + // Reported by masaori and create PR #6281 to fix it. + return static_cast(ink_thread_getspecific(ethread_key)); } TS_INLINE EThread * diff --git a/iocore/eventsystem/UnixEThread.cc b/iocore/eventsystem/UnixEThread.cc index 06c9943..dc663ba 100644 --- a/iocore/eventsystem/UnixEThread.cc +++ b/iocore/eventsystem/UnixEThread.cc @@ -51,6 +51,35 @@ int const EThread::SAMPLE_COUNT[N_EVENT_TIMESCALES] = {10, 100, 1000}; int thread_max_heartbeat_mseconds = THREAD_MAX_HEARTBEAT_MSECONDS; +// To define a class inherits from Thread: +// 1) Define an independent ink_thread_key +// 2) Overr
[trafficserver] branch master updated (718bef4 -> fb0bf03)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git. from 718bef4 Treat objects with negative max-age CC directives as stale. (#7260) add fb0bf03 Bugfix: set a default inactivity timeout only if a read or write I/O operation was set (#7226) No new revisions were added by this update. Summary of changes: iocore/net/UnixNet.cc | 5 - 1 file changed, 4 insertions(+), 1 deletion(-)
[trafficserver] branch master updated (c3f2576 -> af7018f)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git. from c3f2576 Cleanup: remove unnecessary memset() within dns_process() (#7209) add af7018f If the weight is 0, the SRV record should be selected from the highest priority group (#7206) No new revisions were added by this update. Summary of changes: iocore/hostdb/P_HostDBProcessor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[trafficserver] branch master updated (b8eb810 -> c3f2576)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git. from b8eb810 Docs cleanup (#7210) add c3f2576 Cleanup: remove unnecessary memset() within dns_process() (#7209) No new revisions were added by this update. Summary of changes: iocore/dns/DNS.cc | 4 1 file changed, 4 deletions(-)
[trafficserver] branch master updated: We should remove whitespace from fieldname in http response due to RFC7230:3.2.4(#6793)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new b13e348 We should remove whitespace from fieldname in http response due to RFC7230:3.2.4(#6793) b13e348 is described below commit b13e348778845dd9aa08bd0fd872190897c8c0f7 Author: yangjian AuthorDate: Fri May 15 16:49:32 2020 +0800 We should remove whitespace from fieldname in http response due to RFC7230:3.2.4(#6793) --- proxy/hdrs/HTTP.cc | 12 ++-- proxy/hdrs/MIME.cc | 9 +++-- proxy/hdrs/MIME.h | 9 + proxy/hdrs/unit_tests/test_HdrUtils.cc | 6 +++--- proxy/hdrs/unit_tests/test_Hdrs.cc | 2 +- src/traffic_server/InkAPI.cc | 3 ++- 6 files changed, 24 insertions(+), 17 deletions(-) diff --git a/proxy/hdrs/HTTP.cc b/proxy/hdrs/HTTP.cc index 7f0dc82..c557172 100644 --- a/proxy/hdrs/HTTP.cc +++ b/proxy/hdrs/HTTP.cc @@ -959,8 +959,8 @@ http_parser_parse_req(HTTPParser *parser, HdrHeap *heap, HTTPHdrImpl *hh, const return PARSE_RESULT_ERROR; } - ParseResult ret = -mime_parser_parse(>m_mime_parser, heap, hh->m_fields_impl, start, end, must_copy_strings, eof, max_hdr_field_size); + ParseResult ret = mime_parser_parse(>m_mime_parser, heap, hh->m_fields_impl, start, end, must_copy_strings, eof, + false, max_hdr_field_size); // If we're done with the main parse do some validation if (ret == PARSE_RESULT_DONE) { ret = validate_hdr_host(hh); // check HOST header @@ -1116,8 +1116,8 @@ http_parser_parse_req(HTTPParser *parser, HdrHeap *heap, HTTPHdrImpl *hh, const parser->m_parsing_http = false; } - ParseResult ret = -mime_parser_parse(>m_mime_parser, heap, hh->m_fields_impl, start, end, must_copy_strings, eof, max_hdr_field_size); + ParseResult ret = mime_parser_parse(>m_mime_parser, heap, hh->m_fields_impl, start, end, must_copy_strings, eof, false, + max_hdr_field_size); // If we're done with the main parse do some validation if (ret == PARSE_RESULT_DONE) { ret = validate_hdr_host(hh); // check HOST header @@ -1287,7 +1287,7 @@ http_parser_parse_resp(HTTPParser *parser, HdrHeap *heap, HTTPHdrImpl *hh, const end= real_end; parser->m_parsing_http = false; - return mime_parser_parse(>m_mime_parser, heap, hh->m_fields_impl, start, end, must_copy_strings, eof); + return mime_parser_parse(>m_mime_parser, heap, hh->m_fields_impl, start, end, must_copy_strings, eof, true); } #endif @@ -1403,7 +1403,7 @@ http_parser_parse_resp(HTTPParser *parser, HdrHeap *heap, HTTPHdrImpl *hh, const parser->m_parsing_http = false; } - return mime_parser_parse(>m_mime_parser, heap, hh->m_fields_impl, start, end, must_copy_strings, eof); + return mime_parser_parse(>m_mime_parser, heap, hh->m_fields_impl, start, end, must_copy_strings, eof, true); } /*- diff --git a/proxy/hdrs/MIME.cc b/proxy/hdrs/MIME.cc index d5b0a3f..29ff599 100644 --- a/proxy/hdrs/MIME.cc +++ b/proxy/hdrs/MIME.cc @@ -2510,7 +2510,7 @@ mime_parser_clear(MIMEParser *parser) ParseResult mime_parser_parse(MIMEParser *parser, HdrHeap *heap, MIMEHdrImpl *mh, const char **real_s, const char *real_e, - bool must_copy_strings, bool eof, size_t max_hdr_field_size) + bool must_copy_strings, bool eof, bool remove_ws_from_field_name, size_t max_hdr_field_size) { ParseResult err; bool line_is_real; @@ -2570,8 +2570,13 @@ mime_parser_parse(MIMEParser *parser, HdrHeap *heap, MIMEHdrImpl *mh, const char // server MUST reject any received request message that contains // whitespace between a header field-name and colon with a response code // of 400 (Bad Request). +// A proxy MUST remove any such whitespace from a response message before +// fowarding the message downstream. if (is_ws(field_name.back())) { - return PARSE_RESULT_ERROR; + if (!remove_ws_from_field_name) { +return PARSE_RESULT_ERROR; + } + field_name.rtrim_if(::is_ws); } // find value first diff --git a/proxy/hdrs/MIME.h b/proxy/hdrs/MIME.h index a1e9dbc..b15d665 100644 --- a/proxy/hdrs/MIME.h +++ b/proxy/hdrs/MIME.h @@ -761,7 +761,7 @@ void mime_field_value_append(HdrHeap *heap, MIMEHdrImpl *mh, MIMEField *field, c void mime_parser_init(MIMEParser *parser); void mime_parser_clear(MIMEParser *parser); ParseResult mime_parser_parse(MIMEParser *parser, HdrHeap *heap, MIMEHdrImpl *mh, const char **real_s, const char *real_e, - bool must_co
[trafficserver] branch master updated: Fix out of bound array access in ssl_session_reuse plugin (#6235)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new e712c08 Fix out of bound array access in ssl_session_reuse plugin (#6235) e712c08 is described below commit e712c086e5447049f295b1382f1bc56ecb4b66c6 Author: Oknet Xu AuthorDate: Sat Nov 30 16:55:30 2019 +0800 Fix out of bound array access in ssl_session_reuse plugin (#6235) --- plugins/experimental/ssl_session_reuse/src/common.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/experimental/ssl_session_reuse/src/common.cc b/plugins/experimental/ssl_session_reuse/src/common.cc index 581f6f9..a43c14e 100644 --- a/plugins/experimental/ssl_session_reuse/src/common.cc +++ b/plugins/experimental/ssl_session_reuse/src/common.cc @@ -43,7 +43,7 @@ hex_str(std::string const ) hex_str[i * 2] = hex_chars[(c & 0xF0) >> 4]; hex_str[i * 2 + 1] = hex_chars[(c & 0x0F)]; } - hex_str[len] = '\0'; + hex_str[len - 1] = '\0'; return std::string(hex_str, len); }
[trafficserver] branch master updated: Don't sleep if ProtectedQueue.localQueue is not empty. (#6234)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new aa5b2ea Don't sleep if ProtectedQueue.localQueue is not empty. (#6234) aa5b2ea is described below commit aa5b2eafda2667621f443b455829ce3b5c3be0b0 Author: Oknet Xu AuthorDate: Wed Nov 27 22:28:33 2019 +0800 Don't sleep if ProtectedQueue.localQueue is not empty. (#6234) --- iocore/eventsystem/P_UnixEThread.h | 2 +- iocore/eventsystem/UnixEThread.cc | 8 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/iocore/eventsystem/P_UnixEThread.h b/iocore/eventsystem/P_UnixEThread.h index 61c7153..f074975 100644 --- a/iocore/eventsystem/P_UnixEThread.h +++ b/iocore/eventsystem/P_UnixEThread.h @@ -33,7 +33,7 @@ #include "I_EThread.h" #include "I_EventProcessor.h" -const int DELAY_FOR_RETRY = HRTIME_MSECONDS(10); +const ink_hrtime DELAY_FOR_RETRY = HRTIME_MSECONDS(10); TS_INLINE Event * EThread::schedule_imm(Continuation *cont, int callback_event, void *cookie) diff --git a/iocore/eventsystem/UnixEThread.cc b/iocore/eventsystem/UnixEThread.cc index c415a72..2913ba6 100644 --- a/iocore/eventsystem/UnixEThread.cc +++ b/iocore/eventsystem/UnixEThread.cc @@ -254,7 +254,13 @@ EThread::execute_regular() next_time = EventQueue.earliest_timeout(); ink_hrtime sleep_time = next_time - Thread::get_hrtime_updated(); if (sleep_time > 0) { - sleep_time = std::min(sleep_time, HRTIME_MSECONDS(thread_max_heartbeat_mseconds)); + if (EventQueueExternal.localQueue.empty()) { +sleep_time = std::min(sleep_time, HRTIME_MSECONDS(thread_max_heartbeat_mseconds)); + } else { +// Because of a missed lock, Timed-Event and Negative-Event have been pushed into localQueue for retry in awhile. +// Therefore, we have to set the limitation of sleep time in order to handle the next retry in time. +sleep_time = std::min(sleep_time, DELAY_FOR_RETRY); + } ++(current_metric->_wait); } else { sleep_time = 0;
[trafficserver] branch master updated: Correct handle the value return from mgmt socket read and write (#6220)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 2449069 Correct handle the value return from mgmt socket read and write (#6220) 2449069 is described below commit 244906904ac08c25924318e4b0aecdf1292302b3 Author: Oknet Xu AuthorDate: Thu Nov 21 21:22:06 2019 +0800 Correct handle the value return from mgmt socket read and write (#6220) --- mgmt/utils/MgmtUtils.cc | 39 +++ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/mgmt/utils/MgmtUtils.cc b/mgmt/utils/MgmtUtils.cc index aa007af..010fc7b 100644 --- a/mgmt/utils/MgmtUtils.cc +++ b/mgmt/utils/MgmtUtils.cc @@ -70,11 +70,7 @@ mgmt_readline(int soc, char *buf, int maxlen) break; } } else if (rc == 0) { - if (n == 1) { /* EOF */ -return 0; - } else { -break; - } + return n; } else { /* Error */ if (errno == ECONNRESET || errno == EPIPE) { return n ? n : 0; @@ -105,24 +101,39 @@ mgmt_readline(int soc, char *buf, int maxlen) int mgmt_writeline(int soc, const char *data, int nbytes) { - int nleft, n; + int nleft, n = 0; const char *tmp = data; nleft = nbytes; while (nleft > 0) { int nwritten = write_socket(soc, tmp, nleft); -if (nwritten <= 0) { /* Error or nothing written */ +if (nwritten == 0) { // Nothing written + mgmt_sleep_msec(1); + continue; +} else if (nwritten < 0) { // Error + if (mgmt_transient_error()) { +mgmt_sleep_msec(1); +continue; + } + return nwritten; } nleft -= nwritten; tmp += nwritten; } - if ((n = write_socket(soc, "\n", 1)) <= 0) { /* Terminating newline */ -if (n < 0) { + while (n != 1) { +n = write_socket(soc, "\n", 1); /* Terminating newline */ +if (n == 0) { + mgmt_sleep_msec(1); + continue; +} else if (n < 0) { // Error + if (mgmt_transient_error()) { +mgmt_sleep_msec(1); +continue; + } + return n; -} else { - return (nbytes - nleft); } } @@ -147,6 +158,7 @@ mgmt_read_pipe(int fd, char *buf, int bytes_to_read) while (bytes_to_read > 0) { int err = read_socket(fd, p, bytes_to_read); if (err == 0) { + // return 0 if partial read. return err; } else if (err < 0) { // Turn ECONNRESET into EOF. @@ -188,7 +200,10 @@ mgmt_write_pipe(int fd, char *buf, int bytes_to_write) while (bytes_to_write > 0) { int err = write_socket(fd, p, bytes_to_write); if (err == 0) { - return err; + // Where this volume of IEEE Std 1003.1-2001 requires -1 to be returned and errno set to [EAGAIN], + // most historical implementations return zero for write(2) + mgmt_sleep_msec(1); + continue; } else if (err < 0) { if (mgmt_transient_error()) { mgmt_sleep_msec(1);
[trafficserver] branch master updated: PR#5867: Explain how to use open_con().
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 678ab7a PR#5867: Explain how to use open_con(). 678ab7a is described below commit 678ab7a778d66f83475b478868f254aa62ff8344 Author: Oknet Xu AuthorDate: Fri Aug 23 17:06:30 2019 +0800 PR#5867: Explain how to use open_con(). The DNS sub-system has 2 work modes: - Primary-Secondary mode - Round-Robin mode The `open_con()` and `open_cons()` are shared with these 2 modes. Within the Primary-Secondary mode: - The `DNSHandler::ip` is used to store the Primary DNS server address. - The `validate_ip()` is the API to load the first DNS server address into The `DNSHandler::ip`. - The `open_con()` is the API to update `DNSHandler::ip` with `target` and connect to the address, but you cannot update `DNSHandler::ip` with it self. Within the Round-Robin mode: - The `DNSHandler::ip` is useless. - The `open_con()` is the API to connect to `target`. The SplitDNS is only available in the Primary-Secondary mode: - I suspect that the Round-Robin mode is a feature that was added later. - The author only made this functionality for the DNS sub-system, and forgot to do it for SplitDNS. --- iocore/dns/DNS.cc | 35 --- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/iocore/dns/DNS.cc b/iocore/dns/DNS.cc index 7a7df3b..750b23f 100644 --- a/iocore/dns/DNS.cc +++ b/iocore/dns/DNS.cc @@ -468,6 +468,15 @@ DNSHandler::open_cons(sockaddr const *target, bool failed, int icon) Open (and close) connections as necessary and also assures that the epoll fd struct is properly updated. + target == nullptr : + open connection to DNSHandler::ip. + generally, the icon should be 0 if target == nullptr. + + target != nullptr and icon == 0 : + open connection to target, and the target is assigned to DNSHandler::ip. + + target != nullptr and icon > 0 : + open connection to target. */ void DNSHandler::open_con(sockaddr const *target, bool failed, int icon, bool over_tcp) @@ -475,6 +484,8 @@ DNSHandler::open_con(sockaddr const *target, bool failed, int icon, bool over_tc ip_port_text_buffer ip_text; PollDescriptor *pd = get_PollDescriptor(dnsProcessor.thread); + ink_assert(target != ); + if (!icon && target) { ats_ip_copy(, target); } else if (!target) { @@ -549,6 +560,12 @@ DNSHandler::startEvent(int /* event ATS_UNUSED */, Event *e) dns_handler_initialized = 1; SET_HANDLER(::mainEvent); if (dns_ns_rr) { + /* Round Robin mode: + * Establish a connection to each DNS server to make it a connection pool. + * For each DNS Request, a connection is picked up from the pool by round robin method. + * + * The first DNS server is assigned to DNSHandler::ip within open_con() function. + */ int max_nscount = m_res->nscount; if (max_nscount > MAX_NAMED) { max_nscount = MAX_NAMED; @@ -565,6 +582,18 @@ DNSHandler::startEvent(int /* event ATS_UNUSED */, Event *e) } dns_ns_rr_init_down = 0; } else { + /* Primary - Secondary mode: + * Establish a connection to the Primary DNS server. + * It always send DNS requests to the Primary DNS server. + * If the Primary DNS server dies, + * - it will attempt to send DNS requests to the secondary DNS server until the Primary DNS server is back. + * - and keep to detect the health of the Primary DNS server. + * If DNSHandler::recv_dns() got a valid DNS response from the Primary DNS server, + * - it means that the Primary DNS server returns. + * - it send all DNS requests to the Primary DNS server. + * + * The first DNS server is the Primary DNS server, and it is assigned to DNSHandler::ip within validate_ip() function. + */ open_cons(nullptr); // use current target address. n_con = 1; } @@ -587,8 +616,8 @@ DNSHandler::startEvent_sdns(int /* event ATS_UNUSED */, Event *e) this->validate_ip(); SET_HANDLER(::mainEvent); - open_cons(, false, n_con); - ++n_con; // TODO should n_con be zeroed? + open_cons(nullptr, false, 0); + n_con = 1; return EVENT_CONT; } @@ -647,7 +676,7 @@ DNSHandler::try_primary_named(bool reopen) if (reopen && ((t - last_primary_reopen) > DNS_PRIMARY_REOPEN_PERIOD)) { Debug("dns", "try_primary_named: reopening primary DNS connection"); last_primary_reopen = t; -open_cons(, true, 0); +open_cons(nullptr, true, 0); } if ((t - last_primary_retry) > DNS_PRIMARY_RETRY_PERIOD) { unsigned char buffer[MAX_DNS_PACKET_LEN];
[trafficserver] branch master updated: Update HttpTransact.cc
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 5b700d2 Update HttpTransact.cc 5b700d2 is described below commit 5b700d270b021c9facf664914fdefb3887800975 Author: YuanYingdong <1975643...@qq.com> AuthorDate: Fri Aug 23 20:17:33 2019 +0800 Update HttpTransact.cc Once we get hit stale and cannot connec t to source site but we decice to serve from cache ,we need to set s->source = SOURCE_CACHE or we will get coredump in HttpTransact::handle_content_length_header --- proxy/http/HttpTransact.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index 3dbc176..2023688 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -3704,7 +3704,7 @@ HttpTransact::handle_server_connection_not_open(State *s) ink_assert(s->cache_info.object_read != nullptr); ink_assert(s->cache_info.action == CACHE_DO_UPDATE || s->cache_info.action == CACHE_DO_SERVE); ink_assert(s->internal_msg_buffer == nullptr); - +s->source = SOURCE_CACHE; TxnDebug("http_trans", "[hscno] serving stale doc to client"); build_response_from_cache(s, HTTP_WARNING_CODE_REVALIDATION_FAILED); } else {
[trafficserver] branch master updated: Fix FREELIST macros for AArch64
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 95a535b Fix FREELIST macros for AArch64 95a535b is described below commit 95a535b6b8bf459dfe95e3bfebc4cc8896ff42a1 Author: Oknet Xu AuthorDate: Thu May 9 17:07:04 2019 +0800 Fix FREELIST macros for AArch64 This revert the commit 8563409 and fix a bug of FREELIST_VERSION(_x). The layout of FREELIST_POINTER: - 0 ~ 47 bit : 48 bits, Virtual Address (1+47 bits for AMD64 and 48 bits for AArch64) - 48 ~ 62 bit : 15 bits, Freelist Version - 63 bit : 1 bits, The type of Virtual Address (0 = user space, 1 = kernel space) The valid Virtual Address range for AMD64 is: - ~ 7fff for user space - 8000 ~ for kernel space The 47th bit can be used to indicate the type of VA. And the one (64k page size) of the valid VA range for AArch64 is: - ~ for user space - ~ for kernel space We can see that the actual length of the Virtual Address is 48 bits on AArch64 and 47 bits on AMD64. Therefore, we cannot use the 47th bit to indicate the type of Virtual Address, which requires an extra bit. The highest bit would be a good choice because we have done that before. --- include/tscore/ink_queue.h | 25 ++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/include/tscore/ink_queue.h b/include/tscore/ink_queue.h index bc8a71e..5c6cc74 100644 --- a/include/tscore/ink_queue.h +++ b/include/tscore/ink_queue.h @@ -137,10 +137,29 @@ union head_p { (_x).s.pointer = _p; \ (_x).s.version = _v #elif defined(__x86_64__) || defined(__ia64__) || defined(__powerpc64__) || defined(__aarch64__) || defined(__mips64) +/* Layout of FREELIST_POINTER + * + * 0 ~ 47 bits : 48 bits, Virtual Address (47 bits for AMD64 and 48 bits for AArch64) + * 48 ~ 62 bits : 15 bits, Freelist Version + * 63 bits : 1 bits, The type of Virtual Address (0 = user space, 1 = kernel space) + */ +/* Detect which shift is implemented by the simple expression ((~0 >> 1) < 0): + * + * If the shift is `logical’ the highest order bit of the left side of the comparison is 0 so the result is positive. + * If the shift is `arithmetic’ the highest order bit of the left side is 1 so the result is negative. + */ +#if ((~0 >> 1) < 0) +/* the shift is `arithmetic' */ +#define FREELIST_POINTER(_x) \ + ((void *)intptr_t)(_x).data) & 0xLL) | intptr_t)(_x).data) >> 63) << 48))) // sign extend +#else +/* the shift is `logical' */ #define FREELIST_POINTER(_x) \ - ((void *)(intptr_t)(_x).data) << 16) >> 16) | (((~intptr_t)(_x).data) << 16 >> 63) - 1)) >> 48) << 48))) // sign extend -#define FREELIST_VERSION(_x) (((intptr_t)(_x).data) >> 48) -#define SET_FREELIST_POINTER_VERSION(_x, _p, _v) (_x).data = intptr_t)(_p)) & 0xULL) | (((_v)&0xULL) << 48)) + ((void *)intptr_t)(_x).data) & 0xLL) | (((~intptr_t)(_x).data) >> 63) - 1)) >> 48) << 48))) +#endif + +#define FREELIST_VERSION(_x) intptr_t)(_x).data) & 0x7FFFLL) >> 48) +#define SET_FREELIST_POINTER_VERSION(_x, _p, _v) (_x).data = intptr_t)(_p)) & 0x8000LL) | (((_v)&0x7FFFLL) << 48)) #else #error "unsupported processor" #endif
[trafficserver] branch master updated: Rewrite SocksProxy based on states
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 3632f96 Rewrite SocksProxy based on states 3632f96 is described below commit 3632f969e83635cce2ee223ec14485fb90cb4c1b Author: Oknet Xu AuthorDate: Wed May 8 17:35:24 2019 +0800 Rewrite SocksProxy based on states --- src/traffic_server/SocksProxy.cc | 607 ++- 1 file changed, 404 insertions(+), 203 deletions(-) diff --git a/src/traffic_server/SocksProxy.cc b/src/traffic_server/SocksProxy.cc index 824e395..8700e37 100644 --- a/src/traffic_server/SocksProxy.cc +++ b/src/traffic_server/SocksProxy.cc @@ -42,9 +42,53 @@ static RecRawStatBlock *socksproxy_stat_block; #define SOCKSPROXY_INC_STAT(x) RecIncrRawStat(socksproxy_stat_block, mutex->thread_holding, x) +struct SocksProxy; +typedef int (SocksProxy::*SocksProxyHandler)(int event, void *data); + struct SocksProxy : public Continuation { using EventHandler = int (SocksProxy::*)(int, void *); + /* SocksProxy States: + * + * + * NET_EVENT_ACCEPT + * SOCKS_INIT --> SOCKS_ACCEPT + *| + *| + * +--++ + * | || + * | || + * (Bad Ver) (Socks v5)(Socks v4) + * | || + * | || + * | AUTH_DONE| + * | || + * | VV + * | (CMD = CONNECT && Port = http_port) + * | | + * | | + * | +---(Yes)--+---(No)-+ + * | | | + * | | V + * | | (Type of Target addr) + * | | || + * | | || + * | | is IPv4 not IPv4 + * | | || + * | | || + * | V V| + * | HTTP_REQ SERVER_TUNNEL | + * | | || + * | | (connect_re) | + * | | || + * V V NET_EVENT_OPEN || + *SOCKS_ERROR > ALL_DONE <---+| + * A || + * | || + * | NET_EVENT_OPEN_FAILED || + * +- RESP_TO_CLIENT <+ <-+ + * + */ enum { SOCKS_INIT = 1, SOCKS_ACCEPT, @@ -58,9 +102,19 @@ struct SocksProxy : public Continuation { ~SocksProxy() override {} + int acceptEvent(int event, void *data); int mainEvent(int event, void *data); - int setupHttpRequest(unsigned char *p); + int state_read_client_request(int event, void *data); + int state_read_socks4_client_request(int event, void *data); + int state_read_socks5_client_auth_methods(int event, void *data); + int state_send_socks5_auth_method(int event, void *data); + int state_read_socks5_client_request(int event, void *data); + int state_handing_over_http_request(int event, void *data); + int state_send_socks_reply(int event, void *data); + + int parse_socks_client_request(unsigned char *p); + int setupHttpRequest(unsigned char *p);
[trafficserver] branch master updated: Fixes use-after-free in PVCTestDriver::start_tests
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 422aae5 Fixes use-after-free in PVCTestDriver::start_tests 422aae5 is described below commit 422aae5834a6de05a66a6ff7744e87659b137841 Author: Oknet Xu AuthorDate: Wed May 8 20:04:09 2019 +0800 Fixes use-after-free in PVCTestDriver::start_tests This reverts commit 83e5b28cfb7612640f462543f47f7080d676da6e and re-fix use-after-free in PVCTestDriver::start_tests. --- proxy/PluginVC.cc | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/proxy/PluginVC.cc b/proxy/PluginVC.cc index 569ea85..98a0969 100644 --- a/proxy/PluginVC.cc +++ b/proxy/PluginVC.cc @@ -1283,7 +1283,7 @@ public: ~PVCTestDriver() override; void start_tests(RegressionTest *r_arg, int *pstatus_arg); - bool run_next_test(); + void run_next_test(); int main_handler(int event, void *data); private: @@ -1306,13 +1306,12 @@ PVCTestDriver::start_tests(RegressionTest *r_arg, int *pstatus_arg) r = r_arg; pstatus = pstatus_arg; + SET_HANDLER(::main_handler); - if (run_next_test()) { -SET_HANDLER(::main_handler); - } + run_next_test(); } -bool +void PVCTestDriver::run_next_test() { unsigned a_index = i * 2; @@ -1326,7 +1325,7 @@ PVCTestDriver::run_next_test() *pstatus = REGRESSION_TEST_FAILED; } delete this; -return false; +return; } completions_received = 0; i++; @@ -1341,8 +1340,6 @@ PVCTestDriver::run_next_test() PluginVC *a_vc = core->connect(); a->init_test(NET_VC_TEST_ACTIVE, this, a_vc, r, _tests_def[a_index], "PluginVC", "pvc_test_detail"); - - return true; } int
[trafficserver] branch master updated: fix 3939 collision
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new a7a24cc fix 3939 collision a7a24cc is described below commit a7a24cce324740609fdfcfa5aaee8f5504521294 Author: chenggang7 AuthorDate: Thu Apr 25 10:44:58 2019 +0800 fix 3939 collision --- iocore/cache/CacheWrite.cc | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/iocore/cache/CacheWrite.cc b/iocore/cache/CacheWrite.cc index 55ec3eb..59c101c 100644 --- a/iocore/cache/CacheWrite.cc +++ b/iocore/cache/CacheWrite.cc @@ -780,7 +780,13 @@ agg_copy(char *p, CacheVC *vc) if (doc->data_len() || vc->f.allow_empty_doc) { doc->key = vc->earliest_key; } else { // the vector is being written by itself -prev_CacheKey(>key, >earliest_key); +if (vc->earliest_key == zero_key) { + do { +rand_CacheKey(>key, vc->vol->mutex); + } while (DIR_MASK_TAG(doc->key.slice32(2)) == DIR_MASK_TAG(vc->first_key.slice32(2))); +} else { + prev_CacheKey(>key, >earliest_key); +} } dir_set_head(>dir, true); } else {
[trafficserver] branch master updated: Load the Socks configuration after the host state persistence data is loaded.
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 96c0c71 Load the Socks configuration after the host state persistence data is loaded. 96c0c71 is described below commit 96c0c71fde39c4c64b0c4dacbd44920093c6a3f2 Author: Oknet Xu AuthorDate: Tue Apr 30 20:37:07 2019 +0800 Load the Socks configuration after the host state persistence data is loaded. --- iocore/net/I_NetProcessor.h | 2 ++ iocore/net/P_UnixNetProcessor.h | 1 + iocore/net/UnixNetProcessor.cc | 21 - proxy/shared/UglyLogStubs.cc | 6 ++ src/traffic_server/traffic_server.cc | 1 + 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/iocore/net/I_NetProcessor.h b/iocore/net/I_NetProcessor.h index 04dedf3..6eb5a40 100644 --- a/iocore/net/I_NetProcessor.h +++ b/iocore/net/I_NetProcessor.h @@ -198,6 +198,8 @@ public: */ virtual void init() = 0; + virtual void init_socks() = 0; + inkcoreapi virtual NetVConnection *allocate_vc(EThread *) = 0; /** Private constructor. */ diff --git a/iocore/net/P_UnixNetProcessor.h b/iocore/net/P_UnixNetProcessor.h index 7cd2208..87e16ba 100644 --- a/iocore/net/P_UnixNetProcessor.h +++ b/iocore/net/P_UnixNetProcessor.h @@ -43,6 +43,7 @@ public: NetVConnection *allocate_vc(EThread *t) override; void init() override; + void init_socks() override; Event *accept_thread_event; diff --git a/iocore/net/UnixNetProcessor.cc b/iocore/net/UnixNetProcessor.cc index c55b618..c18e6bd 100644 --- a/iocore/net/UnixNetProcessor.cc +++ b/iocore/net/UnixNetProcessor.cc @@ -296,7 +296,18 @@ UnixNetProcessor::init() d.rec_int = 0; change_net_connections_throttle(nullptr, RECD_INT, d, nullptr); - // Socks + /* + * Stat pages + */ + extern Action *register_ShowNet(Continuation * c, HTTPHdr * h); + if (etype == ET_NET) { +statPagesManager.register_http("net", register_ShowNet); + } +} + +void +UnixNetProcessor::init_socks() +{ if (!netProcessor.socks_conf_stuff) { socks_conf_stuff = new socks_conf_struct; loadSocksConfiguration(socks_conf_stuff); @@ -309,14 +320,6 @@ UnixNetProcessor::init() socks_conf_stuff = netProcessor.socks_conf_stuff; } } - - /* - * Stat pages - */ - extern Action *register_ShowNet(Continuation * c, HTTPHdr * h); - if (etype == ET_NET) { -statPagesManager.register_http("net", register_ShowNet); - } } // Virtual function allows creation of an diff --git a/proxy/shared/UglyLogStubs.cc b/proxy/shared/UglyLogStubs.cc index 15ec22e..6952389 100644 --- a/proxy/shared/UglyLogStubs.cc +++ b/proxy/shared/UglyLogStubs.cc @@ -88,6 +88,12 @@ UnixNetProcessor::init() ink_release_assert(false); } +void +UnixNetProcessor::init_socks() +{ + ink_release_assert(false); +} + // TODO: The following was necessary only for Solaris, should examine more. NetVCOptions const Connection::DEFAULT_OPTIONS; NetProcessor::AcceptOptions const NetProcessor::DEFAULT_ACCEPT_OPTIONS; diff --git a/src/traffic_server/traffic_server.cc b/src/traffic_server/traffic_server.cc index 40e2302..5674f70 100644 --- a/src/traffic_server/traffic_server.cc +++ b/src/traffic_server/traffic_server.cc @@ -1865,6 +1865,7 @@ main(int /* argc ATS_UNUSED */, const char **argv) initCacheControl(); IpAllow::startup(); HostStatus::instance().loadHostStatusFromStats(); +netProcessor.init_socks(); ParentConfig::startup(); #ifdef SPLIT_DNS SplitDNSConfig::startup();
[trafficserver] branch master updated: Rewrite the assert statement to avoid Socks Proxy triggering the assertions.
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new c934b15 Rewrite the assert statement to avoid Socks Proxy triggering the assertions. c934b15 is described below commit c934b15aa817088bf18d724e01ba2bec3308f9cf Author: Oknet Xu AuthorDate: Tue Apr 30 14:17:03 2019 +0800 Rewrite the assert statement to avoid Socks Proxy triggering the assertions. --- proxy/http/HttpSM.cc | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index a01a120..0563084 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -1728,7 +1728,10 @@ HttpSM::state_http_server_open(int event, void *data) netvc = static_cast(data); session->attach_hostname(t_state.current.server->name); UnixNetVConnection *vc = static_cast(data); -ink_release_assert(pending_action == nullptr || pending_action == vc->get_action()); +// Since the UnixNetVConnection::action_ or SocksEntry::action_ may be returned from netProcessor.connect_re, and the +// SocksEntry::action_ will be copied into UnixNetVConnection::action_ before call back NET_EVENT_OPEN from SocksEntry::free(), +// so we just compare the Continuation between pending_action and VC's action_. +ink_release_assert(pending_action == nullptr || pending_action->continuation == vc->get_action()->continuation); pending_action = nullptr; session->new_connection(vc);
[trafficserver] branch master updated: Cache:ttl-in-cache should always override never-cache
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 14143b7 Cache:ttl-in-cache should always override never-cache 14143b7 is described below commit 14143b7c4c77817eddd313f7c46c8924cff3c270 Author: yangjian AuthorDate: Thu Mar 28 16:00:43 2019 +0800 Cache:ttl-in-cache should always override never-cache --- doc/admin-guide/files/cache.config.en.rst | 13 - proxy/CacheControl.cc | 9 ++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/doc/admin-guide/files/cache.config.en.rst b/doc/admin-guide/files/cache.config.en.rst index 40d3a05..3971b9a 100644 --- a/doc/admin-guide/files/cache.config.en.rst +++ b/doc/admin-guide/files/cache.config.en.rst @@ -157,7 +157,8 @@ specifiers of the rule in question. === Value Effect === - ``never-cache`` Never cache specified objects. + ``never-cache`` Never cache specified objects, it will be + overwrited by ``ttl-in-cache``. ``ignore-no-cache`` Ignore all ``Cache-Control: no-cache`` headers. ``ignore-client-no-cache`` Ignore ``Cache-Control: no-cache`` headers from client requests. @@ -250,6 +251,16 @@ prefix. The former fails at this goal, because the second rule will match all Javascript files and will override any previous ``revalidate`` values that may have been set by prior rules. +ttl-in-cache and never-cache + + +When multiple rules are matched in the same request, ``never-cache`` will always +be overwrited by ``ttl-in-cache``. For example:: + +# ttl-in-cache=1d never-cache=false +dest_domain=example.com action=never-cache +dest_domain=example.com ttl-in-cache=1d + Examples diff --git a/proxy/CacheControl.cc b/proxy/CacheControl.cc index 6e78ed0..423584e 100644 --- a/proxy/CacheControl.cc +++ b/proxy/CacheControl.cc @@ -372,9 +372,12 @@ CacheControlRecord::UpdateMatch(CacheControlResult *result, RequestData *rdata) break; case CC_NEVER_CACHE: if (this->CheckForMatch(h_rdata, result->never_line) == true) { - result->never_cache = true; - result->never_line = this->line_num; - match = true; + // ttl-in-cache overrides never-cache + if (result->ttl_line == -1) { +result->never_cache = true; +result->never_line = this->line_num; +match = true; + } } break; case CC_STANDARD_CACHE:
[trafficserver] branch master updated: Replace EThread::has_event_loop with EThread::tt == REGULAR
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 94ccc44 Replace EThread::has_event_loop with EThread::tt == REGULAR 94ccc44 is described below commit 94ccc447d79bf8f61923df6f2536b1a24a6226e3 Author: Oknet Xu AuthorDate: Sat Mar 23 19:45:18 2019 +0800 Replace EThread::has_event_loop with EThread::tt == REGULAR --- iocore/eventsystem/I_EThread.h | 2 -- iocore/eventsystem/P_UnixEThread.h | 2 +- iocore/eventsystem/UnixEThread.cc | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/iocore/eventsystem/I_EThread.h b/iocore/eventsystem/I_EThread.h index f80456e..8ce926a 100644 --- a/iocore/eventsystem/I_EThread.h +++ b/iocore/eventsystem/I_EThread.h @@ -325,8 +325,6 @@ public: bool is_event_type(EventType et); void set_event_type(EventType et); - bool has_event_loop = false; - // Private Interface void execute() override; diff --git a/iocore/eventsystem/P_UnixEThread.h b/iocore/eventsystem/P_UnixEThread.h index cccda6b..834a6c9 100644 --- a/iocore/eventsystem/P_UnixEThread.h +++ b/iocore/eventsystem/P_UnixEThread.h @@ -183,7 +183,7 @@ TS_INLINE EThread * this_event_thread() { EThread *ethread = this_ethread(); - if (ethread != nullptr && ethread->has_event_loop) { + if (ethread != nullptr && ethread->tt == REGULAR) { return ethread; } else { return nullptr; diff --git a/iocore/eventsystem/UnixEThread.cc b/iocore/eventsystem/UnixEThread.cc index e8586fa..06920db 100644 --- a/iocore/eventsystem/UnixEThread.cc +++ b/iocore/eventsystem/UnixEThread.cc @@ -208,7 +208,6 @@ EThread::execute_regular() static EventMetrics METRIC_INIT; // give priority to immediate events - has_event_loop = true; for (;;) { if (unlikely(shutdown_event_system == true)) { return;
[trafficserver] branch master updated: The response header of CONNECT should not have content-length or chunk-encoding
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 031f321 The response header of CONNECT should not have content-length or chunk-encoding 031f321 is described below commit 031f321be814c71047a700b4b8c507382d51f709 Author: unknown AuthorDate: Tue Mar 19 11:18:50 2019 +0800 The response header of CONNECT should not have content-length or chunk-encoding --- proxy/http/HttpTransact.h | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/proxy/http/HttpTransact.h b/proxy/http/HttpTransact.h index 9e2e5e4..af40b15 100644 --- a/proxy/http/HttpTransact.h +++ b/proxy/http/HttpTransact.h @@ -1081,15 +1081,17 @@ public: typedef void (*TransactEntryFunc_t)(HttpTransact::State *s); - -// the spec says about message body the following:// -// All responses to the HEAD request method MUST NOT // -// include a message-body, even though the presence // -// of entity-header fields might lead one to believe // -// they do. All 1xx (informational), 204 (no content),// -// and 304 (not modified) responses MUST NOT include // -// a message-body.// - +/* The spec says about message body the following: + * + * All responses to the HEAD and CONNECT request method + * MUST NOT include a message-body, even though the presence + * of entity-header fields might lead one to believe they do. + * + * All 1xx (informational), 204 (no content), and 304 (not modified) + * responses MUST NOT include a message-body. + * + * Refer : [https://tools.ietf.org/html/rfc7231#section-4.3.6] + */ inline bool is_response_body_precluded(HTTPStatus status_code) { @@ -1105,7 +1107,7 @@ is_response_body_precluded(HTTPStatus status_code) inline bool is_response_body_precluded(HTTPStatus status_code, int method) { - if ((method == HTTP_WKSIDX_HEAD) || is_response_body_precluded(status_code)) { + if ((method == HTTP_WKSIDX_HEAD) || (method == HTTP_WKSIDX_CONNECT) || is_response_body_precluded(status_code)) { return true; } else { return false;
[trafficserver] branch master updated: Set the block's m_water_level in Arena:free even if the block is not the last block
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new e6cb7bf Set the block's m_water_level in Arena:free even if the block is not the last block e6cb7bf is described below commit e6cb7bfaec1cf3ff00baecf2a2ab8a07addab2bf Author: unknown AuthorDate: Tue Mar 12 18:30:01 2019 +0800 Set the block's m_water_level in Arena:free even if the block is not the last block --- src/tscore/Arena.cc | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tscore/Arena.cc b/src/tscore/Arena.cc index 23469e0..1667923 100644 --- a/src/tscore/Arena.cc +++ b/src/tscore/Arena.cc @@ -133,12 +133,12 @@ Arena::free(void *mem, size_t size) b = m_blocks; while (b->next) { + if (b->m_water_level == ((char *)mem + size)) { +b->m_water_level = (char *)mem; +return; + } b = b->next; } - -if (b->m_water_level == ((char *)mem + size)) { - b->m_water_level = (char *)mem; -} } }
[trafficserver] branch master updated: Fix for() loop, correctly calculate the value of seg_in_use within Vol::dir_check()
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new d003e8d Fix for() loop, correctly calculate the value of seg_in_use within Vol::dir_check() d003e8d is described below commit d003e8d4b6549589ea83016e54958de0a0daeb55 Author: Oknet Xu AuthorDate: Thu Mar 7 15:49:07 2019 +0800 Fix for() loop, correctly calculate the value of seg_in_use within Vol::dir_check() --- iocore/cache/CacheDir.cc | 4 1 file changed, 4 deletions(-) diff --git a/iocore/cache/CacheDir.cc b/iocore/cache/CacheDir.cc index 427ce31..109538f 100644 --- a/iocore/cache/CacheDir.cc +++ b/iocore/cache/CacheDir.cc @@ -1267,10 +1267,6 @@ int Vol::dir_check(bool /* fix ATS_UNUSED */) // TODO: we should eliminate this ++frag_demographics[dir_size(e)][dir_big(e)]; } } -e = next_dir(e, seg); -if (!e) { - break; -} } // Check for duplicates (identical tags in the same bucket).
[trafficserver] branch master updated: Optimize: rewrite getbyname_imm and getSRVbyname_imm as wrappers for getby
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 2906f16 Optimize: rewrite getbyname_imm and getSRVbyname_imm as wrappers for getby 2906f16 is described below commit 2906f166c0f02d5efd731819a121092d5c8fae49 Author: Oknet Xu AuthorDate: Sat Feb 2 23:17:55 2019 +0800 Optimize: rewrite getbyname_imm and getSRVbyname_imm as wrappers for getby --- iocore/hostdb/HostDB.cc | 291 +++--- iocore/hostdb/I_HostDBProcessor.h | 17 +-- proxy/http/HttpSM.cc | 8 +- 3 files changed, 124 insertions(+), 192 deletions(-) diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc index fbf410c..5b81c85 100644 --- a/iocore/hostdb/HostDB.cc +++ b/iocore/hostdb/HostDB.cc @@ -605,57 +605,77 @@ HostDBContinuation::insert(unsigned int attl) // Get an entry by either name or IP // Action * -HostDBProcessor::getby(Continuation *cont, const char *hostname, int len, sockaddr const *ip, bool aforce_dns, - HostResStyle host_res_style, int dns_lookup_timeout) +HostDBProcessor::getby(Continuation *cont, cb_process_result_pfn cb_process_result, HostDBHash , Options const ) { - HostDBHash hash; + bool trylock = (cb_process_result == nullptr); + bool force_dns= false; EThread *thread = this_ethread(); Ptr mutex = thread->mutex; ip_text_buffer ipb; + if (opt.flags & HOSTDB_FORCE_DNS_ALWAYS) { +force_dns = true; + } else if (opt.flags & HOSTDB_FORCE_DNS_RELOAD) { +force_dns = hostdb_re_dns_on_reload; +if (force_dns) { + HOSTDB_INCREMENT_DYN_STAT(hostdb_re_dns_on_reload_stat); +} + } + HOSTDB_INCREMENT_DYN_STAT(hostdb_total_lookups_stat); - if ((!hostdb_enable || (hostname && !*hostname)) || (hostdb_disable_reverse_lookup && ip)) { -MUTEX_TRY_LOCK(lock, cont->mutex, thread); -if (!lock.is_locked()) { - goto Lretry; + if (!hostdb_enable || // if the HostDB is disabled, + (hash.host_name && !*hash.host_name) || // or host_name is empty string + (hostdb_disable_reverse_lookup && hash.ip.isValid())) { // or try to lookup by ip address when the reverse lookup disabled +if (cb_process_result) { + (cont->*cb_process_result)(nullptr); +} else { + MUTEX_TRY_LOCK(lock, cont->mutex, thread); + if (!lock.is_locked()) { +goto Lretry; + } + cont->handleEvent(EVENT_HOST_DB_LOOKUP, nullptr); } -cont->handleEvent(EVENT_HOST_DB_LOOKUP, nullptr); return ACTION_RESULT_DONE; } - // Load the hash data. - hash.set_host(hostname, hostname ? (len ? len : strlen(hostname)) : 0); - hash.ip.assign(ip); - hash.port= ip ? ats_ip_port_host_order(ip) : 0; - hash.db_mark = db_mark_for(host_res_style); - hash.refresh(); - // Attempt to find the result in-line, for level 1 hits - // - if (!aforce_dns) { + if (!force_dns) { MUTEX_TRY_LOCK(lock, cont->mutex, thread); bool loop = lock.is_locked(); while (loop) { loop = false; // Only loop on explicit set for retry. // find the partition lock - // Ptr bucket_mutex = hostDB.refcountcache->lock_for_key(hash.hash.fold()); MUTEX_TRY_LOCK(lock2, bucket_mutex, thread); - + if (!lock2.is_locked() && !trylock) { +// Refer to: [TS-374](http://issues.apache.org/jira/browse/TS-374) +lock2.acquire(thread); + } if (lock2.is_locked()) { // If we can get the lock and a level 1 probe succeeds, return -Ptr r = probe(bucket_mutex, hash, aforce_dns); +Ptr r = probe(bucket_mutex, hash, false); if (r) { - if (r->is_failed() && hostname) { -loop = check_for_retry(hash.db_mark, host_res_style); + // fail, see if we should retry with alternate + if (hash.db_mark != HOSTDB_MARK_SRV && r->is_failed() && hash.host_name) { +loop = check_for_retry(hash.db_mark, opt.host_res_style); } if (!loop) { // No retry -> final result. Return it. -Debug("hostdb", "immediate answer for %s", - hostname ? hostname : ats_is_ip(ip) ? ats_ip_ntop(ip, ipb, sizeof ipb) : ""); +if (hash.db_mark == HOSTDB_MARK_SRV) { + Debug("hostdb", "immediate SRV answer for %.*s from hostdb", hash.host_len, hash.host_name); + Debug("dns_srv", "immediate SRV answer for %.*s from hostdb", hash.host_len, hash.host_name); +} else if (hash.host_name) { + Debug("hostdb", "imme
[trafficserver] branch quic-13 created (now 0095388)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a change to branch quic-13 in repository https://gitbox.apache.org/repos/asf/trafficserver.git. at 0095388 Add const qualifier to _hs_protocol No new revisions were added by this update.
[trafficserver] branch quic-15 created (now 447c7f6)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a change to branch quic-15 in repository https://gitbox.apache.org/repos/asf/trafficserver.git. at 447c7f6 Merge branch 'master' into quic-latest No new revisions were added by this update.
[trafficserver] branch quic-12 created (now 38104e9)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a change to branch quic-12 in repository https://gitbox.apache.org/repos/asf/trafficserver.git. at 38104e9 Merge branch 'asf/master' into quic-latest No new revisions were added by this update.
[trafficserver] branch 3.0.x created (now 325610e)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a change to branch 3.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git. at 325610e TS-1459: Backport regex_remap This branch includes the following new commits: new d6c8b7f trunk dir for Traffic Server new e5628fa placeholder file new 315793d Testing commit from svn:externals new cda6bbc Moving 'trunk', 'branches', and 'tags' into 'traffic'. new 8860540 this is a test new a165134 Initial commit. new 74347bf Ignore build files. new 14ba3e2 TS-4 Changed fprintf() to fputs() for a string literal Applied the patch submitted by Stephane Belmon new bcd93f8 TS-4 Didn't swap the arguments for fputs(), tested and works now new e8ecbb2 TS-10 fix the chunking decision for the serve from cache after revalidation and read-while-write cases new 4be72ec TS-12 Fixes for buffer overrun. Also had to add a "fix" to get the fgets() to compile on Ubuntu. new 222d485 TS-5 Avoid warnings on unused return values. This still uses a few cases of NOWARN_UNUSED_RETURN(), but we try to actuallye examine the return values when useful. new a9adec3 TS-5 More fixes for Ubuntu port. new e4dba13 TS-3 fix for finding TCL library new 188146c TS-19 Add -pipe to gcc. new dcff135 TS-13 problem where we hard coded -ltcl instead of using $(LIBTCL) new 0ebf560 TS-26 include .gitignore new 5a26d74 TS-24 More Ubuntu portability issues, this time fwrite(). new bd1e9ef TS-13 64bit support for x86_64 linux - tested on RHEL[4-5] 32-bit and FC11 32bit and 64bit with and without -m32 - patch sumbitted by John Plevyak - minor patches by Bryan Call, Leif Hedstrom, and Mladen Turk new 93c208a TS-13 problem with AS_CASE not supported in autoconf 2.59 on RHEL4 using the expanded marco in its place new c34148d TS-37 Fix help messages for debug tags new d507d37 TS-40 Reinstate "caun" log field. new f75a4a6 TS-38 Patch from John Plevyak, fixes some warnings on Ubuntu 8.04 x86_64 with gcc 4.2.4 new 43b94d9 TS-2: only redefine errnos if they are not set. new 2263f2e TS-2: Work on making configure.ac usable. * configure.ac: Don't error out if we can't find that ancient db185 symbol. * configure.ac: Check for various headers. * libinktomi++/ink_platform.h: Use HAVE_ defines to detect if a header is available, rather than looking for specific operating systems. new d130184 TS-2: Use gettimeofday() if clock_gettime is not available. new 2c97c71 TS-2: Use db.h if db_185.h is not available. new d7263ea TS-2: Use APR's network detection macros to determine which variant of gethostbyname_r is actually being used. new a324bec TS-2: Improve check for execinfo.h, it can sometimes be available on osx/freebsd. new 18e2277 Remove unneeded include, SimpleDBM.h handles this. new b6c2084 TS-2: Fix GCC error: "/*" within comment new 2271afd TS-2: Only define MAX if it is not defined elsewhere new 11bb295 Add APR Network macros new 28213c3 TS-2: Prevent double include of db header new 6d10cce TS-2: Fix compiler error by casting pthread_t to a long instead of an int. error: cast from '_opaque_pthread_t*' to 'unsigned int' loses precision new cdb20c7 TS-2: ifdef out linux specific bits of getting a backtrace and restoring the signal frame. (should come back to this later) (cherry picked from commit 2c31f7e41ab42c0bf9b24070ad2fda71d1006d05) new d06cc55 TS-2: Add conditional defines for parameters to madvise. (cherry picked from commit fe7a5bf94df4165386e147ff5ad8f1186a3bcbdd) new 8a81161 TS-2: Use correct string format for longs (cherry picked from commit 52ac4736d474583d9899780549d4ed23bde8751b) new ca2bf60 TS-2: Check for netdb.h before checking for the gethostbyname_r style. (fixes linux build) new dcbb222 TS-2: Work on making configure.ac usable. * configure.ac: Don't error out if we can't find that ancient db185 symbol. * configure.ac: Check for various headers. * libinktomi++/ink_platform.h: Use HAVE_ defines to detect if a header is available, rather than looking for specific operating systems. new 87c1164 TS-2: Use db.h if db_185.h is not available. new 9ea83bc TS-2: Use APR's network detection macros to determine which variant of gethostbyname_r is actually being used. new beff3ff TS-2: Improve check for execinfo.h, it can sometimes be available on osx/freebsd. new ed17739 TS-2: Detect KQueue availability, and start using it in places instead of epoll new 51076c6 TS-2: use portable detection of regex header new 069eb7a TS-2: senum is defined on OSX. fix this check new 8adb6a8 TS-2: remove no rvalue new on HPUX new 7dbac7c TS-2: TCP_DEFER_ACCEPT is linux specific. new 4c7fcb4 TS-2: Add KQueue polling port, based up
[trafficserver] branch 2.0.x created (now 640c4f7)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a change to branch 2.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git. at 640c4f7 Added v2.0.1 to the release history. This branch includes the following new commits: new d6c8b7f trunk dir for Traffic Server new e5628fa placeholder file new 315793d Testing commit from svn:externals new cda6bbc Moving 'trunk', 'branches', and 'tags' into 'traffic'. new 8860540 this is a test new a165134 Initial commit. new 74347bf Ignore build files. new 14ba3e2 TS-4 Changed fprintf() to fputs() for a string literal Applied the patch submitted by Stephane Belmon new bcd93f8 TS-4 Didn't swap the arguments for fputs(), tested and works now new e8ecbb2 TS-10 fix the chunking decision for the serve from cache after revalidation and read-while-write cases new 4be72ec TS-12 Fixes for buffer overrun. Also had to add a "fix" to get the fgets() to compile on Ubuntu. new 222d485 TS-5 Avoid warnings on unused return values. This still uses a few cases of NOWARN_UNUSED_RETURN(), but we try to actuallye examine the return values when useful. new a9adec3 TS-5 More fixes for Ubuntu port. new e4dba13 TS-3 fix for finding TCL library new 188146c TS-19 Add -pipe to gcc. new dcff135 TS-13 problem where we hard coded -ltcl instead of using $(LIBTCL) new 0ebf560 TS-26 include .gitignore new 5a26d74 TS-24 More Ubuntu portability issues, this time fwrite(). new bd1e9ef TS-13 64bit support for x86_64 linux - tested on RHEL[4-5] 32-bit and FC11 32bit and 64bit with and without -m32 - patch sumbitted by John Plevyak - minor patches by Bryan Call, Leif Hedstrom, and Mladen Turk new 93c208a TS-13 problem with AS_CASE not supported in autoconf 2.59 on RHEL4 using the expanded marco in its place new c34148d TS-37 Fix help messages for debug tags new d507d37 TS-40 Reinstate "caun" log field. new f75a4a6 TS-38 Patch from John Plevyak, fixes some warnings on Ubuntu 8.04 x86_64 with gcc 4.2.4 new 43b94d9 TS-2: only redefine errnos if they are not set. new 2263f2e TS-2: Work on making configure.ac usable. * configure.ac: Don't error out if we can't find that ancient db185 symbol. * configure.ac: Check for various headers. * libinktomi++/ink_platform.h: Use HAVE_ defines to detect if a header is available, rather than looking for specific operating systems. new d130184 TS-2: Use gettimeofday() if clock_gettime is not available. new 2c97c71 TS-2: Use db.h if db_185.h is not available. new d7263ea TS-2: Use APR's network detection macros to determine which variant of gethostbyname_r is actually being used. new a324bec TS-2: Improve check for execinfo.h, it can sometimes be available on osx/freebsd. new 18e2277 Remove unneeded include, SimpleDBM.h handles this. new b6c2084 TS-2: Fix GCC error: "/*" within comment new 2271afd TS-2: Only define MAX if it is not defined elsewhere new 11bb295 Add APR Network macros new 28213c3 TS-2: Prevent double include of db header new 6d10cce TS-2: Fix compiler error by casting pthread_t to a long instead of an int. error: cast from '_opaque_pthread_t*' to 'unsigned int' loses precision new cdb20c7 TS-2: ifdef out linux specific bits of getting a backtrace and restoring the signal frame. (should come back to this later) (cherry picked from commit 2c31f7e41ab42c0bf9b24070ad2fda71d1006d05) new d06cc55 TS-2: Add conditional defines for parameters to madvise. (cherry picked from commit fe7a5bf94df4165386e147ff5ad8f1186a3bcbdd) new 8a81161 TS-2: Use correct string format for longs (cherry picked from commit 52ac4736d474583d9899780549d4ed23bde8751b) new ca2bf60 TS-2: Check for netdb.h before checking for the gethostbyname_r style. (fixes linux build) new dcbb222 TS-2: Work on making configure.ac usable. * configure.ac: Don't error out if we can't find that ancient db185 symbol. * configure.ac: Check for various headers. * libinktomi++/ink_platform.h: Use HAVE_ defines to detect if a header is available, rather than looking for specific operating systems. new 87c1164 TS-2: Use db.h if db_185.h is not available. new 9ea83bc TS-2: Use APR's network detection macros to determine which variant of gethostbyname_r is actually being used. new beff3ff TS-2: Improve check for execinfo.h, it can sometimes be available on osx/freebsd. new ed17739 TS-2: Detect KQueue availability, and start using it in places instead of epoll new 51076c6 TS-2: use portable detection of regex header new 069eb7a TS-2: senum is defined on OSX. fix this check new 8adb6a8 TS-2: remove no rvalue new on HPUX new 7dbac7c TS-2: TCP_DEFER_ACCEPT is linux specific. new 4c7fcb4 TS-2: Add KQueue polling port, ba
[trafficserver] branch 8.0.x updated (12b3103 -> 82fcc3c)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a change to branch 8.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git. from 12b3103 Updated ChangeLog new 943107b Fix for when multiplexer gets a 0 byte read event new 6b17598 no point in calling decode a second time if available is already 0 new bbf2a86 cachekey: handle empty regex group captures new 936634e make sure "traffic_ctl config reload" only reloads configs that changed new 28453ce Update the header_rewrite doc for clarification on CLIENT-URL:HOST new 98a2cc7 fixing spelled enumeration new bebe064 Makefile to make Fedora and Centos docker images new 7a0cb1f Removes references to STAT_PROCESSOR new cd89337 Follows 308 Permanent Redirect new 8200218 Removed checking the return value for TSContCall() new 9fc354c Fixed Spelling. new 842cddf fix typo new 88dd197 Plugin, makefile, readme and schema new 0e81741 Clear up evnets and timers for a H2 stream before destroying its mutex new 0a2b96d Completes & deduplicates code comment for redirect new 3676e83 cachekey: capture cache key elements from headers new e845b3b Revert "Add TLSv1.3 cipher suites for OpenSSL-1.1.1" new 937559d Log Collation - Memory leak when more than one active host defined. new bc0cf93 Add configs for TLSv1.3 ciphersuites new 6c1af1e fix for cpp api Transaction::redirectTo new 23c1dbb Handly tool to decode via header new 03a4728 Updated Changelog new aadaef5 Enables proxy.config.http.negative_revalidating_enabled by default new 0a54f31 Make negative caching accept configured error status codes new 7da4d94 Updated docs to reflect default configuration change with proxy.config.http.negative_revalidating_enabled new a692053 PROXY Protocol transformed to Forwarded HTTP heder. new 7ae24e3 Updated Changelog new 266aebf Log Collation - Memory leak when all hosts are down. new a259ce3 Ran clang-format new 8984778 Update to changelog generation tool to not require milestone to be closed new 7e496f6 Updated Changelog new 645f048 Remove unneeded aio header file new 2b3ba1d Updated Changelog new 0b703a4 PR #3724: Backport to ATS 8. Cherry-pick from 079a40277a450ead4eecb4f5cf00a448ac7db025 new a9ae8ad Corrects IPv4 multicast ip address check new 35b5c94 Fix inconsistent links in docs. new 9305278 Disable the HttpSM half open logic if the underlying transport is TLS new aaa9d0c Fixed error getting h2 HEADERS frame after stream is closed new ad43863 Fix link error on macOS new 5f0ab22 Updated Changelog new 44be529 Adds redirect actions settings, returns by default new d498db2 heap use after free new cb2b6ff Clarifies code comment for DL_Emergency new 7f2ea3f Updated Changelog new eeea4a9 header_rewrite: Removes deprecated %{CLIENT-IP} condition new 1552714 Corrects path in multiple documents new fb19938 Runroot: Fix a issue caused by restructured headers new 667ef7c Follow up for #3724 - fix out of tree builds. new 9d550c6 Updated Changelog new 88e49a1 Location of autogenerated headers changed new 99d2240 Removes the deprecated plugin coallapsed_connection new ad9bb3a Adds 308 origin response stat metric new b0e1ba1 PR-3724: Fix additional linkage issues. new 71f2a26 Updated Changelog new de55496 Adding missing image file for Proxy Protocol documentation. new b5c165d Updated Changelog new bb0670d Revert "Adds redirect actions settings, returns by default" new fdbe478 Updated Changelog new e001316 Use the default log rotation enabled value and remove old comments in logging.yaml and link to docs new 9fb32a0 Updated the rpm spec file to have the correct files and fixed permissions new b310e35 Updated Changelog new 58442ff ran clang-format new 754a254 client_bytes should be initialized as 0, it is exclusevely used by get_info_from_buffer to count the number of copied bytes and set the last byte to 0 new 165fc86 Add a search path for Tcl new 1f2ecbc s3_auth_v4: update default region map new b49b251 Update the include dir paths for new layout new 126ceb1 Fixes spelling in spec summary new 101c317 Fix build for kfreebsd architecture on Debian. Should preserve build for freebsd new c0e32c6 Fix build for arm on Debian new 518ea6d Fix build for mips64el architecture on Debian new 8de5539 Run automake and autoconf everytime on a docs build new ced3295 Documentation for traffic dump new 2366461 Removed spaces and tabs at the end of lines new f7b6fa6 Test: Convert test_List.cc to Catch new 1cff26b Test: Convert test_arena.cc to Catch new 27cedcf
[trafficserver] branch 8.0.x created (now 12b3103)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a change to branch 8.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git. at 12b3103 Updated ChangeLog No new revisions were added by this update.
[trafficserver] branch master updated: Optimize: Keep cont->mutex locked, during probe the bucket by hash object within HostDBProcessor::getby
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 34dcdb2 Optimize: Keep cont->mutex locked, during probe the bucket by hash object within HostDBProcessor::getby 34dcdb2 is described below commit 34dcdb278b92b04f2c19f1cd3a48f94c8ae65dfb Author: Oknet Xu AuthorDate: Sat Feb 2 19:13:33 2019 +0800 Optimize: Keep cont->mutex locked, during probe the bucket by hash object within HostDBProcessor::getby --- iocore/hostdb/HostDB.cc | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc index dd80c58..fbf410c 100644 --- a/iocore/hostdb/HostDB.cc +++ b/iocore/hostdb/HostDB.cc @@ -634,19 +634,18 @@ HostDBProcessor::getby(Continuation *cont, const char *hostname, int len, sockad // Attempt to find the result in-line, for level 1 hits // if (!aforce_dns) { -bool loop; -do { +MUTEX_TRY_LOCK(lock, cont->mutex, thread); +bool loop = lock.is_locked(); +while (loop) { loop = false; // Only loop on explicit set for retry. // find the partition lock // - // TODO: Could we reuse the "mutex" above safely? I think so but not sure. - Ptr bmutex = hostDB.refcountcache->lock_for_key(hash.hash.fold()); - MUTEX_TRY_LOCK(lock, bmutex, thread); - MUTEX_TRY_LOCK(lock2, cont->mutex, thread); + Ptr bucket_mutex = hostDB.refcountcache->lock_for_key(hash.hash.fold()); + MUTEX_TRY_LOCK(lock2, bucket_mutex, thread); - if (lock.is_locked() && lock2.is_locked()) { + if (lock2.is_locked()) { // If we can get the lock and a level 1 probe succeeds, return -Ptr r = probe(bmutex, hash, aforce_dns); +Ptr r = probe(bucket_mutex, hash, aforce_dns); if (r) { if (r->is_failed() && hostname) { loop = check_for_retry(hash.db_mark, host_res_style); @@ -662,7 +661,7 @@ HostDBProcessor::getby(Continuation *cont, const char *hostname, int len, sockad hash.refresh(); // only on reloop, because we've changed the family. } } -} while (loop); +} } Debug("hostdb", "delaying force %d answer for %s", aforce_dns, hostname ? hostname : ats_is_ip(ip) ? ats_ip_ntop(ip, ipb, sizeof ipb) : "");
[trafficserver] branch master updated: Avoid rescheduling HostDBContinuation to the ET_DNS thread.
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 76e50f0 Avoid rescheduling HostDBContinuation to the ET_DNS thread. 76e50f0 is described below commit 76e50f0ea46923b39fc3a408826b8be6959fe799 Author: Oknet Xu AuthorDate: Fri Feb 1 18:25:54 2019 +0800 Avoid rescheduling HostDBContinuation to the ET_DNS thread. With TS-196 (commit a5345da8), the HostDBContinuation is no longer reschedule to the ET_DNS. However, the changes only applied to the `HostDBProcessor::getbyname_imm` interface. And the NCA feature was removed by TS-455 (commit 112b03aa), so it is safe to bring the changes to all the interfaces of HostDBProcessor. --- iocore/hostdb/HostDB.cc | 21 +++-- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc index 8c5ac69..947b2c2 100644 --- a/iocore/hostdb/HostDB.cc +++ b/iocore/hostdb/HostDB.cc @@ -679,14 +679,7 @@ Lretry: c->init(hash, opt); SET_CONTINUATION_HANDLER(c, (HostDBContHandler)::probeEvent); - // Since ProxyMutexPtr has a cast operator, gcc-3.x get upset - // about ambiguity when doing this comparison, so by reversing - // the operands, I force it to pick the cast operation /leif. - if (thread->mutex == cont->mutex) { -thread->schedule_in(c, MUTEX_RETRY_DELAY); - } else { -dnsProcessor.thread->schedule_imm(c); - } + thread->schedule_in(c, MUTEX_RETRY_DELAY); return >action; } @@ -797,11 +790,7 @@ HostDBProcessor::getSRVbyname_imm(Continuation *cont, process_srv_info_pfn proce c->init(hash, copt); SET_CONTINUATION_HANDLER(c, (HostDBContHandler)::probeEvent); - if (thread->mutex == cont->mutex) { -thread->schedule_in(c, MUTEX_RETRY_DELAY); - } else { -dnsProcessor.thread->schedule_imm(c); - } + thread->schedule_in(c, MUTEX_RETRY_DELAY); return >action; } @@ -903,11 +892,7 @@ HostDBProcessor::iterate(Continuation *cont) c->current_iterate_pos = 0; SET_CONTINUATION_HANDLER(c, (HostDBContHandler)::iterateEvent); - if (thread->mutex == cont->mutex) { -thread->schedule_in(c, HOST_DB_RETRY_PERIOD); - } else { -dnsProcessor.thread->schedule_imm(c); - } + thread->schedule_in(c, HOST_DB_RETRY_PERIOD); return >action; }
[trafficserver] branch master updated: Avoid reschedule HostDBContinuation::iterateEvent if there are no more buckets
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 7e429ad Avoid reschedule HostDBContinuation::iterateEvent if there are no more buckets 7e429ad is described below commit 7e429ad401fe96c3b2ad16d3e083ad39b50484c0 Author: Oknet Xu AuthorDate: Tue Jan 29 14:34:11 2019 +0800 Avoid reschedule HostDBContinuation::iterateEvent if there are no more buckets --- iocore/hostdb/HostDB.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc index b5f16be..8c5ac69 100644 --- a/iocore/hostdb/HostDB.cc +++ b/iocore/hostdb/HostDB.cc @@ -1567,6 +1567,9 @@ HostDBContinuation::iterateEvent(int event, Event *e) } } current_iterate_pos++; + } + + if (current_iterate_pos < hostDB.refcountcache->partition_count()) { // And reschedule ourselves to pickup the next bucket after HOST_DB_RETRY_PERIOD. Debug("hostdb", "iterateEvent event=%d eventp=%p: completed current iteration %ld of %ld", event, e, current_iterate_pos, hostDB.refcountcache->partition_count());
[trafficserver] branch master updated: Do not call dns_result repeatedly for a valid dns result.
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new f7f6d7e Do not call dns_result repeatedly for a valid dns result. f7f6d7e is described below commit f7f6d7e4a2de4c2d3e26e3fd9aea93c9974a23f8 Author: Oknet Xu AuthorDate: Mon Jan 21 20:48:22 2019 +0800 Do not call dns_result repeatedly for a valid dns result. --- iocore/dns/DNS.cc | 93 - iocore/dns/P_DNSProcessor.h | 3 +- 2 files changed, 52 insertions(+), 44 deletions(-) diff --git a/iocore/dns/DNS.cc b/iocore/dns/DNS.cc index 5db7f67..6deb3dc 100644 --- a/iocore/dns/DNS.cc +++ b/iocore/dns/DNS.cc @@ -1307,7 +1307,16 @@ dns_result(DNSHandler *h, DNSEntry *e, HostEnt *ent, bool retry, bool tcp_retry) DNS_SUM_DYN_STAT(dns_success_time_stat, Thread::get_hrtime() - e->submit_time); } } + + // Remove head node from DNSHandler::entries queue h->entries.remove(e); + // Release Query ID from DNSHandler + for (int i : e->id) { +if (i < 0) { + break; +} +h->release_query_id(i); + } if (is_debug_tag_set("dns")) { if (is_addr_query(e->qtype)) { @@ -1334,52 +1343,50 @@ dns_result(DNSHandler *h, DNSEntry *e, HostEnt *ent, bool retry, bool tcp_retry) DNS_INCREMENT_DYN_STAT(dns_lookup_fail_stat); } - DNSEntry *dup = nullptr; - while ((dup = e->dups.dequeue())) { -if (dup->post(h, ent)) { - e->dups.enqueue(dup); - goto Lretry; -} - } - - if (e->timeout) { -e->timeout->cancel(e); -e->timeout = nullptr; - } + // Save HostEnt to the head node e->result_ent = ent; + e->retries= 0; + SET_CONTINUATION_HANDLER(e, ::postAllEvent); + e->handleEvent(EVENT_NONE, nullptr); +} - if (h->mutex->thread_holding == e->submit_thread) { -MUTEX_TRY_LOCK(lock, e->action.mutex, h->mutex->thread_holding); -if (!lock.is_locked()) { - Debug("dns", "failed lock for result %s", e->qname); - goto Lretry; -} -for (int i : e->id) { - if (i < 0) { -break; - } - h->release_query_id(i); -} -e->postEvent(0, nullptr); - } else { -for (int i : e->id) { - if (i < 0) { -break; +int +DNSEntry::postAllEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) +{ + /* Traverse the DNSEntry queue and callback + * + * The first DNSEntry object is head node, + * - Pushed into DNSHandler::entries queue, + * - Initial a DNS request and send to named server, + * - Maintained a dups queue which holds the DNSEntry object for the same DNS request, + * - All the DNSEntry in the queue share the same HostEnt result + * + * The head node callback the HostEnt result to the Continuation of all nodes one by one, + * - If one of the callback fails, put the node back to the dups queue and try again later by reschedule the head node, + * - Always call back the head node until the dups queue is empty. + */ + DNSEntry *dup = nullptr; + while ((dup = dups.dequeue())) { +if (dup->post(dnsH, result_ent.get())) { + // If one of the callback fails, put the node back to the dups queue + dups.enqueue(dup); + // Try again by reschedule the head node + if (timeout) { +timeout->cancel(); } - h->release_query_id(i); + timeout = dnsH->mutex->thread_holding->schedule_in(this, MUTEX_RETRY_DELAY); + return EVENT_DONE; } -e->mutex = e->action.mutex; -SET_CONTINUATION_HANDLER(e, ::postEvent); -e->submit_thread->schedule_imm_signal(e); } - return; -Lretry: - e->result_ent = ent; - e->retries= 0; - if (e->timeout) { -e->timeout->cancel(); + + // Process the head node at last + if (post(dnsH, result_ent.get())) { +// If the callback fails, switch the handler to DNSEntry::postOneEvent and reschedule it. +mutex = action.mutex; +SET_HANDLER(::postOneEvent); +submit_thread->schedule_imm(this); } - e->timeout = h->mutex->thread_holding->schedule_in(e, MUTEX_RETRY_DELAY); + return EVENT_DONE; } int @@ -1396,17 +1403,17 @@ DNSEntry::post(DNSHandler *h, HostEnt *ent) Debug("dns", "failed lock for result %s", qname); return 1; } -postEvent(0, nullptr); +postOneEvent(0, nullptr); } else { mutex = action.mutex; -SET_HANDLER(::postEvent); +SET_HANDLER(::postOneEvent); submit_thread->schedule_imm_signal(this); } return 0; } int -DNSEntry::postEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) +DNSEntry::postOneEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) { if (!action.cancelle
[trafficserver] branch master updated: resolve stack-use-after-scope in YamlLogConfig.cc
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 0ee2a26 resolve stack-use-after-scope in YamlLogConfig.cc 0ee2a26 is described below commit 0ee2a26d735c8047688e660f134a6c2cd99ee913 Author: cichang.chen AuthorDate: Mon Jan 21 20:44:42 2019 +0800 resolve stack-use-after-scope in YamlLogConfig.cc fix warning in YamlLogConfig.cc --- proxy/logging/YamlLogConfig.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proxy/logging/YamlLogConfig.cc b/proxy/logging/YamlLogConfig.cc index b3fd5bc..cc4c6ac 100644 --- a/proxy/logging/YamlLogConfig.cc +++ b/proxy/logging/YamlLogConfig.cc @@ -206,10 +206,10 @@ YamlLogConfig::decodeLogObject(const YAML::Node ) } for (auto & : filters) { -const char *filter_name = filter.as().c_str(); -LogFilter *f= cfg->filter_list.find_by_name(filter_name); +std::string filter_name = filter.as().c_str(); +LogFilter *f= cfg->filter_list.find_by_name(filter_name.c_str()); if (!f) { - Warning("Filter %s is not a known filter; cannot add to this LogObject", filter_name); + Warning("Filter %s is not a known filter; cannot add to this LogObject", filter_name.c_str()); } else { logObject->add_filter(f); }
[trafficserver] branch master updated: Assert if operations on keep_alive_queue and active_queue are not thread-safe
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new c929ed6 Assert if operations on keep_alive_queue and active_queue are not thread-safe c929ed6 is described below commit c929ed6fdee34a67529b55f9fe1c47d449ee854f Author: Oknet AuthorDate: Wed Oct 10 13:50:10 2018 +0800 Assert if operations on keep_alive_queue and active_queue are not thread-safe The `vc->add_to_keep_alive_queue()` is called by: - Http1ClientSession::release() - Http2ClientSession::cleanup_streams() - Http2ClientSession::release_stream() And the `NetHandler::remove_from_active_queue()` is called by `vc->add_to_keep_alive_queue()`. The NetHandler::keep_alive_queue and NetHandler::active_queue are internal queue of NetHandler. We must have acquired the NetHandler's lock before doing anything with them. When reenable a HttpSM from plugin, the HttpSM would be run into ethread that different from client_vc lives because TSHttpSMCallback is scheduled by `eventProcessor.schedule_imm()`. --- iocore/net/UnixNet.cc| 6 ++ iocore/net/UnixNetVConnection.cc | 31 +++ 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/iocore/net/UnixNet.cc b/iocore/net/UnixNet.cc index eb95841..76a10a4 100644 --- a/iocore/net/UnixNet.cc +++ b/iocore/net/UnixNet.cc @@ -673,6 +673,7 @@ void NetHandler::add_to_keep_alive_queue(UnixNetVConnection *vc) { Debug("net_queue", "NetVC: %p", vc); + ink_assert(mutex->thread_holding == this_ethread()); if (keep_alive_queue.in(vc)) { // already in the keep-alive queue, move the head @@ -692,6 +693,8 @@ void NetHandler::remove_from_keep_alive_queue(UnixNetVConnection *vc) { Debug("net_queue", "NetVC: %p", vc); + ink_assert(mutex->thread_holding == this_ethread()); + if (keep_alive_queue.in(vc)) { keep_alive_queue.remove(vc); --keep_alive_queue_size; @@ -704,6 +707,7 @@ NetHandler::add_to_active_queue(UnixNetVConnection *vc) Debug("net_queue", "NetVC: %p", vc); Debug("net_queue", "max_connections_per_thread_in: %d active_queue_size: %d keep_alive_queue_size: %d", max_connections_per_thread_in, active_queue_size, keep_alive_queue_size); + ink_assert(mutex->thread_holding == this_ethread()); // if active queue is over size then close inactive connections if (manage_active_queue() == false) { @@ -728,6 +732,8 @@ void NetHandler::remove_from_active_queue(UnixNetVConnection *vc) { Debug("net_queue", "NetVC: %p", vc); + ink_assert(mutex->thread_holding == this_ethread()); + if (active_queue.in(vc)) { active_queue.remove(vc); --active_queue_size; diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc index 2e9edfc..635c98f 100644 --- a/iocore/net/UnixNetVConnection.cc +++ b/iocore/net/UnixNetVConnection.cc @@ -1451,25 +1451,48 @@ UnixNetVConnection::migrateToCurrentThread(Continuation *cont, EThread *t) void UnixNetVConnection::add_to_keep_alive_queue() { - nh->add_to_keep_alive_queue(this); + MUTEX_TRY_LOCK(lock, nh->mutex, this_ethread()); + if (lock.is_locked()) { +nh->add_to_keep_alive_queue(this); + } else { +ink_release_assert(!"BUG: It must have acquired the NetHandler's lock before doing anything on keep_alive_queue."); + } } void UnixNetVConnection::remove_from_keep_alive_queue() { - nh->remove_from_keep_alive_queue(this); + MUTEX_TRY_LOCK(lock, nh->mutex, this_ethread()); + if (lock.is_locked()) { +nh->remove_from_keep_alive_queue(this); + } else { +ink_release_assert(!"BUG: It must have acquired the NetHandler's lock before doing anything on keep_alive_queue."); + } } bool UnixNetVConnection::add_to_active_queue() { - return nh->add_to_active_queue(this); + bool result = false; + + MUTEX_TRY_LOCK(lock, nh->mutex, this_ethread()); + if (lock.is_locked()) { +result = nh->add_to_active_queue(this); + } else { +ink_release_assert(!"BUG: It must have acquired the NetHandler's lock before doing anything on active_queue."); + } + return result; } void UnixNetVConnection::remove_from_active_queue() { - nh->remove_from_active_queue(this); + MUTEX_TRY_LOCK(lock, nh->mutex, this_ethread()); + if (lock.is_locked()) { +nh->remove_from_active_queue(this); + } else { +ink_release_assert(!"BUG: It must have acquired the NetHandler's lock before doing anything on active_queue."); + } } int
[trafficserver] branch master updated: The mutex of NetAccept::action_->continuation is optional when the EVENT_ERROR event is called back.
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 732dd20 The mutex of NetAccept::action_->continuation is optional when the EVENT_ERROR event is called back. 732dd20 is described below commit 732dd2095547387fb0b51d86460405c668acac78 Author: Oknet Xu AuthorDate: Mon Jan 7 11:48:26 2019 +0800 The mutex of NetAccept::action_->continuation is optional when the EVENT_ERROR event is called back. In general, `NetAccept::action_->continuation` is a type of `ProtocolProbeSessionAccept` object. The mutex of `ProtocolProbeSessionAccept` is NULL to allow parallel accepts. Resolve issue #4726. --- iocore/net/UnixNetAccept.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iocore/net/UnixNetAccept.cc b/iocore/net/UnixNetAccept.cc index 21f39c4..9c3e40f 100644 --- a/iocore/net/UnixNetAccept.cc +++ b/iocore/net/UnixNetAccept.cc @@ -322,7 +322,7 @@ NetAccept::do_blocking_accept(EThread *t) return 0; } if (!action_->cancelled) { -SCOPED_MUTEX_LOCK(lock, action_->mutex, t); +SCOPED_MUTEX_LOCK(lock, action_->mutex ? action_->mutex : t->mutex, t); action_->continuation->handleEvent(EVENT_ERROR, (void *)(intptr_t)res); Warning("accept thread received fatal error: errno = %d", errno); }
[trafficserver] branch master updated: Optimize: tighten the logic of the PluginVC::process_read/write_side()
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 9daeb81 Optimize: tighten the logic of the PluginVC::process_read/write_side() 9daeb81 is described below commit 9daeb81ccc46b62ba340898319a0cadd96b2326c Author: Oknet Xu AuthorDate: Fri Dec 28 18:07:11 2018 +0800 Optimize: tighten the logic of the PluginVC::process_read/write_side() According to the comment on the head of `process_read/write_side`: - To call the `process_read_side()`, the mutexes must be obtained: - PluginVC::mutex - PluginVC::read_state.vio.mutex - To call the `process_write_side()`, the mutexes must be obtained: - PluginVC::mutex - PluginVC::write_state.vio.mutex But it violates the rules when `process_read/write_side()` is called with `other_side_call == true`. The commit makes the code to be compatible with the rules when `other_side_call` is true. This is an update to TS-3339 (0f9dda6). --- proxy/PluginVC.cc | 87 ++- 1 file changed, 54 insertions(+), 33 deletions(-) diff --git a/proxy/PluginVC.cc b/proxy/PluginVC.cc index 85dd7fd..44d4076 100644 --- a/proxy/PluginVC.cc +++ b/proxy/PluginVC.cc @@ -310,6 +310,7 @@ PluginVC::reenable(VIO *vio) { ink_assert(!closed); ink_assert(magic == PLUGIN_VC_MAGIC_ALIVE); + ink_assert(vio->mutex->thread_holding == this_ethread()); Ptr sm_mutex = vio->mutex; SCOPED_MUTEX_LOCK(lock, sm_mutex, this_ethread()); @@ -332,6 +333,7 @@ PluginVC::reenable_re(VIO *vio) { ink_assert(!closed); ink_assert(magic == PLUGIN_VC_MAGIC_ALIVE); + ink_assert(vio->mutex->thread_holding == this_ethread()); Debug("pvc", "[%u] %s: reenable_re %s", core_obj->id, PVC_TYPE, (vio->op == VIO::WRITE) ? "Write" : "Read"); @@ -473,25 +475,13 @@ PluginVC::process_write_side(bool other_side_call) MIOBuffer *core_buffer = (vc_type == PLUGIN_VC_ACTIVE) ? core_obj->a_to_p_buffer : core_obj->p_to_a_buffer; + Debug("pvc", "[%u] %s: process_write_side", core_obj->id, PVC_TYPE); need_write_process = false; + // Check write_state if (write_state.vio.op != VIO::WRITE || closed || write_state.shutdown) { return; } - // Acquire the lock of the write side continuation - EThread *my_ethread = mutex->thread_holding; - ink_assert(my_ethread != nullptr); - MUTEX_TRY_LOCK(lock, write_state.vio.mutex, my_ethread); - if (!lock.is_locked()) { -Debug("pvc_event", "[%u] %s: process_write_side lock miss, retrying", core_obj->id, PVC_TYPE); - -need_write_process = true; -setup_event_cb(PVC_LOCK_RETRY_TIME, _lock_retry_event); -return; - } - - Debug("pvc", "[%u] %s: process_write_side", core_obj->id, PVC_TYPE); - need_write_process = false; // Check the state of our write buffer as well as ntodo int64_t ntodo = write_state.vio.ntodo(); @@ -552,6 +542,30 @@ PluginVC::process_write_side(bool other_side_call) // Wake up the read side on the other side to process these bytes if (!other_side->closed) { if (!other_side_call) { + /* To clear the `need_read_process`, the mutexes must be obtained: + * + * - PluginVC::mutex + * - PluginVC::read_state.vio.mutex + * + */ + if (other_side->read_state.vio.op != VIO::READ || other_side->closed || other_side->read_state.shutdown) { +// Just return, no touch on `other_side->need_read_process`. +return; + } + // Acquire the lock of the read side continuation + EThread *my_ethread = mutex->thread_holding; + ink_assert(my_ethread != nullptr); + MUTEX_TRY_LOCK(lock, other_side->read_state.vio.mutex, my_ethread); + if (!lock.is_locked()) { +Debug("pvc_event", "[%u] %s: process_read_side from other side lock miss, retrying", other_side->core_obj->id, + ((other_side->vc_type == PLUGIN_VC_ACTIVE) ? "Active" : "Passive")); + +// set need_read_process to enforce the read processing +other_side->need_read_process = true; +other_side->setup_event_cb(PVC_LOCK_RETRY_TIME, _side->core_lock_retry_event); +return; + } + other_side->process_read_side(true); } else { other_side->read_state.vio.reenable(); @@ -587,28 +601,11 @@ PluginVC::process_read_side(bool other_side_call) core_reader = core_obj->a_to_p_reader; } - need_read_process = false; - - if (read_state.vio.op != VIO::READ || closed) { -return; - } - // Acquire the lock of the read side continuation - EThread *my_ethread = mute
[trafficserver] branch master updated: Optimize: Do not signal EThreads which are not blocked on cond_timedwait.
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 8ae5611 Optimize: Do not signal EThreads which are not blocked on cond_timedwait. 8ae5611 is described below commit 8ae5611ae1c555198a4ddeda68055ac4ff20afd5 Author: Oknet Xu AuthorDate: Wed Dec 19 20:40:24 2018 +0800 Optimize: Do not signal EThreads which are not blocked on cond_timedwait. From the man page of `pthread_cond_timedwait()`: ``` The pthread_cond_timedwait() function atomically blocks the current thread waiting on the condition variable specified by cond, and releases the mutex specified by mutex. The waiting thread unblocks only after another thread calls pthread_cond_signal(3), or pthread_cond_broadcast(3) with the same condition variable, or if the system time reaches the time specified in abstime, and the current thread reacquires the lock on mutex. ``` Refer to the code of `ProtectedQueue::wait()`, ``` ink_mutex_acquire(); if (INK_ATOMICLIST_EMPTY(al)) { timespec ts = ink_hrtime_to_timespec(timeout); ink_cond_timedwait(_have_data, , ); } ink_mutex_release(); ``` The `EThread::lock` is acquired and then released immediatelly by `ink_cond_timedwait()`. When the thread unblocks, the thread reacquires the lock on `EThread::lock`, and then released immediatelly. Refer to the code of `ProtectedQueue::signal()`, ``` TS_INLINE void ProtectedQueue::signal() { // Need to get the lock before you can signal the thread ink_mutex_acquire(); ink_cond_signal(_have_data); ink_mutex_release(); } ``` The threads that try to send signal to the same target Event Thread are blocked on the mutex and send meaningless wakeup signals one by one. It is not necessory, - To acquire and release the `EThread::lock` again and again in the event loop, - To send wakeup signal to an Event Thread that does not blocked on `pthread_cond_timedwait()`. Changes of the commit: The Event Thread has two status: busy and sleep, - Keep `EThread::lock` locked while Event Thread is busy, - The `EThread::lock` is released while Event Thread is sleep. When other threads try to acquire the `EThread::lock` of the target Event Thread, - Acquired, indicating that the target Event Thread is sleep, must send a wakeup signal to the Event Thread. - Failed, indicating that the target Event Thread is busy, do nothing. Backports: If you backport the commit to the branch without PR#2541, - It is safe to remove `flush_signals()` from the event loop. - Also safe to remove any code related with `ethreads_to_be_signalled[]` and `n_ethreads_to_be_signalled`. - Always do `try_signal()` within `ProtectedQueue::enqueue()`. - Suggest to remove `ProtectedQueue::signal()`. --- iocore/eventsystem/I_EThread.h | 7 ++- iocore/eventsystem/ProtectedQueue.cc | 17 - iocore/eventsystem/UnixEThread.cc| 9 + 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/iocore/eventsystem/I_EThread.h b/iocore/eventsystem/I_EThread.h index 7f62545..8ce926a 100644 --- a/iocore/eventsystem/I_EThread.h +++ b/iocore/eventsystem/I_EThread.h @@ -371,7 +371,12 @@ public: void signalActivity() override { - _q.signal(); + /* Try to acquire the `EThread::lock` of the Event Thread: + * - Acquired, indicating that the Event Thread is sleep, + * must send a wakeup signal to the Event Thread. + * - Failed, indicating that the Event Thread is busy, do nothing. + */ + (void)_q.try_signal(); } ProtectedQueue &_q; diff --git a/iocore/eventsystem/ProtectedQueue.cc b/iocore/eventsystem/ProtectedQueue.cc index c4b5377..bd434e7 100644 --- a/iocore/eventsystem/ProtectedQueue.cc +++ b/iocore/eventsystem/ProtectedQueue.cc @@ -114,15 +114,14 @@ ProtectedQueue::dequeue_external() void ProtectedQueue::wait(ink_hrtime timeout) { - // If there are no external events available, don't do a cond_timedwait. + /* If there are no external events available, will do a cond_timedwait. + * + * - The `EThread::lock` will be released, + * - And then the Event Thread goes to sleep and waits for the wakeup signal of `EThread::might_have_data`, + * - The `EThread::lock` will be locked again when the Event Thread wakes up. + */ if (INK_ATOMICLIST_EMPTY(al)) { -ink_mutex_acquire(); -// The "al" may have new events while waiting for the mutex become available. -// We have to recheck the external queue again. -if (INK_ATOMI
[trafficserver] branch master updated: Optimize: Avoid meaningless lock operations
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new d9732a5 Optimize: Avoid meaningless lock operations d9732a5 is described below commit d9732a5a95d81d963c4b26dccc3a3622e78ac0f5 Author: Oknet Xu AuthorDate: Tue Dec 18 17:18:43 2018 +0800 Optimize: Avoid meaningless lock operations --- iocore/eventsystem/ProtectedQueue.cc | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/iocore/eventsystem/ProtectedQueue.cc b/iocore/eventsystem/ProtectedQueue.cc index bb9466b..c4b5377 100644 --- a/iocore/eventsystem/ProtectedQueue.cc +++ b/iocore/eventsystem/ProtectedQueue.cc @@ -114,10 +114,15 @@ ProtectedQueue::dequeue_external() void ProtectedQueue::wait(ink_hrtime timeout) { - ink_mutex_acquire(); + // If there are no external events available, don't do a cond_timedwait. if (INK_ATOMICLIST_EMPTY(al)) { -timespec ts = ink_hrtime_to_timespec(timeout); -ink_cond_timedwait(_have_data, , ); +ink_mutex_acquire(); +// The "al" may have new events while waiting for the mutex become available. +// We have to recheck the external queue again. +if (INK_ATOMICLIST_EMPTY(al)) { + timespec ts = ink_hrtime_to_timespec(timeout); + ink_cond_timedwait(_have_data, , ); +} +ink_mutex_release(); } - ink_mutex_release(); }
[trafficserver] branch master updated: Correct the statements within ink_assert and ink_release_assert
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 840d7c0 Correct the statements within ink_assert and ink_release_assert 840d7c0 is described below commit 840d7c06e97ed7ab9191a7cf796be5062e54d929 Author: Oknet Xu AuthorDate: Wed Dec 12 11:47:17 2018 +0800 Correct the statements within ink_assert and ink_release_assert --- proxy/http/HttpSM.cc | 8 proxy/logging/LogObject.cc | 2 +- src/tscore/CryptoHash.cc | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 514e9f9..e677a8e 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -1632,7 +1632,7 @@ HttpSM::handle_api_return() state_remove_from_list(EVENT_NONE, nullptr); return; default: -ink_release_assert("! Not reached"); +ink_release_assert(!"Not reached"); break; } @@ -2563,7 +2563,7 @@ HttpSM::state_cache_open_read(int event, void *data) break; default: -ink_release_assert("!Unknown event"); +ink_release_assert(!"Unknown event"); break; } @@ -3980,7 +3980,7 @@ HttpSM::state_remap_request(int event, void * /* data ATS_UNUSED */) } default: -ink_assert("Unexpected event inside state_remap_request"); +ink_assert(!"Unexpected event inside state_remap_request"); break; } @@ -7559,7 +7559,7 @@ HttpSM::set_next_state() } default: { -ink_release_assert("!Unknown next action"); +ink_release_assert(!"Unknown next action"); } } } diff --git a/proxy/logging/LogObject.cc b/proxy/logging/LogObject.cc index c745bdd..6ccb416 100644 --- a/proxy/logging/LogObject.cc +++ b/proxy/logging/LogObject.cc @@ -1338,7 +1338,7 @@ LogObjectManager::log(LogAccess *lad) } else if (likely(ret & Log::SKIP)) { RecIncrRawStat(log_rsb, mutex->thread_holding, log_stat_event_log_access_skip_stat, 1); } else { -ink_release_assert("Unexpected result"); +ink_release_assert(!"Unexpected result"); } return ret; diff --git a/src/tscore/CryptoHash.cc b/src/tscore/CryptoHash.cc index fec88fb..926e5f2 100644 --- a/src/tscore/CryptoHash.cc +++ b/src/tscore/CryptoHash.cc @@ -55,7 +55,7 @@ CryptoContext::CryptoContext() break; #endif default: -ink_release_assert("Invalid global URL hash context"); +ink_release_assert(!"Invalid global URL hash context"); }; #if TS_ENABLE_FIPS == 0 static_assert(CryptoContext::OBJ_SIZE >= sizeof(MD5Context), "bad OBJ_SIZE");
[trafficserver] branch master updated: Optimize: Assign nh->mutex to new NetVC first and switch to new mutex within UnixNetVC::acceptEvent
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 9e32c19 Optimize: Assign nh->mutex to new NetVC first and switch to new mutex within UnixNetVC::acceptEvent 9e32c19 is described below commit 9e32c19872870705df255f7dfea46f6eaec226a9 Author: Oknet Xu AuthorDate: Fri Aug 10 15:09:09 2018 +0800 Optimize: Assign nh->mutex to new NetVC first and switch to new mutex within UnixNetVC::acceptEvent --- iocore/net/UnixNetAccept.cc | 58 +++- iocore/net/UnixNetVConnection.cc | 15 +++ 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/iocore/net/UnixNetAccept.cc b/iocore/net/UnixNetAccept.cc index f4ee913..21f39c4 100644 --- a/iocore/net/UnixNetAccept.cc +++ b/iocore/net/UnixNetAccept.cc @@ -113,7 +113,6 @@ net_accept(NetAccept *na, void *ep, bool blockable) vc->id = net_next_connection_number(); vc->con.move(con); vc->submit_time = Thread::get_hrtime(); -vc->mutex = new_ProxyMutex(); vc->action_ = *na->action_; vc->set_is_transparent(na->opt.f_inbound_transparent); vc->set_context(NET_VCONNECTION_IN); @@ -125,10 +124,25 @@ net_accept(NetAccept *na, void *ep, bool blockable) #endif SET_CONTINUATION_HANDLER(vc, (NetVConnHandler)::acceptEvent); +EThread *t; +NetHandler *h; if (e->ethread->is_event_type(na->opt.etype)) { - vc->dispatchEvent(EVENT_NONE, e); + t = e->ethread; + h = get_NetHandler(t); + // Assign NetHandler->mutex to NetVC + vc->mutex = h->mutex; + MUTEX_TRY_LOCK(lock, h->mutex, t); + if (!lock.is_locked()) { +t->schedule_in(vc, HRTIME_MSECONDS(net_retry_delay)); + } else { +vc->handleEvent(EVENT_NONE, e); + } } else { - eventProcessor.schedule_imm(vc, na->opt.etype); + t = eventProcessor.assign_thread(na->opt.etype); + h = get_NetHandler(t); + // Assign NetHandler->mutex to NetVC + vc->mutex = h->mutex; + t->schedule_imm(vc); } } while (loop); @@ -282,12 +296,11 @@ NetAccept::do_blocking_accept(EThread *t) int loop = accept_till_done; UnixNetVConnection *vc = nullptr; Connection con; + con.sock_type = SOCK_STREAM; // do-while for accepting all the connections // added by YTS Team, yamsat do { -ink_hrtime now = Thread::get_hrtime(); - // Throttle accepts while (!opt.backdoor && check_net_throttle(ACCEPT)) { check_throttle_warning(ACCEPT); @@ -296,7 +309,6 @@ NetAccept::do_blocking_accept(EThread *t) goto Lerror; } NET_SUM_DYN_STAT(net_connections_throttled_in_stat, num_throttled); - now = Thread::get_hrtime(); } if ((res = server.accept()) < 0) { @@ -321,6 +333,8 @@ NetAccept::do_blocking_accept(EThread *t) return -1; } +NET_SUM_GLOBAL_DYN_STAT(net_tcp_accept_stat, 1); + // Use 'nullptr' to Bypass thread allocator vc = (UnixNetVConnection *)this->getNetProcessor()->allocate_vc(nullptr); if (unlikely(!vc)) { @@ -328,11 +342,9 @@ NetAccept::do_blocking_accept(EThread *t) } NET_SUM_GLOBAL_DYN_STAT(net_connections_currently_open_stat, 1); -NET_SUM_GLOBAL_DYN_STAT(net_tcp_accept_stat, 1); vc->id = net_next_connection_number(); vc->con.move(con); -vc->submit_time = now; -vc->mutex = new_ProxyMutex(); +vc->submit_time = Thread::get_hrtime(); vc->action_ = *action_; vc->set_is_transparent(opt.f_inbound_transparent); vc->options.packet_mark = opt.packet_mark; @@ -348,8 +360,12 @@ NetAccept::do_blocking_accept(EThread *t) } #endif SET_CONTINUATION_HANDLER(vc, (NetVConnHandler)::acceptEvent); -// eventProcessor.schedule_imm(vc, getEtype()); -eventProcessor.schedule_imm_signal(vc, opt.etype); + +EThread *t= eventProcessor.assign_thread(opt.etype); +NetHandler *h = get_NetHandler(t); +// Assign NetHandler->mutex to NetVC +vc->mutex = h->mutex; +t->schedule_imm_signal(vc); } while (loop); return 1; @@ -406,6 +422,7 @@ NetAccept::acceptFastEvent(int event, void *ep) (void)e; int bufsz, res = 0; Connection con; + con.sock_type = SOCK_STREAM; UnixNetVConnection *vc = nullptr; int loop = accept_till_done; @@ -445,16 +462,6 @@ NetAccept::acceptFastEvent(int event, void *ep) } } } - - if (opt.sockopt_flags & NetVCOptions::SOCK_OPT_NO_DELAY) { -safe_setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, SOCKOPT_ON, sizeof(int)); -Debug("socket", "::acceptFastEvent: setsockopt() TCP_NODELAY on socket"); - } - -
[trafficserver] branch master updated: fix the number of started threads of certain type.
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 5642ab2 fix the number of started threads of certain type. 5642ab2 is described below commit 5642ab204d5ddc1145a0d567a3044eabee539e68 Author: Oknet Xu AuthorDate: Fri Aug 10 00:46:30 2018 +0800 fix the number of started threads of certain type. --- iocore/eventsystem/UnixEventProcessor.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iocore/eventsystem/UnixEventProcessor.cc b/iocore/eventsystem/UnixEventProcessor.cc index 8344650..10a4efd 100644 --- a/iocore/eventsystem/UnixEventProcessor.cc +++ b/iocore/eventsystem/UnixEventProcessor.cc @@ -394,8 +394,8 @@ EventProcessor::initThreadState(EThread *t) { // Run all thread type initialization continuations that match the event types for this thread. for (int i = 0; i < MAX_EVENT_TYPES; ++i) { -thread_group[i]._started++; if (t->is_event_type(i)) { // that event type done here, roll thread start events of that type. + ++thread_group[i]._started; // To avoid race conditions on the event in the spawn queue, create a local one to actually send. // Use the spawn queue event as a read only model. Event *nev = eventAllocator.alloc();
[trafficserver] branch master updated: Optimize: make NetAccept::init_accept_loop has the logic similar to NetAccept::init_accept_per_thread
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 3c5f2fe Optimize: make NetAccept::init_accept_loop has the logic similar to NetAccept::init_accept_per_thread 3c5f2fe is described below commit 3c5f2fe4b87ef8796b0acac7ac89b48da26073c7 Author: Oknet Xu AuthorDate: Wed Aug 1 20:25:38 2018 +0800 Optimize: make NetAccept::init_accept_loop has the logic similar to NetAccept::init_accept_per_thread --- iocore/net/P_NetAccept.h | 4 ++-- iocore/net/UnixNetAccept.cc| 34 +- iocore/net/UnixNetProcessor.cc | 35 +++ 3 files changed, 34 insertions(+), 39 deletions(-) diff --git a/iocore/net/P_NetAccept.h b/iocore/net/P_NetAccept.h index 151753b..d3fe6c2 100644 --- a/iocore/net/P_NetAccept.h +++ b/iocore/net/P_NetAccept.h @@ -95,9 +95,9 @@ struct NetAccept : public Continuation { virtual NetProcessor *getNetProcessor() const; - void init_accept_loop(const char *); virtual void init_accept(EThread *t = nullptr); - virtual void init_accept_per_thread(); + void init_accept_loop(); + void init_accept_per_thread(); virtual void stop_accept(); virtual NetAccept *clone() const; diff --git a/iocore/net/UnixNetAccept.cc b/iocore/net/UnixNetAccept.cc index fb451d7..f4ee913 100644 --- a/iocore/net/UnixNetAccept.cc +++ b/iocore/net/UnixNetAccept.cc @@ -151,13 +151,28 @@ getNetAccept(int ID) // This should be done for low latency, high connection rate sockets. // void -NetAccept::init_accept_loop(const char *thr_name) +NetAccept::init_accept_loop() { + int i, n; + char thr_name[MAX_THREAD_NAME_LENGTH]; size_t stacksize; - + if (do_listen(BLOCKING)) +return; REC_ReadConfigInteger(stacksize, "proxy.config.thread.default.stacksize"); SET_CONTINUATION_HANDLER(this, ::acceptLoopEvent); - eventProcessor.spawn_thread(this, thr_name, stacksize); + + n = opt.accept_threads; + // Fill in accept thread from configuration if necessary. + if (n < 0) { +REC_ReadConfigInteger(n, "proxy.config.accept_threads"); + } + + for (i = 0; i < n; i++) { +NetAccept *a = (i < n - 1) ? clone() : this; +snprintf(thr_name, MAX_THREAD_NAME_LENGTH, "[ACCEPT %d:%d]", i, ats_ip_port_host_order(_addr)); +eventProcessor.spawn_thread(a, thr_name, stacksize); +Debug("iocore_net_accept_start", "Created accept thread #%d for port %d", i + 1, ats_ip_port_host_order(_addr)); + } } // @@ -185,7 +200,7 @@ NetAccept::init_accept(EThread *t) SET_HANDLER((NetAcceptHandler)::acceptEvent); period = -HRTIME_MSECONDS(net_accept_period); - t->schedule_every(this, period, opt.etype); + t->schedule_every(this, period); } void @@ -209,14 +224,7 @@ NetAccept::init_accept_per_thread() n = eventProcessor.thread_group[opt.etype]._count; for (i = 0; i < n; i++) { -NetAccept *a; - -if (i < n - 1) { - a = clone(); -} else { - a = this; -} - +NetAccept *a = (i < n - 1) ? clone() : this; EThread *t = eventProcessor.thread_group[opt.etype]._thread[i]; PollDescriptor *pd = get_PollDescriptor(t); @@ -225,7 +233,7 @@ NetAccept::init_accept_per_thread() } a->mutex = get_NetHandler(t)->mutex; -t->schedule_every(a, period, opt.etype); +t->schedule_every(a, period); } } diff --git a/iocore/net/UnixNetProcessor.cc b/iocore/net/UnixNetProcessor.cc index c61e112..a1e69ec 100644 --- a/iocore/net/UnixNetProcessor.cc +++ b/iocore/net/UnixNetProcessor.cc @@ -90,7 +90,6 @@ UnixNetProcessor::accept_internal(Continuation *cont, int fd, AcceptOptions cons ProxyMutex *mutex = this_ethread()->mutex.get(); int accept_threads = opt.accept_threads; // might be changed. IpEndpoint accept_ip;// local binding address. - char thr_name[MAX_THREAD_NAME_LENGTH]; NetAccept *na = createNetAccept(opt); na->id= ink_atomic_increment(_accept_number, 1); @@ -144,32 +143,20 @@ UnixNetProcessor::accept_internal(Continuation *cont, int fd, AcceptOptions cons if (opt.frequent_accept) { // true if (accept_threads > 0) { - if (0 == na->do_listen(BLOCKING)) { -for (int i = 1; i < accept_threads; ++i) { - NetAccept *a = na->clone(); - snprintf(thr_name, MAX_THREAD_NAME_LENGTH, "[ACCEPT %d:%d]", i - 1, ats_ip_port_host_order(_ip)); - a->init_accept_loop(thr_name); - Debug("iocore_net_accept_start", "Created accept thread #%d for port %d", i, ats_ip_port_host_order(_ip)); -} - -// Start the "template" accept thread last. -Debug("iocore_net_accept_start", "Created accept thread #%d
[trafficserver] branch master updated: Correct the number of available disk shows in fatal message
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new b375d16 Correct the number of available disk shows in fatal message b375d16 is described below commit b375d166ec54b0523320059dbb31185d06302d9e Author: Oknet Xu AuthorDate: Sat Jun 2 15:13:42 2018 +0800 Correct the number of available disk shows in fatal message --- iocore/cache/Cache.cc | 180 +++--- 1 file changed, 84 insertions(+), 96 deletions(-) diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc index 5c085e6..1e06c58 100644 --- a/iocore/cache/Cache.cc +++ b/iocore/cache/Cache.cc @@ -752,115 +752,103 @@ CacheProcessor::diskInitialized() int n_init= ink_atomic_increment(_disk, 1); int bad_disks = 0; int res = 0; - if (n_init == gndisks - 1) { -int i; -for (i = 0; i < gndisks; i++) { - if (DISK_BAD(gdisks[i])) { -bad_disks++; - } -} - -if (bad_disks != 0) { - // Check if this is a fatal error - if (this->waitForCache() == 3 || (bad_disks == gndisks && this->waitForCache() == 2)) { -// This could be passed off to @c cacheInitialized (as with volume config problems) but I think -// the more specific error message here is worth the extra code. -CacheProcessor::initialized = CACHE_INIT_FAILED; -if (cb_after_init) { - cb_after_init(); -} -Fatal("Cache initialization failed - only %d of %d disks were available.", gndisks, theCacheStore.n_disks_in_config); - } + int i; - // still good, create a new array to hold the valid disks. - CacheDisk **p_good_disks; - if ((gndisks - bad_disks) > 0) { -p_good_disks = (CacheDisk **)ats_malloc((gndisks - bad_disks) * sizeof(CacheDisk *)); - } else { -p_good_disks = nullptr; - } + // Wait for all the cache disks are initialized + if (n_init != gndisks - 1) { +return; + } - int insert_at = 0; - for (i = 0; i < gndisks; i++) { -if (DISK_BAD(gdisks[i])) { - delete gdisks[i]; - continue; -} -if (p_good_disks != nullptr) { - p_good_disks[insert_at++] = gdisks[i]; -} + // Check and remove bad disks from gdisks[] + for (i = 0; i < gndisks; i++) { +if (DISK_BAD(gdisks[i])) { + delete gdisks[i]; + gdisks[i] = nullptr; + bad_disks++; +} else if (bad_disks > 0) { + gdisks[i - bad_disks] = gdisks[i]; + gdisks[i] = nullptr; +} + } + if (bad_disks > 0) { +// Update the number of available cache disks +gndisks -= bad_disks; +// Check if this is a fatal error +if (this->waitForCache() == 3 || (0 == gndisks && this->waitForCache() == 2)) { + // This could be passed off to @c cacheInitialized (as with volume config problems) but I think + // the more specific error message here is worth the extra code. + CacheProcessor::initialized = CACHE_INIT_FAILED; + if (cb_after_init) { +cb_after_init(); } - ats_free(gdisks); - gdisks = p_good_disks; - gndisks = gndisks - bad_disks; + Fatal("Cache initialization failed - only %d of %d disks were available.", gndisks, theCacheStore.n_disks_in_config); } + } -/* Practically just took all bad_disks offline so update the stats. */ -RecSetGlobalRawStatSum(cache_rsb, cache_span_offline_stat, bad_disks); -RecIncrGlobalRawStat(cache_rsb, cache_span_failing_stat, -bad_disks); -RecSetGlobalRawStatSum(cache_rsb, cache_span_online_stat, gndisks); + /* Practically just took all bad_disks offline so update the stats. */ + RecSetGlobalRawStatSum(cache_rsb, cache_span_offline_stat, bad_disks); + RecIncrGlobalRawStat(cache_rsb, cache_span_failing_stat, -bad_disks); + RecSetGlobalRawStatSum(cache_rsb, cache_span_online_stat, gndisks); -/* create the cachevol list only if num volumes are greater - than 0. */ -if (config_volumes.num_volumes == 0) { - /* if no volumes, default to just an http cache */ - res = cplist_reconfigure(); -} else { - // else - /* create the cachevol list. */ - cplist_init(); - /* now change the cachevol list based on the config file */ - res = cplist_reconfigure(); -} - -if (res == -1) { - /* problems initializing the volume.config. Punt */ - gnvol = 0; - cacheInitialized(); - return; -} else { - CacheVol *cp = cp_list.head; - for (; cp; cp = cp->link.next) { -cp->vol_rsb = RecAllocateRawStatBlock((int)cache_stat_count); -char vol_stat_str_prefix[256]; -snprintf(vol_stat_str_prefix, sizeof(vol_stat_str_prefix), "proxy.process
[trafficserver] branch master updated: Optimize: define AIO_Reqs::aio_temp_list by ASLL macro
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new a600975 Optimize: define AIO_Reqs::aio_temp_list by ASLL macro a600975 is described below commit a60097569fa433c406439f94a35259274f54d697 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Thu Feb 22 20:02:12 2018 +0800 Optimize: define AIO_Reqs::aio_temp_list by ASLL macro --- iocore/aio/AIO.cc | 48 +--- iocore/aio/I_AIO.h | 8 +--- iocore/aio/P_AIO.h | 23 ++- 3 files changed, 32 insertions(+), 47 deletions(-) diff --git a/iocore/aio/AIO.cc b/iocore/aio/AIO.cc index e760354..0e7f15a 100644 --- a/iocore/aio/AIO.cc +++ b/iocore/aio/AIO.cc @@ -221,15 +221,12 @@ aio_init_fildes(int fildes, int fromAPI = 0) { char thr_name[MAX_THREAD_NAME_LENGTH]; int i; - AIO_Reqs *request = (AIO_Reqs *)ats_malloc(sizeof(AIO_Reqs)); - - memset(request, 0, sizeof(AIO_Reqs)); + AIO_Reqs *request = new AIO_Reqs; INK_WRITE_MEMORY_BARRIER; ink_cond_init(>aio_cond); ink_mutex_init(>aio_mutex); - ink_atomiclist_init(>aio_temp_list, "temp_list", (uintptr_t) & ((AIOCallback *)nullptr)->link); RecInt thread_num; @@ -280,12 +277,7 @@ aio_insert(AIOCallback *op, AIO_Reqs *req) #endif if (op->aiocb.aio_reqprio == AIO_LOWEST_PRIORITY) // http request { -AIOCallback *cb = (AIOCallback *)req->http_aio_todo.tail; -if (!cb) { - req->http_aio_todo.push(op); -} else { - req->http_aio_todo.insert(op, cb); -} +req->http_aio_todo.enqueue(op); } else { AIOCallback *cb = (AIOCallback *)req->aio_todo.tail; @@ -305,23 +297,21 @@ aio_insert(AIOCallback *op, AIO_Reqs *req) static void aio_move(AIO_Reqs *req) { - AIOCallback *next = nullptr, *prev = nullptr, *cb = (AIOCallback *)ink_atomiclist_popall(>aio_temp_list); - /* flip the list */ - if (!cb) { + if (req->aio_temp_list.empty()) { return; } - while (cb->link.next) { -next = (AIOCallback *)cb->link.next; -cb->link.next = prev; -prev = cb; -cb= next; + + AIOCallbackInternal *cbi; + SList(AIOCallbackInternal, alink) aq(req->aio_temp_list.popall()); + + // flip the list + Queue cbq; + while ((cbi = aq.pop())) { +cbq.push(cbi); } - /* fix the last pointer */ - cb->link.next = prev; - for (; cb; cb = next) { -next = (AIOCallback *)cb->link.next; -cb->link.next = nullptr; -cb->link.prev = nullptr; + + AIOCallback *cb; + while ((cb = cbq.pop())) { aio_insert(cb, req); } } @@ -385,15 +375,13 @@ aio_queue_req(AIOCallbackInternal *op, int fromAPI = 0) #ifdef AIO_STATS ink_atomic_increment(>num_temp, 1); #endif -ink_atomiclist_push(>aio_temp_list, op); +req->aio_temp_list.push(op); } else { /* check if any pending requests on the atomic list */ #ifdef AIO_STATS ink_atomic_increment(>num_queue, 1); #endif -if (!INK_ATOMICLIST_EMPTY(req->aio_temp_list)) { - aio_move(req); -} +aio_move(req); /* now put the new request */ aio_insert(op, req); ink_cond_signal(>aio_cond); @@ -475,9 +463,7 @@ aio_thread_main(void *arg) } current_req = my_aio_req; /* check if any pending requests on the atomic list */ - if (!INK_ATOMICLIST_EMPTY(my_aio_req->aio_temp_list)) { -aio_move(my_aio_req); - } + aio_move(my_aio_req); if (!(op = my_aio_req->aio_todo.pop()) && !(op = my_aio_req->http_aio_todo.pop())) { break; } diff --git a/iocore/aio/I_AIO.h b/iocore/aio/I_AIO.h index f7f98f4..70d5c6f 100644 --- a/iocore/aio/I_AIO.h +++ b/iocore/aio/I_AIO.h @@ -102,13 +102,7 @@ struct AIOCallback : public Continuation { int64_t aio_result = 0; int ok(); - AIOCallback() - { -aiocb.aio_reqprio = AIO_DEFAULT_PRIORITY; -#if AIO_MODE == AIO_MODE_NATIVE -memset((void *)&(this->aiocb), 0, sizeof(this->aiocb)); -#endif - } + AIOCallback() {} }; #if AIO_MODE == AIO_MODE_NATIVE diff --git a/iocore/aio/P_AIO.h b/iocore/aio/P_AIO.h index 696d9b5..edc28fa 100644 --- a/iocore/aio/P_AIO.h +++ b/iocore/aio/P_AIO.h @@ -54,7 +54,7 @@ struct AIOCallbackInternal : public AIOCallback { int io_complete(int event, void *data); AIOCallbackInternal() { -memset((char *)&(this->aiocb), 0, sizeof(this->aiocb)); +memset((void *)&(this->aiocb), 0, sizeof(this->aiocb)); SET_HANDLER(::io_complete); } }; @@ -81,12 +81,17 @@ AIOVec::mainEvent(int /* event */, Event *) struct AIO_Reqs; struct AIOCallbackInternal : public AIOCallback { - AIOCallback *first= nullptr; AIO_Reqs *aio_req = nullptr; ink_hrtime sleep_time =
[trafficserver] branch master updated: fix unpredictable diskok within CacheProcessor::start_internal
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 30107ba fix unpredictable diskok within CacheProcessor::start_internal 30107ba is described below commit 30107ba960772d892e64d05c331dbbffbbcf4250 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Fri Mar 2 17:52:34 2018 +0800 fix unpredictable diskok within CacheProcessor::start_internal --- iocore/cache/Cache.cc | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc index e464e19..f38a589 100644 --- a/iocore/cache/Cache.cc +++ b/iocore/cache/Cache.cc @@ -607,7 +607,6 @@ CacheProcessor::start_internal(int flags) fix = !!(flags & PROCESSOR_FIX); check= (flags & PROCESSOR_CHECK) != 0; start_done = 0; - int diskok = 1; Span *sd; /* read the config file and create the data structures corresponding @@ -652,22 +651,22 @@ CacheProcessor::start_internal(int flags) } if (fd >= 0) { + bool diskok = true; if (!sd->file_pathname) { if (!check) { if (ftruncate(fd, blocks * STORE_BLOCK_SIZE) < 0) { Warning("unable to truncate cache file '%s' to %" PRId64 " blocks", path, blocks); -diskok = 0; +diskok = false; } } else { // read-only mode checks struct stat sbuf; - diskok = 0; if (-1 == fstat(fd, )) { fprintf(stderr, "Failed to stat cache file for directory %s\n", path); +diskok = false; } else if (blocks != sbuf.st_size / STORE_BLOCK_SIZE) { fprintf(stderr, "Cache file for directory %s is %" PRId64 " bytes, expected %" PRId64 "\n", path, sbuf.st_size, blocks * static_cast(STORE_BLOCK_SIZE)); - } else { -diskok = 1; +diskok = false; } } } -- To stop receiving notification emails like this one, please contact ok...@apache.org.
[trafficserver] branch master updated: Create a new AIOCallback to call back aio_err_callbck if there is an error from Linux Native AIO
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 42b1a8c Create a new AIOCallback to call back aio_err_callbck if there is an error from Linux Native AIO 42b1a8c is described below commit 42b1a8cb349c0a013a1d72dd7bf3b7c9790224ae Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Sat Feb 24 20:14:33 2018 +0800 Create a new AIOCallback to call back aio_err_callbck if there is an error from Linux Native AIO --- iocore/aio/AIO.cc | 23 +-- iocore/aio/P_AIO.h | 48 +--- 2 files changed, 30 insertions(+), 41 deletions(-) diff --git a/iocore/aio/AIO.cc b/iocore/aio/AIO.cc index 76a6ee6..e760354 100644 --- a/iocore/aio/AIO.cc +++ b/iocore/aio/AIO.cc @@ -495,16 +495,7 @@ aio_thread_main(void *arg) aio_bytes_read += op->aiocb.aio_nbytes; } ink_mutex_release(_req->aio_mutex); - if (cache_op((AIOCallbackInternal *)op) <= 0) { -if (aio_err_callbck) { - AIOCallback *callback_op = new AIOCallbackInternal(); - callback_op->aiocb.aio_fildes = op->aiocb.aio_fildes; - callback_op->aiocb.aio_lio_opcode = op->aiocb.aio_lio_opcode; - callback_op->mutex= aio_err_callbck->mutex; - callback_op->action = aio_err_callbck; - eventProcessor.schedule_imm(callback_op); -} - } + cache_op((AIOCallbackInternal *)op); ink_atomic_increment((int *)_req->requests_queued, -1); #ifdef AIO_STATS ink_atomic_increment((int *)_req->pending, -1); @@ -514,9 +505,7 @@ aio_thread_main(void *arg) op->mutex = op->action.mutex; if (op->thread == AIO_CALLBACK_THREAD_AIO) { SCOPED_MUTEX_LOCK(lock, op->mutex, thr_info->mutex->thread_holding); -if (!op->action.cancelled) { - op->action.continuation->handleEvent(AIO_EVENT_DONE, op); -} +op->handleEvent(EVENT_NONE, nullptr); } else if (op->thread == AIO_CALLBACK_THREAD_ANY) { eventProcessor.schedule_imm_signal(op); } else { @@ -587,7 +576,13 @@ Lagain: } while ((op = complete_list.dequeue()) != nullptr) { -op->handleEvent(event, e); +op->mutex = op->action.mutex; +MUTEX_TRY_LOCK(lock, op->mutex, trigger_event->ethread); +if (!lock.is_locked()) { + trigger_event->ethread->schedule_imm(op); +} else { + op->handleEvent(EVENT_NONE, nullptr); +} } return EVENT_CONT; } diff --git a/iocore/aio/P_AIO.h b/iocore/aio/P_AIO.h index 49f0ba5..696d9b5 100644 --- a/iocore/aio/P_AIO.h +++ b/iocore/aio/P_AIO.h @@ -46,10 +46,10 @@ AIOCallback::ok() return (off_t)aiocb.aio_nbytes == (off_t)aio_result; } -#if AIO_MODE == AIO_MODE_NATIVE - extern Continuation *aio_err_callbck; +#if AIO_MODE == AIO_MODE_NATIVE + struct AIOCallbackInternal : public AIOCallback { int io_complete(int event, void *data); AIOCallbackInternal() @@ -60,21 +60,6 @@ struct AIOCallbackInternal : public AIOCallback { }; TS_INLINE int -AIOCallbackInternal::io_complete(int event, void *data) -{ - (void)event; - (void)data; - - if (!ok() && aio_err_callbck) -eventProcessor.schedule_imm(aio_err_callbck, ET_CALL, AIO_EVENT_DONE); - mutex = action.mutex; - SCOPED_MUTEX_LOCK(lock, mutex, this_ethread()); - if (!action.cancelled) -action.continuation->handleEvent(AIO_EVENT_DONE, this); - return EVENT_DONE; -} - -TS_INLINE int AIOVec::mainEvent(int /* event */, Event *) { ++completed; @@ -104,16 +89,6 @@ struct AIOCallbackInternal : public AIOCallback { AIOCallbackInternal() { SET_HANDLER(::io_complete); } }; -TS_INLINE int -AIOCallbackInternal::io_complete(int event, void *data) -{ - (void)event; - (void)data; - if (!action.cancelled) -action.continuation->handleEvent(AIO_EVENT_DONE, this); - return EVENT_DONE; -} - struct AIO_Reqs { Que(AIOCallback, link) aio_todo; /* queue for holding non-http requests */ Que(AIOCallback, link) http_aio_todo; /* queue for http requests */ @@ -130,6 +105,25 @@ struct AIO_Reqs { }; #endif // AIO_MODE == AIO_MODE_NATIVE + +TS_INLINE int +AIOCallbackInternal::io_complete(int event, void *data) +{ + (void)event; + (void)data; + if (aio_err_callbck && !ok()) { +AIOCallback *err_op = new AIOCallbackInternal(); +err_op->aiocb.aio_fildes = this->aiocb.aio_fildes; +err_op->aiocb.aio_lio_opcode = this->aiocb.aio_lio_opcode; +err_op->mutex= aio_err_callbck->mutex; +err_op->action = aio_err_callbck; +eventProcessor.schedule_imm(err_op); + } + if (!action.cancelled) +action.continua
[trafficserver] branch master updated: Optimize: update ink_thread_create with thread-safe support
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new ab7b372 Optimize: update ink_thread_create with thread-safe support ab7b372 is described below commit ab7b37238cb4c31e6831488947c4226f8514d448 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Thu Nov 9 23:33:49 2017 +0800 Optimize: update ink_thread_create with thread-safe support --- cmd/traffic_manager/MgmtHandlers.cc| 2 +- cmd/traffic_manager/traffic_manager.cc | 6 +++--- iocore/eventsystem/I_Thread.h | 2 +- iocore/eventsystem/Thread.cc | 18 +++--- lib/records/RecLocal.cc| 4 ++-- lib/ts/ink_thread.h| 12 +++- lib/ts/signals.cc | 2 +- lib/ts/test_freelist.cc| 2 +- mgmt/ProcessManager.cc | 2 +- mgmt/api/CoreAPIRemote.cc | 4 ++-- mgmt/api/NetworkUtilsRemote.cc | 4 ++-- proxy/InkIOCoreAPI.cc | 4 +++- 12 files changed, 27 insertions(+), 35 deletions(-) diff --git a/cmd/traffic_manager/MgmtHandlers.cc b/cmd/traffic_manager/MgmtHandlers.cc index dafef1e..b2e3951 100644 --- a/cmd/traffic_manager/MgmtHandlers.cc +++ b/cmd/traffic_manager/MgmtHandlers.cc @@ -266,7 +266,7 @@ mgmt_synthetic_main(void *) mgmt_log("[SyntheticHealthServer] Connect by disallowed client %s, closing\n", inet_ntoa(clientInfo.sin_addr)); close_socket(clientFD); } else { - ink_thread_create(synthetic_thread, (void *), 1, 0, nullptr); + ink_thread_create(nullptr, synthetic_thread, (void *), 1, 0, nullptr); } } diff --git a/cmd/traffic_manager/traffic_manager.cc b/cmd/traffic_manager/traffic_manager.cc index 159f4ae..2d286ba 100644 --- a/cmd/traffic_manager/traffic_manager.cc +++ b/cmd/traffic_manager/traffic_manager.cc @@ -642,7 +642,7 @@ main(int argc, const char **argv) // can keep a consistent euid when create mgmtapi/eventapi unix // sockets in mgmt_synthetic_main thread. // - synthThrId = ink_thread_create(mgmt_synthetic_main, nullptr, 0, 0, nullptr); /* Spin web agent thread */ + ink_thread_create(, mgmt_synthetic_main, nullptr, 0, 0, nullptr); /* Spin web agent thread */ Debug("lm", "Created Web Agent thread (%" PRId64 ")", (int64_t)synthThrId); // Setup the API and event sockets @@ -670,8 +670,8 @@ main(int argc, const char **argv) } umask(oldmask); - ink_thread_create(ts_ctrl_main, , 0, 0, nullptr); - ink_thread_create(event_callback_main, , 0, 0, nullptr); + ink_thread_create(nullptr, ts_ctrl_main, , 0, 0, nullptr); + ink_thread_create(nullptr, event_callback_main, , 0, 0, nullptr); mgmt_log("[TrafficManager] Setup complete\n"); diff --git a/iocore/eventsystem/I_Thread.h b/iocore/eventsystem/I_Thread.h index f053dec..26573c4 100644 --- a/iocore/eventsystem/I_Thread.h +++ b/iocore/eventsystem/I_Thread.h @@ -151,7 +151,7 @@ public: @c nullptr a stack of size @a stacksize is allocated and used. If @a f is present and valid it is called in the thread context. Otherwise the method @c execute is invoked. */ - ink_thread start(const char *name, void *stack, size_t stacksize, ThreadFunction const = ThreadFunction()); + void start(const char *name, void *stack, size_t stacksize, ThreadFunction const = ThreadFunction()); virtual void execute() = 0; diff --git a/iocore/eventsystem/Thread.cc b/iocore/eventsystem/Thread.cc index 4eff26b..cfb51e0 100644 --- a/iocore/eventsystem/Thread.cc +++ b/iocore/eventsystem/Thread.cc @@ -68,7 +68,6 @@ Thread::~Thread() struct thread_data_internal { ThreadFunction f; ///< Function to excecute in the thread. Thread *me;///< The class instance. - ink_mutex mutex; ///< Startup mutex. char name[MAX_THREAD_NAME_LENGTH]; ///< Name for the thread. }; @@ -77,11 +76,6 @@ spawn_thread_internal(void *a) { auto *p = static_cast(a); - { // force wait until parent thread is ready. -ink_scoped_mutex_lock lock(p->mutex); - } - ink_mutex_destroy(>mutex); - p->me->set_specific(); ink_set_thread_name(p->name); @@ -95,21 +89,15 @@ spawn_thread_internal(void *a) return nullptr; } -ink_thread +void Thread::start(const char *name, void *stack, size_t stacksize, ThreadFunction const ) { - auto *p = new thread_data_internal{f, this, {}, {0}}; + auto *p = new thread_data_internal{f, this, ""}; ink_zero(p->name); ink_strlcpy(p->name, name, MAX_THREAD_NAME_LENGTH); - ink_mutex_init(>mutex); if (stacksize == 0) { stacksize = DEFAULT_STACKSIZE; } - { // must force assignment to complete before thread touches "this". -
[trafficserver] branch master updated: Correct the listen_backlog
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 0724e34 Correct the listen_backlog 0724e34 is described below commit 0724e342cd04efb470034d91347f4ea4123c8e21 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Thu Nov 9 17:27:39 2017 +0800 Correct the listen_backlog --- iocore/net/Connection.cc | 2 +- lib/ts/ink_inet.cc | 12 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/iocore/net/Connection.cc b/iocore/net/Connection.cc index d5635d2..e594763 100644 --- a/iocore/net/Connection.cc +++ b/iocore/net/Connection.cc @@ -45,7 +45,7 @@ get_listen_backlog() int listen_backlog; REC_ReadConfigInteger(listen_backlog, "proxy.config.net.listen_backlog"); - return listen_backlog >= 0 ? listen_backlog : ats_tcp_somaxconn(); + return (0 < listen_backlog && listen_backlog <= 65535) ? listen_backlog : ats_tcp_somaxconn(); } // diff --git a/lib/ts/ink_inet.cc b/lib/ts/ink_inet.cc index 0fa4251..8a96985 100644 --- a/lib/ts/ink_inet.cc +++ b/lib/ts/ink_inet.cc @@ -571,19 +571,19 @@ ats_tcp_somaxconn() /* Darwin version ... */ #if HAVE_SYSCTLBYNAME size_t value_size = sizeof(value); - if (sysctlbyname("kern.ipc.somaxconn", , _size, nullptr, 0) == 0) { -return value; + if (sysctlbyname("kern.ipc.somaxconn", , _size, nullptr, 0) < 0) { +value = 0; } -#endif - - std::ifstream f("/proc/sys/net/ipv4/tcp_max_syn_backlog", std::ifstream::in); +#else + std::ifstream f("/proc/sys/net/core/somaxconn", std::ifstream::in); if (f.good()) { f >> value; } +#endif // Default to the compatible value we used before detection. SOMAXCONN is the right // macro to use, but most systems set this to 128, which is just too small. - if (value <= 0) { + if (value <= 0 || value > 65535) { value = 1024; } -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: Optimize: Within udp_read_from_net, change the receive IOBufferBlock size to 2048 bytes
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new e8ed1d1 Optimize: Within udp_read_from_net, change the receive IOBufferBlock size to 2048 bytes e8ed1d1 is described below commit e8ed1d1eec44a4641029da9efd0be0bc47fc1d61 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Thu Nov 9 18:54:31 2017 +0800 Optimize: Within udp_read_from_net, change the receive IOBufferBlock size to 2048 bytes Generally, an UDP packet length is less than MTU size to avoid IP Fragmentation. In order to optimize the use of memory, set the buffer length to 2048 bytes which is the smallest buffer size greater than 1500. The range of 1300 to 1500 is a common Ethernet MTU size. --- iocore/net/UnixUDPNet.cc | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc index 18004cf..4223ceb 100644 --- a/iocore/net/UnixUDPNet.cc +++ b/iocore/net/UnixUDPNet.cc @@ -116,14 +116,14 @@ UDPNetProcessorInternal::udp_read_from_net(UDPNetHandler *nh, UDPConnection *xuc // don't call back connection at this time. int64_t r; int iters = 0; - unsigned max_niov = NET_MAX_IOV; + unsigned max_niov = 32; struct msghdr msg; Ptr chain, next_chain; - struct iovec tiovec[NET_MAX_IOV]; - int64_t size_index = BUFFER_SIZE_INDEX_4K; + struct iovec tiovec[max_niov]; + int64_t size_index = BUFFER_SIZE_INDEX_2K; int64_t buffer_size = BUFFER_SIZE_FOR_INDEX(size_index); - // The max length of receive buffer is NET_MAX_IOV (16) * buffer_size (4096) = 65536 bytes. + // The max length of receive buffer is 32 * buffer_size (2048) = 65536 bytes. // Because the 'UDP Length' is type of uint16_t defined in RFC 768. // And there is 8 octets in 'User Datagram Header' which means the max length of payload is no more than 65527 bytes. do { -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: Implement zero-copy within UDPNetProcessorInternal::udp_read_from_net
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new ed592c1 Implement zero-copy within UDPNetProcessorInternal::udp_read_from_net ed592c1 is described below commit ed592c1a233329d877f7aa37aa03b02565c53a1e Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Sat Oct 21 14:45:39 2017 +0800 Implement zero-copy within UDPNetProcessorInternal::udp_read_from_net --- iocore/eventsystem/I_SocketManager.h | 1 + iocore/eventsystem/P_UnixSocketManager.h | 11 + iocore/net/I_UDPPacket.h | 6 +++ iocore/net/P_UDPPacket.h | 16 +- iocore/net/UnixUDPNet.cc | 85 5 files changed, 108 insertions(+), 11 deletions(-) diff --git a/iocore/eventsystem/I_SocketManager.h b/iocore/eventsystem/I_SocketManager.h index b8ff1d0..d041b72 100644 --- a/iocore/eventsystem/I_SocketManager.h +++ b/iocore/eventsystem/I_SocketManager.h @@ -84,6 +84,7 @@ struct SocketManager { int recv(int s, void *buf, int len, int flags); int recvfrom(int fd, void *buf, int size, int flags, struct sockaddr *addr, socklen_t *addrlen); + int recvmsg(int fd, struct msghdr *m, int flags, void *pOLP = nullptr); int64_t write(int fd, void *buf, int len, void *pOLP = nullptr); int64_t writev(int fd, struct iovec *vector, size_t count); diff --git a/iocore/eventsystem/P_UnixSocketManager.h b/iocore/eventsystem/P_UnixSocketManager.h index b45f745..f9aac98 100644 --- a/iocore/eventsystem/P_UnixSocketManager.h +++ b/iocore/eventsystem/P_UnixSocketManager.h @@ -177,6 +177,17 @@ SocketManager::recvfrom(int fd, void *buf, int size, int flags, struct sockaddr return r; } +TS_INLINE int +SocketManager::recvmsg(int fd, struct msghdr *m, int flags, void * /* pOLP ATS_UNUSED */) +{ + int r; + do { +if (unlikely((r = ::recvmsg(fd, m, flags)) < 0)) + r = -errno; + } while (r == -EINTR); + return r; +} + TS_INLINE int64_t SocketManager::write(int fd, void *buf, int size, void * /* pOLP ATS_UNUSED */) { diff --git a/iocore/net/I_UDPPacket.h b/iocore/net/I_UDPPacket.h index dc6f455..df899ff 100644 --- a/iocore/net/I_UDPPacket.h +++ b/iocore/net/I_UDPPacket.h @@ -102,5 +102,11 @@ extern UDPPacket *new_UDPPacket(); */ extern UDPPacket *new_incoming_UDPPacket(struct sockaddr *from, char *buf, int len); +/** + Create a new packet to be delivered to application. + Internal function only +*/ +extern UDPPacket *new_incoming_UDPPacket(struct sockaddr *from, Ptr ); + //@} #endif //__I_UDPPACKET_H_ diff --git a/iocore/net/P_UDPPacket.h b/iocore/net/P_UDPPacket.h index 0c37a39..18e216d 100644 --- a/iocore/net/P_UDPPacket.h +++ b/iocore/net/P_UDPPacket.h @@ -207,7 +207,7 @@ new_UDPPacket(struct sockaddr const *to, ink_hrtime when, IOBufferBlock *buf, in } TS_INLINE UDPPacket * -new_UDPPacket(struct sockaddr const *to, ink_hrtime when, Ptr buf) +new_UDPPacket(struct sockaddr const *to, ink_hrtime when, Ptr ) { UDPPacketInternal *p = udpPacketAllocator.alloc(); @@ -246,6 +246,20 @@ new_incoming_UDPPacket(struct sockaddr *from, char *buf, int len) } TS_INLINE UDPPacket * +new_incoming_UDPPacket(struct sockaddr *from, Ptr ) +{ + UDPPacketInternal *p = udpPacketAllocator.alloc(); + + p->in_the_priority_queue = 0; + p->in_heap = 0; + p->delivery_time = 0; + ats_ip_copy(>from, from); + p->chain = block; + + return p; +} + +TS_INLINE UDPPacket * new_UDPPacket() { UDPPacketInternal *p = udpPacketAllocator.alloc(); diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc index dcf3e7e..18004cf 100644 --- a/iocore/net/UnixUDPNet.cc +++ b/iocore/net/UnixUDPNet.cc @@ -114,26 +114,91 @@ UDPNetProcessorInternal::udp_read_from_net(UDPNetHandler *nh, UDPConnection *xuc // receive packet and queue onto UDPConnection. // don't call back connection at this time. - int r; - int iters = 0; + int64_t r; + int iters = 0; + unsigned max_niov = NET_MAX_IOV; + + struct msghdr msg; + Ptr chain, next_chain; + struct iovec tiovec[NET_MAX_IOV]; + int64_t size_index = BUFFER_SIZE_INDEX_4K; + int64_t buffer_size = BUFFER_SIZE_FOR_INDEX(size_index); + // The max length of receive buffer is NET_MAX_IOV (16) * buffer_size (4096) = 65536 bytes. + // Because the 'UDP Length' is type of uint16_t defined in RFC 768. + // And there is 8 octets in 'User Datagram Header' which means the max length of payload is no more than 65527 bytes. do { +// create IOBufferBlock chain to receive data +unsigned int niov; +IOBufferBlock *b, *last; + +// build struct iov +// reuse the block in chain if available +b= chain.get(); +last = nullptr; +for (niov = 0; niov < max_niov; niov++) { + if (b == nullptr) { +b = new_
[trafficserver] branch master updated: Rework the new udp connection
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 83e50f5 Rework the new udp connection 83e50f5 is described below commit 83e50f5dab49081a223cc4d01005e033a699897e Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Fri Oct 27 22:33:56 2017 +0800 Rework the new udp connection The UDPNetHandler works like the NetHandler. But it is free lock to push a UDPConnection into UDPNetHandler. The UDPNetHandler gets new UDPConnection from newconn_list (an atomic list) and push into open_list that saved all opend udp connections. There is no InactivityCop for UDPConnection. The open_list is traversal within UDPNetHandler::mainNetEvent() every second. --- iocore/net/P_UDPNet.h| 25 ++- iocore/net/P_UnixUDPConnection.h | 3 +- iocore/net/UnixUDPConnection.cc | 6 +-- iocore/net/UnixUDPNet.cc | 97 4 files changed, 86 insertions(+), 45 deletions(-) diff --git a/iocore/net/P_UDPNet.h b/iocore/net/P_UDPNet.h index f2f8c0f..509064e 100644 --- a/iocore/net/P_UDPNet.h +++ b/iocore/net/P_UDPNet.h @@ -31,6 +31,7 @@ #ifndef __P_UDPNET_H_ #define __P_UDPNET_H_ +#include "ts/ink_platform.h" #include "I_UDPNet.h" #include "P_UDPPacket.h" @@ -40,7 +41,7 @@ static inline PollCont *get_UDPPollCont(EThread *); #include "P_UnixUDPConnection.h" #include "P_UDPIOEvent.h" -struct UDPNetHandler; +class UDPNetHandler; struct UDPNetProcessorInternal : public UDPNetProcessor { virtual int start(int n_udp_threads, size_t stacksize); @@ -303,19 +304,21 @@ public: void initialize_thread_for_udp_net(EThread *thread); -struct UDPNetHandler : public Continuation { +class UDPNetHandler : public Continuation +{ public: - // to be polled for read - Que(UnixUDPConnection, polling_link) udp_polling; + // engine for outgoing packets + UDPQueue udpOutQueue{}; + + // New UDPConnections + // to hold the newly created descriptors before scheduling them on the servicing buckets. + // atomically added to by a thread creating a new connection with UDPBind + ASLL(UnixUDPConnection, newconn_alink) newconn_list; + // All opened UDPConnections + Que(UnixUDPConnection, link) open_list; // to be called back with data Que(UnixUDPConnection, callback_link) udp_callbacks; - // outgoing packets - UDPQueue udpOutQueue{}; - // to hold the newly created descriptors before scheduling them on - // the servicing buckets. - // atomically added to by a thread creating a new connection with - // UDPBind - InkAtomicList udpNewConnections; + Event *trigger_event = nullptr; ink_hrtime nextCheck; ink_hrtime lastCheck; diff --git a/iocore/net/P_UnixUDPConnection.h b/iocore/net/P_UnixUDPConnection.h index 29b6d82..4815f8a 100644 --- a/iocore/net/P_UnixUDPConnection.h +++ b/iocore/net/P_UnixUDPConnection.h @@ -42,9 +42,8 @@ public: void errorAndDie(int e); int callbackHandler(int event, void *data); - LINK(UnixUDPConnection, polling_link); - LINK(UnixUDPConnection, callback_link); SLINK(UnixUDPConnection, newconn_alink); + LINK(UnixUDPConnection, callback_link); // Incoming UDP Packet Queue ASLL(UDPPacketInternal, alink) inQueue; diff --git a/iocore/net/UnixUDPConnection.cc b/iocore/net/UnixUDPConnection.cc index 9cbab85..4d1eaf3 100644 --- a/iocore/net/UnixUDPConnection.cc +++ b/iocore/net/UnixUDPConnection.cc @@ -109,7 +109,7 @@ UDPConnection::bindToThread(Continuation *c) AddRef(); uc->continuation = c; mutex= c->mutex; - ink_atomiclist_push(_UDPNetHandler(t)->udpNewConnections, uc); + get_UDPNetHandler(t)->newconn_list.push(uc); } Action * @@ -145,8 +145,8 @@ UDPConnection::Release() ink_assert(p->callback_link.next == nullptr); ink_assert(p->callback_link.prev == nullptr); -ink_assert(p->polling_link.next == nullptr); -ink_assert(p->polling_link.prev == nullptr); +ink_assert(p->link.next == nullptr); +ink_assert(p->link.prev == nullptr); ink_assert(p->newconn_alink.next == nullptr); delete this; diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc index 008eafc..dcf3e7e 100644 --- a/iocore/net/UnixUDPNet.cc +++ b/iocore/net/UnixUDPNet.cc @@ -64,8 +64,13 @@ sockaddr_in6 G_bwGrapherLoc; void initialize_thread_for_udp_net(EThread *thread) { + UDPNetHandler *nh = get_UDPNetHandler(thread); + + new ((ink_dummy_for_new *)nh) UDPNetHandler; new ((ink_dummy_for_new *)get_UDPPollCont(thread)) PollCont(thread->mutex); - new ((ink_dummy_for_new *)get_UDPNetHandler(thread)) UDPNetHandler; + // The UDPNetHandler cannot be accessed across EThreads. + // Because the UDPNetHandler should be called back immediately after
[trafficserver] branch master updated: Within UDPConnection::Release(), it should calls the ep.stop() only if the UDPConnection will be closed
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 0b52a1a Within UDPConnection::Release(), it should calls the ep.stop() only if the UDPConnection will be closed 0b52a1a is described below commit 0b52a1abfb1d19b7405f2f62006485db662af075 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Mon Oct 30 12:16:32 2017 +0800 Within UDPConnection::Release(), it should calls the ep.stop() only if the UDPConnection will be closed --- iocore/net/UnixUDPConnection.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iocore/net/UnixUDPConnection.cc b/iocore/net/UnixUDPConnection.cc index d372e07..9cbab85 100644 --- a/iocore/net/UnixUDPConnection.cc +++ b/iocore/net/UnixUDPConnection.cc @@ -140,9 +140,9 @@ UDPConnection::Release() { UnixUDPConnection *p = (UnixUDPConnection *)this; - p->ep.stop(); - if (ink_atomic_increment(>refcount, -1) == 1) { +p->ep.stop(); + ink_assert(p->callback_link.next == nullptr); ink_assert(p->callback_link.prev == nullptr); ink_assert(p->polling_link.next == nullptr); -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: Optimize: define UDPQueue::atomicQueue by ASLL macro and rename to outQueue
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new e920894 Optimize: define UDPQueue::atomicQueue by ASLL macro and rename to outQueue e920894 is described below commit e9208947a483dd543f06945167168c85ed3de35a Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Fri Oct 27 16:31:09 2017 +0800 Optimize: define UDPQueue::atomicQueue by ASLL macro and rename to outQueue --- iocore/net/P_UDPNet.h| 4 ++-- iocore/net/UnixUDPNet.cc | 55 2 files changed, 25 insertions(+), 34 deletions(-) diff --git a/iocore/net/P_UDPNet.h b/iocore/net/P_UDPNet.h index a093bb8..f2f8c0f 100644 --- a/iocore/net/P_UDPNet.h +++ b/iocore/net/P_UDPNet.h @@ -286,7 +286,8 @@ class UDPQueue int added = 0; public: - InkAtomicList atomicQueue{}; + // Outgoing UDP Packet Queue + ASLL(UDPPacketInternal, alink) outQueue; void service(UDPNetHandler *); @@ -309,7 +310,6 @@ public: // to be called back with data Que(UnixUDPConnection, callback_link) udp_callbacks; // outgoing packets - InkAtomicList udpAtomicQueue{}; UDPQueue udpOutQueue{}; // to hold the newly created descriptors before scheduling them on // the servicing buckets. diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc index fdd4076..008eafc 100644 --- a/iocore/net/UnixUDPNet.cc +++ b/iocore/net/UnixUDPNet.cc @@ -652,39 +652,31 @@ UDPQueue::service(UDPNetHandler *nh) ink_hrtime now = Thread::get_hrtime_updated(); uint64_t timeSpent = 0; uint64_t pktSendStartTime; - UDPPacketInternal *p; ink_hrtime pktSendTime; - - p = (UDPPacketInternal *)ink_atomiclist_popall(); - if (p) { -UDPPacketInternal *pnext = nullptr; -Queue stk; - -while (p) { - pnext = p->alink.next; - p->alink.next = nullptr; - stk.push(p); - p = pnext; + UDPPacketInternal *p = nullptr; + + SList(UDPPacketInternal, alink) aq(outQueue.popall()); + Queue stk; + while ((p = aq.pop())) { +stk.push(p); + } + + // walk backwards down list since this is actually an atomic stack. + while ((p = stk.pop())) { +ink_assert(p->link.prev == nullptr); +ink_assert(p->link.next == nullptr); +// insert into our queue. +Debug("udp-send", "Adding %p", p); +if (p->conn->lastPktStartTime == 0) { + pktSendStartTime = std::max(now, p->delivery_time); +} else { + pktSendTime = p->delivery_time; + pktSendStartTime = std::max(std::max(now, pktSendTime), p->delivery_time); } +p->conn->lastPktStartTime = pktSendStartTime; +p->delivery_time = pktSendStartTime; -// walk backwards down list since this is actually an atomic stack. -while (stk.head) { - p = stk.pop(); - ink_assert(p->link.prev == nullptr); - ink_assert(p->link.next == nullptr); - // insert into our queue. - Debug("udp-send", "Adding %p", p); - if (p->conn->lastPktStartTime == 0) { -pktSendStartTime = std::max(now, p->delivery_time); - } else { -pktSendTime = p->delivery_time; -pktSendStartTime = std::max(std::max(now, pktSendTime), p->delivery_time); - } - p->conn->lastPktStartTime = pktSendStartTime; - p->delivery_time = pktSendStartTime; - - pipeInfo.addPacket(p, now); -} +pipeInfo.addPacket(p, now); } pipeInfo.advanceNow(now); @@ -808,7 +800,7 @@ void UDPQueue::send(UDPPacket *p) { // XXX: maybe fastpath for immediate send? - ink_atomiclist_push(, p); + outQueue.push((UDPPacketInternal *)p); } #undef LINK @@ -816,7 +808,6 @@ UDPQueue::send(UDPPacket *p) UDPNetHandler::UDPNetHandler() { mutex = new_ProxyMutex(); - ink_atomiclist_init(, "Outgoing UDP Packet queue", offsetof(UDPPacketInternal, alink.next)); ink_atomiclist_init(, "UDP Connection queue", offsetof(UnixUDPConnection, newconn_alink.next)); nextCheck = Thread::get_hrtime_updated() + HRTIME_MSECONDS(1000); lastCheck = 0; -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: UDPBind with EventIO of UnixUDPConnection.
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 2eb9dd4 UDPBind with EventIO of UnixUDPConnection. 2eb9dd4 is described below commit 2eb9dd41fa68d43b444a04209d78798ba9cb2533 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Tue Oct 17 21:00:55 2017 +0800 UDPBind with EventIO of UnixUDPConnection. --- iocore/net/UnixUDPNet.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc index 6eb127f..fb40bd4 100644 --- a/iocore/net/UnixUDPNet.cc +++ b/iocore/net/UnixUDPNet.cc @@ -621,8 +621,7 @@ UDPNetProcessor::UDPBind(Continuation *cont, sockaddr const *addr, int send_bufs pc = get_UDPPollCont(n->ethread); pd = pc->pollDescriptor; - n->ethread->ep = (EventIO *)ats_malloc(sizeof(EventIO)); - n->ethread->ep->start(pd, n, EVENTIO_READ); + n->ep.start(pd, n, EVENTIO_READ); cont->handleEvent(NET_EVENT_DATAGRAM_OPEN, n); return ACTION_RESULT_DONE; -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: Optimize: rename close_UnixNetVConnection to NetHandler::free_netvc.
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new db30b0a Optimize: rename close_UnixNetVConnection to NetHandler::free_netvc. db30b0a is described below commit db30b0a1a908f05137bdd1130ae7cf731b100b03 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Tue Sep 12 17:00:22 2017 +0800 Optimize: rename close_UnixNetVConnection to NetHandler::free_netvc. EThread is processor of Event, it is the event processor's responsibility to deallocate Event object. (refer to the comments in I_EventProcessor.h, "Event allocation policy" section.) Due to NetHandler is processor of NetVC, it is the NetHandler's responsibility to free NetVC object. Take EThread::free_event() as reference to create NetHandler::free_netvc() from close_UnixNetVConnection(). --- iocore/net/P_UnixNet.h| 61 - iocore/net/P_UnixNetVConnection.h | 1 - iocore/net/SSLNetVConnection.cc | 5 +++ iocore/net/UnixNet.cc | 31 +++ iocore/net/UnixNetVConnection.cc | 64 ++- 5 files changed, 113 insertions(+), 49 deletions(-) diff --git a/iocore/net/P_UnixNet.h b/iocore/net/P_UnixNet.h index e9c6948..c0f6338 100644 --- a/iocore/net/P_UnixNet.h +++ b/iocore/net/P_UnixNet.h @@ -162,6 +162,58 @@ struct PollCont : public Continuation { int pollEvent(int event, Event *e); }; +/** + NetHandler is the processor of NetVC for the Net sub-system. The NetHandler + is the core component of the Net sub-system. Once started, it is responsible + for polling socket fds and perform the I/O tasks in NetVC. + + The NetHandler is executed periodically to perform read/write tasks for + NetVConnection. The NetHandler::mainNetEvent() should be viewed as a part of + EThread::execute() loop. This is the reason that Net System is a sub-system. + + By get_NetHandler(this_ethread()), you can get the NetHandler object that + runs inside the current EThread and then @c startIO / @c stopIO which + assign/release a NetVC to/from NetHandler. Before you call these functions, + holding the mutex of this NetHandler is required. + + The NetVConnection provides a set of do_io functions through which you can + specify continuations to be called back by its NetHandler. These function + calls do not block. Instead they return an VIO object and schedule the + callback to the continuation passed in when there are I/O events occurred. + + Multi-thread scheduler: + + The NetHandler should be viewed as multi-threaded schedulers which process + NetVCs from their queues. The NetVC can be made of NetProcessor (allocate_vc) + either by directly adding a NetVC to the queue (NetHandler::startIO), or more + conveniently, calling a method service call (NetProcessor::connect_re) which + synthesizes the NetVC and places it in the queue. + + Callback event codes: + + These event codes for do_io_read and reenable(read VIO) task: +VC_EVENT_READ_READY, VC_EVENT_READ_COMPLETE, +VC_EVENT_EOS, VC_EVENT_ERROR + + These event codes for do_io_write and reenable(write VIO) task: +VC_EVENT_WRITE_READY, VC_EVENT_WRITE_COMPLETE +VC_EVENT_ERROR + + There is no event and callback for do_io_shutdown / do_io_close task. + + NetVConnection allocation policy: + + NetVCs are allocated by the NetProcessor and deallocated by NetHandler. + A state machine may access the returned, non-recurring NetVC / VIO until + it is closed by do_io_close. For recurring NetVC, the NetVC may be + accessed until it is closed. Once the NetVC is closed, it's the + NetHandler's responsibility to deallocate it. + + Before assign to NetHandler or after release from NetHandler, it's the + NetVC's responsibility to deallocate itself. + + */ + // // NetHandler // @@ -234,7 +286,7 @@ public: @param netvc UnixNetVConnection to be managed by InactivityCop */ void startCop(UnixNetVConnection *netvc); - /* * + /** Stop to handle active timeout and inactivity on a UnixNetVConnection. Remove the netvc from open_list and cop_list. Also remove the netvc from keep_alive_queue and active_queue if its context is IN. @@ -244,6 +296,13 @@ public: */ void stopCop(UnixNetVConnection *netvc); + /** +Release a netvc and free it. + +@param netvc UnixNetVConnection to be deattached. + */ + void free_netvc(UnixNetVConnection *netvc); + NetHandler(); private: diff --git a/iocore/net/P_UnixNetVConnection.h b/iocore/net/P_UnixNetVConnection.h index 513bfd8..ee6bc05 100644 --- a/iocore/net/P_UnixNetVConnection.h +++ b/iocore/net/P_UnixNetVConnection.h @@ -430,7 +430,6 @@ UnixNetVConnection::set_action(Continuation *c) // declarations for local use (within the net
[trafficserver] branch master updated: Optimize: If failed on migrateToCurrentThread, put the server session back to global server session pool
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new c776c66 Optimize: If failed on migrateToCurrentThread, put the server session back to global server session pool c776c66 is described below commit c776c6677b0c005dd511945ae023a14f8f6b0bc3 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Fri Sep 1 22:18:54 2017 +0800 Optimize: If failed on migrateToCurrentThread, put the server session back to global server session pool --- iocore/net/UnixNetVConnection.cc | 74 +++- proxy/http/HttpSessionManager.cc | 24 ++--- 2 files changed, 61 insertions(+), 37 deletions(-) diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc index a4c7769..0e97ffa 100644 --- a/iocore/net/UnixNetVConnection.cc +++ b/iocore/net/UnixNetVConnection.cc @@ -1244,6 +1244,7 @@ UnixNetVConnection::populate(Connection _in, Continuation *c, void *arg) } if (h->startIO(this) < 0) { +con_in.move(this->con); Debug("iocore_net", "populate : Failed to add to epoll list"); return EVENT_ERROR; } @@ -1430,44 +1431,71 @@ UnixNetVConnection::migrateToCurrentThread(Continuation *cont, EThread *t) return this; } - Connection hold_con; - hold_con.move(this->con); - SSLNetVConnection *sslvc = dynamic_cast(this); - - SSL *save_ssl = (sslvc) ? sslvc->ssl : nullptr; - if (save_ssl) { -SSLNetVCDetach(sslvc->ssl); -sslvc->ssl = nullptr; + // Lock the NetHandler first in order to put the new NetVC into NetHandler and InactivityCop. + // It is safe and no performance issue to get the mutex lock for a NetHandler of current ethread. + SCOPED_MUTEX_LOCK(lock, client_nh->mutex, t); + + // Try to get the mutex lock for NetHandler of this NetVC + MUTEX_TRY_LOCK(lock_src, this->nh->mutex, t); + if (lock_src.is_locked()) { +// Deattach this NetVC from original NetHandler & InactivityCop. +this->nh->stopCop(this); +this->nh->stopIO(this); +// Put this NetVC into current NetHandler & InactivityCop. +this->thread = t; +client_nh->startIO(this); +client_nh->startCop(this); +// Move this NetVC to current EThread Successfully. +return this; } - // Do_io_close will signal the VC to be freed on the original thread - // Since we moved the con context, the fd will not be closed - // Go ahead and remove the fd from the original thread's epoll structure, so it is not - // processed on two threads simultaneously - this->ep.stop(); - this->do_io_close(); + // Failed to get the mutex lock for original NetHandler. + // Try to migrate it by create a new NetVC and then move con.fd and ssl ctx. + SSLNetVConnection *sslvc = dynamic_cast(this); + SSL *save_ssl= (sslvc) ? sslvc->ssl : nullptr; + + UnixNetVConnection *ret_vc = nullptr; // Create new VC: if (save_ssl) { SSLNetVConnection *sslvc = static_cast(sslNetProcessor.allocate_vc(t)); -if (sslvc->populate(hold_con, cont, save_ssl) != EVENT_DONE) { - sslvc->do_io_close(); - sslvc = nullptr; +if (sslvc->populate(this->con, cont, save_ssl) != EVENT_DONE) { + sslvc->free(t); + sslvc = nullptr; + ret_vc = this; } else { sslvc->set_context(get_context()); + ret_vc = dynamic_cast(sslvc); } -return sslvc; -// Update the SSL fields } else { UnixNetVConnection *netvc = static_cast(netProcessor.allocate_vc(t)); -if (netvc->populate(hold_con, cont, save_ssl) != EVENT_DONE) { - netvc->do_io_close(); - netvc = nullptr; +if (netvc->populate(this->con, cont, save_ssl) != EVENT_DONE) { + netvc->free(t); + netvc = nullptr; + ret_vc = this; } else { netvc->set_context(get_context()); + ret_vc = netvc; } -return netvc; } + + // clear con.fd and ssl ctx from this NetVC since a new NetVC is created. + if (ret_vc != this) { +if (save_ssl) { + SSLNetVCDetach(sslvc->ssl); + sslvc->ssl = nullptr; +} +ink_assert(this->con.fd == NO_FD); + +// Do_io_close will signal the VC to be freed on the original thread +// Since we moved the con context, the fd will not be closed +// Go ahead and remove the fd from the original thread's epoll structure, so it is not +// processed on two threads simultaneously +this->ep.stop(); +this->do_io_close(); + } + + return ret_vc; } void diff --git a/proxy/http/HttpSessionManager.cc b/proxy/http/HttpSessionManager.cc index 1e4334a..49450f2 100644 --- a/proxy/http/HttpSessionManager.cc +++ b/proxy/http/HttpSessionManager.cc @@ -326,21 +326,17 @@ HttpSessionManager::acquire_session(Contin
[trafficserver] branch master updated: Support dynamic registration to StatPages.
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new f773210 Support dynamic registration to StatPages. f773210 is described below commit f773210e6ab9c0e920e54644b4924d5f61d62ebf Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Thu Sep 28 17:22:14 2017 +0800 Support dynamic registration to StatPages. The cache stat module will register to StatPages after cache system initialized. But there is not a mutex to protect the stat_pages[] array. It will leads a rare crash when proxy.config.http.wait_for_cache is false. --- proxy/StatPages.cc | 3 +++ proxy/StatPages.h | 1 + 2 files changed, 4 insertions(+) diff --git a/proxy/StatPages.cc b/proxy/StatPages.cc index b48946f..db22090 100644 --- a/proxy/StatPages.cc +++ b/proxy/StatPages.cc @@ -49,17 +49,20 @@ static volatile int n_stat_pages = 0; void StatPagesManager::init() { + ink_mutex_init(_pages_mutex); REC_EstablishStaticConfigInt32(m_enabled, "proxy.config.http_ui_enabled"); } void StatPagesManager::register_http(const char *module, StatPagesFunc func) { + ink_mutex_acquire(_pages_mutex); ink_release_assert(n_stat_pages < MAX_STAT_PAGES); stat_pages[n_stat_pages].module = (char *)ats_malloc(strlen(module) + 3); snprintf(stat_pages[n_stat_pages].module, strlen(module) + 3, "{%s}", module); stat_pages[n_stat_pages++].func = func; + ink_mutex_release(_pages_mutex); } Action * diff --git a/proxy/StatPages.h b/proxy/StatPages.h index ba78ec7..3235b65 100644 --- a/proxy/StatPages.h +++ b/proxy/StatPages.h @@ -84,6 +84,7 @@ struct StatPagesManager { bool is_stat_page(URL *url); bool is_cache_inspector_page(URL *url); int m_enabled; + ink_mutex stat_pages_mutex; }; inkcoreapi extern StatPagesManager statPagesManager; -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: Optimize: Add startCop & stopCop for InactivityCop
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 5b7aabc Optimize: Add startCop & stopCop for InactivityCop 5b7aabc is described below commit 5b7aabccaec0de5d603b9b12e68a9d37ae208baf Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Tue Sep 12 15:37:33 2017 +0800 Optimize: Add startCop & stopCop for InactivityCop startCop: put a netvc into open_list. All NetVCs in the open_list is checked for timeout by InactivityCop. stopCop: remove the netvc from open_list and cop_list. Also remove the netvc from keep_alive_queue and active_queue if its context is IN. --- iocore/net/P_UnixNet.h | 46 ++-- iocore/net/UnixNetVConnection.cc | 16 ++ 2 files changed, 50 insertions(+), 12 deletions(-) diff --git a/iocore/net/P_UnixNet.h b/iocore/net/P_UnixNet.h index a2200ea..ce76c45 100644 --- a/iocore/net/P_UnixNet.h +++ b/iocore/net/P_UnixNet.h @@ -212,18 +212,38 @@ public: Only be called when holding the mutex of this NetHandler. @param netvc UnixNetVConnection to be managed by this NetHandler. -@return 0 on success, -ERRNO on failure. +@return 0 on success, netvc->nh set to this NetHandler. +-ERRNO on failure. */ int startIO(UnixNetVConnection *netvc); /** Stop to handle read & write event on a UnixNetVConnection. Remove the socket fd of netvc from polling system. -Only be called when holding the mutex of this NetHandler. +Only be called when holding the mutex of this NetHandler and must call stopCop(netvc) first. @param netvc UnixNetVConnection to be released. +@return netvc->nh set to nullptr. */ void stopIO(UnixNetVConnection *netvc); + /** +Start to handle active timeout and inactivity timeout on a UnixNetVConnection. +Put the netvc into open_list. All NetVCs in the open_list is checked for timeout by InactivityCop. +Only be called when holding the mutex of this NetHandler and must call startIO(netvc) first. + +@param netvc UnixNetVConnection to be managed by InactivityCop + */ + void startCop(UnixNetVConnection *netvc); + /* * +Stop to handle active timeout and inactivity on a UnixNetVConnection. +Remove the netvc from open_list and cop_list. +Also remove the netvc from keep_alive_queue and active_queue if its context is IN. +Only be called when holding the mutex of this NetHandler. + +@param netvc UnixNetVConnection to be released. + */ + void stopCop(UnixNetVConnection *netvc); + NetHandler(); private: @@ -701,4 +721,26 @@ NetHandler::stopIO(UnixNetVConnection *netvc) netvc->nh = nullptr; } + +TS_INLINE void +NetHandler::startCop(UnixNetVConnection *netvc) +{ + ink_assert(this->mutex->thread_holding == this_ethread()); + ink_release_assert(netvc->nh == this); + ink_assert(!open_list.in(netvc)); + + open_list.enqueue(netvc); +} + +TS_INLINE void +NetHandler::stopCop(UnixNetVConnection *netvc) +{ + ink_release_assert(netvc->nh == this); + + open_list.remove(netvc); + cop_list.remove(netvc); + remove_from_keep_alive_queue(netvc); + remove_from_active_queue(netvc); +} + #endif diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc index a47ee31..63d5ba0 100644 --- a/iocore/net/UnixNetVConnection.cc +++ b/iocore/net/UnixNetVConnection.cc @@ -95,10 +95,7 @@ close_UnixNetVConnection(UnixNetVConnection *vc, EThread *t) if (nh) { // 2. Release vc from InactivityCop. -nh->open_list.remove(vc); -nh->cop_list.remove(vc); -vc->remove_from_keep_alive_queue(); -vc->remove_from_active_queue(); +nh->stopCop(vc); // 3. Release vc from NetHandler. nh->stopIO(vc); } @@ -1142,8 +1139,8 @@ UnixNetVConnection::acceptEvent(int event, Event *e) // Setup a timeout callback handler. SET_HANDLER((NetVConnHandler)::mainEvent); - // All NetVCs in the open_list is checked for timeout by InactivityCop. - nh->open_list.enqueue(this); + // Send this netvc to InactivityCop. + nh->startCop(this); if (inactivity_timeout_in) { UnixNetVConnection::set_inactivity_timeout(inactivity_timeout_in); @@ -1253,8 +1250,7 @@ UnixNetVConnection::populate(Connection _in, Continuation *c, void *arg) ink_assert(this->nh != nullptr); SET_HANDLER(::mainEvent); - ink_assert(!nh->open_list.in(this)); - this->nh->open_list.enqueue(this); + this->nh->startCop(this); ink_assert(this->con.fd != NO_FD); return EVENT_DONE; } @@ -1335,8 +1331,8 @@ UnixNetVConnection::connectUp(EThread *t, int fd) // Setup a timeout callback handler. SET_HANDLER(::mainEvent); - // All NetVCs in the open_list is checked for timeout by Inactivi
[trafficserver] branch master updated: Optimize: Add startIO & stopIO for NetHandler
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 2006b17 Optimize: Add startIO & stopIO for NetHandler 2006b17 is described below commit 2006b1756f0d192bb5bfb51512ded91237f7e1e7 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Tue Aug 29 22:41:49 2017 +0800 Optimize: Add startIO & stopIO for NetHandler startIO: put a netvc into NetHandler and start to polling read & write event. stopIO: stop polling read & write event and release a netvc from NetHandler. --- iocore/net/P_SSLNetVConnection.h | 1 + iocore/net/P_UnixNet.h| 62 + iocore/net/P_UnixNetVConnection.h | 1 + iocore/net/SSLNetVConnection.cc | 49 ++--- iocore/net/UnixNetAccept.cc | 18 +++ iocore/net/UnixNetVConnection.cc | 111 ++ 6 files changed, 149 insertions(+), 93 deletions(-) diff --git a/iocore/net/P_SSLNetVConnection.h b/iocore/net/P_SSLNetVConnection.h index 59733d3..76b8284 100644 --- a/iocore/net/P_SSLNetVConnection.h +++ b/iocore/net/P_SSLNetVConnection.h @@ -90,6 +90,7 @@ class SSLNetVConnection : public UnixNetVConnection public: int sslStartHandShake(int event, int ) override; + void clear() override; void free(EThread *t) override; virtual void diff --git a/iocore/net/P_UnixNet.h b/iocore/net/P_UnixNet.h index 9b1f623..a2200ea 100644 --- a/iocore/net/P_UnixNet.h +++ b/iocore/net/P_UnixNet.h @@ -206,6 +206,24 @@ public: void remove_from_active_queue(UnixNetVConnection *vc); void configure_per_thread(); + /** +Start to handle read & write event on a UnixNetVConnection. +Initial the socket fd of netvc for polling system. +Only be called when holding the mutex of this NetHandler. + +@param netvc UnixNetVConnection to be managed by this NetHandler. +@return 0 on success, -ERRNO on failure. + */ + int startIO(UnixNetVConnection *netvc); + /** +Stop to handle read & write event on a UnixNetVConnection. +Remove the socket fd of netvc from polling system. +Only be called when holding the mutex of this NetHandler. + +@param netvc UnixNetVConnection to be released. + */ + void stopIO(UnixNetVConnection *netvc); + NetHandler(); private: @@ -639,4 +657,48 @@ EventIO::stop() return 0; } +TS_INLINE int +NetHandler::startIO(UnixNetVConnection *netvc) +{ + ink_assert(this->mutex->thread_holding == this_ethread()); + ink_assert(netvc->thread == this_ethread()); + int res = 0; + + PollDescriptor *pd = get_PollDescriptor(trigger_event->ethread); + if (netvc->ep.start(pd, netvc, EVENTIO_READ | EVENTIO_WRITE) < 0) { +res = errno; +// EEXIST should be ok, though it should have been cleared before we got back here +if (errno != EEXIST) { + Debug("iocore_net", "NetHandler::startIO : failed on EventIO::start, errno = [%d](%s)", errno, strerror(errno)); + return -res; +} + } + + if (netvc->read.triggered == 1) { +read_ready_list.enqueue(netvc); + } + netvc->nh = this; + return res; +} + +TS_INLINE void +NetHandler::stopIO(UnixNetVConnection *netvc) +{ + ink_release_assert(netvc->nh == this); + + netvc->ep.stop(); + + read_ready_list.remove(netvc); + write_ready_list.remove(netvc); + if (netvc->read.in_enabled_list) { +read_enable_list.remove(netvc); +netvc->read.in_enabled_list = 0; + } + if (netvc->write.in_enabled_list) { +write_enable_list.remove(netvc); +netvc->write.in_enabled_list = 0; + } + + netvc->nh = nullptr; +} #endif diff --git a/iocore/net/P_UnixNetVConnection.h b/iocore/net/P_UnixNetVConnection.h index c86a136..72e86a8 100644 --- a/iocore/net/P_UnixNetVConnection.h +++ b/iocore/net/P_UnixNetVConnection.h @@ -276,6 +276,7 @@ public: * This is logic is invoked when the NetVC object is created in a new thread context */ virtual int populate(Connection , Continuation *c, void *arg); + virtual void clear(); virtual void free(EThread *t); ink_hrtime get_inactivity_timeout() override; diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc index 9674550..b5d1534 100644 --- a/iocore/net/SSLNetVConnection.cc +++ b/iocore/net/SSLNetVConnection.cc @@ -847,40 +847,8 @@ SSLNetVConnection::do_io_close(int lerrno) } void -SSLNetVConnection::free(EThread *t) +SSLNetVConnection::clear() { - got_remote_addr = false; - got_local_addr = false; - read.vio.mutex.clear(); - write.vio.mutex.clear(); - this->mutex.clear(); - action_.mutex.clear(); - this->ep.stop(); - this->con.close(); - flags = 0; - - SET_CONTINUATION_HANDLER(this, (SSLNetVConnHandler)::startEvent); - - if (nh) { -nh->read_ready_list
[trafficserver] branch master updated: Coverity: CID 1380282: Error handling issues (CHECKED_RETURN)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 55f7449 Coverity: CID 1380282: Error handling issues (CHECKED_RETURN) 55f7449 is described below commit 55f7449ef3dc12224182a820a087911906917f4c Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Mon Sep 4 23:45:22 2017 +0800 Coverity: CID 1380282: Error handling issues (CHECKED_RETURN) --- proxy/InkAPITest.cc | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc index 6ed87d3..a73ce52 100644 --- a/proxy/InkAPITest.cc +++ b/proxy/InkAPITest.cc @@ -1622,12 +1622,13 @@ REGRESSION_TEST(SDK_API_TSMutexCreate)(RegressionTest *test, int /* atype ATS_UN TSMutexLock(mutexp); /* This is normal because all locking is from the same thread */ - TSReturnCode lock = TS_ERROR; + TSReturnCode lock1 = TS_ERROR; + TSReturnCode lock2 = TS_ERROR; - TSMutexLockTry(mutexp); - lock = TSMutexLockTry(mutexp); + lock1 = TSMutexLockTry(mutexp); + lock2 = TSMutexLockTry(mutexp); - if (TS_SUCCESS == lock) { + if (TS_SUCCESS == lock1 && TS_SUCCESS == lock2) { SDK_RPRINT(test, "TSMutexCreate", "TestCase1", TC_PASS, "ok"); SDK_RPRINT(test, "TSMutexLock", "TestCase1", TC_PASS, "ok"); SDK_RPRINT(test, "TSMutexLockTry", "TestCase1", TC_PASS, "ok"); -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: Coverity: CID 1380037: Resource leaks (RESOURCE_LEAK)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new e3e3577 Coverity: CID 1380037: Resource leaks (RESOURCE_LEAK) e3e3577 is described below commit e3e3577a6024b9550acbb23e3e2b2ae20528bd3d Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Wed Aug 30 20:43:41 2017 +0800 Coverity: CID 1380037: Resource leaks (RESOURCE_LEAK) --- lib/ts/ink_sock.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ts/ink_sock.cc b/lib/ts/ink_sock.cc index c8bb6d1..167e0ee 100644 --- a/lib/ts/ink_sock.cc +++ b/lib/ts/ink_sock.cc @@ -292,7 +292,7 @@ bind_unix_domain_socket(const char *path, mode_t mode) if (strlen(path) > sizeof(sockaddr.sun_path) - 1) { errno = ENAMETOOLONG; -return -1; +goto fail; } ink_zero(sockaddr); -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: Make sure the length of socket filename do not exceed the sizeof(sun_path)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 8c5ac5b Make sure the length of socket filename do not exceed the sizeof(sun_path) 8c5ac5b is described below commit 8c5ac5be9656cba3a196a7d78ead52ccb7e7c264 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Fri Aug 25 19:13:56 2017 +0800 Make sure the length of socket filename do not exceed the sizeof(sun_path) --- lib/ts/ink_sock.cc | 5 + mgmt/ProcessManager.cc | 5 + mgmt/api/NetworkUtilsRemote.cc | 11 +-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/ts/ink_sock.cc b/lib/ts/ink_sock.cc index 6f694d2..c8bb6d1 100644 --- a/lib/ts/ink_sock.cc +++ b/lib/ts/ink_sock.cc @@ -290,6 +290,11 @@ bind_unix_domain_socket(const char *path, mode_t mode) return sockfd; } + if (strlen(path) > sizeof(sockaddr.sun_path) - 1) { +errno = ENAMETOOLONG; +return -1; + } + ink_zero(sockaddr); sockaddr.sun_family = AF_UNIX; ink_strlcpy(sockaddr.sun_path, path, sizeof(sockaddr.sun_path)); diff --git a/mgmt/ProcessManager.cc b/mgmt/ProcessManager.cc index bdd90af..fd6df44 100644 --- a/mgmt/ProcessManager.cc +++ b/mgmt/ProcessManager.cc @@ -302,6 +302,11 @@ ProcessManager::initLMConnection() int servlen; struct sockaddr_un serv_addr; + if (sockpath.length() > sizeof(serv_addr.sun_path) - 1) { +errno = ENAMETOOLONG; +Fatal("Unable to create socket '%s': %s", sockpath.c_str(), strerror(errno)); + } + /* Setup Connection to LocalManager */ memset((char *)_addr, 0, sizeof(serv_addr)); serv_addr.sun_family = AF_UNIX; diff --git a/mgmt/api/NetworkUtilsRemote.cc b/mgmt/api/NetworkUtilsRemote.cc index d0c7152..ca5914d 100644 --- a/mgmt/api/NetworkUtilsRemote.cc +++ b/mgmt/api/NetworkUtilsRemote.cc @@ -114,7 +114,14 @@ ts_connect() if (!main_socket_path || !event_socket_path) { goto ERROR; } - + // make sure the length of main_socket_path do not exceed the sizeof(sun_path) + if (strlen(main_socket_path) > sizeof(client_sock.sun_path) - 1) { +goto ERROR; + } + // make sure the length of event_socket_path do not exceed the sizeof(sun_path) + if (strlen(event_socket_path) > sizeof(client_event_sock.sun_path) - 1) { +goto ERROR; + } // create a socket main_socket_fd = socket(AF_UNIX, SOCK_STREAM, 0); if (main_socket_fd < 0) { @@ -146,7 +153,7 @@ ts_connect() // setup Unix domain socket memset(_event_sock, 0, sizeof(sockaddr_un)); client_event_sock.sun_family = AF_UNIX; - ink_strlcpy(client_event_sock.sun_path, event_socket_path, sizeof(client_sock.sun_path)); + ink_strlcpy(client_event_sock.sun_path, event_socket_path, sizeof(client_event_sock.sun_path)); #if defined(darwin) || defined(freebsd) sockaddr_len = sizeof(sockaddr_un); #else -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: Optimize acceptFastEvent(): Replace the dup code of UnixNetVConnection::acceptEvent by calling it directly
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 048815a Optimize acceptFastEvent(): Replace the dup code of UnixNetVConnection::acceptEvent by calling it directly 048815a is described below commit 048815af0a50a848786b4d25958934c458426afa Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Thu Aug 24 21:40:35 2017 +0800 Optimize acceptFastEvent(): Replace the dup code of UnixNetVConnection::acceptEvent by calling it directly --- iocore/net/UnixNetAccept.cc | 36 +--- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/iocore/net/UnixNetAccept.cc b/iocore/net/UnixNetAccept.cc index 80042bd..d14da0d 100644 --- a/iocore/net/UnixNetAccept.cc +++ b/iocore/net/UnixNetAccept.cc @@ -352,7 +352,6 @@ NetAccept::acceptFastEvent(int event, void *ep) int bufsz, res = 0; Connection con; - PollDescriptor *pd = get_PollDescriptor(e->ethread); UnixNetVConnection *vc = nullptr; int loop = accept_till_done; @@ -440,36 +439,11 @@ NetAccept::acceptFastEvent(int event, void *ep) vc->options.ip_family = opt.ip_family; vc->apply_options(); vc->set_context(NET_VCONNECTION_IN); -SET_CONTINUATION_HANDLER(vc, (NetVConnHandler)::mainEvent); - -// set thread and nh as acceptEvent does -vc->thread = e->ethread; -vc->nh = get_NetHandler(e->ethread); - -if (vc->ep.start(pd, vc, EVENTIO_READ | EVENTIO_WRITE) < 0) { - Warning("[NetAccept::acceptFastEvent]: Error in inserting fd[%d] in kevent\n", vc->con.fd); - close_UnixNetVConnection(vc, e->ethread); - return EVENT_DONE; -} - -ink_assert(vc->nh->mutex->thread_holding == this_ethread()); -vc->set_inactivity_timeout(0); -vc->nh->open_list.enqueue(vc); - -#ifdef USE_EDGE_TRIGGER -// Set the vc as triggered and place it in the read ready queue in case there is already data on the socket. -Debug("iocore_net", "acceptEvent : Setting triggered and adding to the read ready queue"); -vc->read.triggered = 1; -vc->nh->read_ready_list.enqueue(vc); -#endif - -if (!action_->cancelled) { - // We must be holding the lock already to do later do_io_read's - SCOPED_MUTEX_LOCK(lock, vc->mutex, e->ethread); - action_->continuation->handleEvent(NET_EVENT_ACCEPT, vc); -} else { - close_UnixNetVConnection(vc, e->ethread); -} +vc->action_ = *action_; +SET_CONTINUATION_HANDLER(vc, (NetVConnHandler)::acceptEvent); +// We must be holding the lock already to do later do_io_read's +SCOPED_MUTEX_LOCK(lock, vc->mutex, e->ethread); +vc->handleEvent(EVENT_NONE, nullptr); vc = nullptr; } while (loop); -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: Coverity CID 1380022: FORWARD_NULL
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new dc6e7ea Coverity CID 1380022: FORWARD_NULL dc6e7ea is described below commit dc6e7ea9604853ae11a328724420d80601c4262f Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Tue Aug 29 15:01:45 2017 +0800 Coverity CID 1380022: FORWARD_NULL --- iocore/net/UnixNetVConnection.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc index 81c707c..25e1582 100644 --- a/iocore/net/UnixNetVConnection.cc +++ b/iocore/net/UnixNetVConnection.cc @@ -1145,7 +1145,7 @@ UnixNetVConnection::acceptEvent(int event, Event *e) PollDescriptor *pd = get_PollDescriptor(thread); if (ep.start(pd, this, EVENTIO_READ | EVENTIO_WRITE) < 0) { Debug("iocore_net", "acceptEvent : failed EventIO::start"); -close_UnixNetVConnection(this, e->ethread); +close_UnixNetVConnection(this, t); return EVENT_DONE; } -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: Coverity 1379933: Control flow issues (DEADCODE)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new b4128c5 Coverity 1379933: Control flow issues (DEADCODE) b4128c5 is described below commit b4128c56dd5668858cc0c606c0e899d444aaca79 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Mon Aug 28 10:18:21 2017 +0800 Coverity 1379933: Control flow issues (DEADCODE) --- iocore/net/UnixNetAccept.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/iocore/net/UnixNetAccept.cc b/iocore/net/UnixNetAccept.cc index 4f748be..80042bd 100644 --- a/iocore/net/UnixNetAccept.cc +++ b/iocore/net/UnixNetAccept.cc @@ -479,9 +479,6 @@ Ldone: Lerror: server.close(); e->cancel(); - if (vc) { -vc->free(e->ethread); - } NET_DECREMENT_DYN_STAT(net_accepts_currently_open_stat); delete this; return EVENT_DONE; -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: Resign server.pem for autests to 10 years
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new d31adce Resign server.pem for autests to 10 years d31adce is described below commit d31adceb9c3421a4f22b7567d3be1adaa6d53c67 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Mon Aug 28 10:56:16 2017 +0800 Resign server.pem for autests to 10 years --- tests/gold_tests/h2/ssl/server.pem| 20 ++-- tests/gold_tests/remap/ssl/server.pem | 20 ++-- tests/gold_tests/tls/ssl/server.pem | 20 ++-- tests/gold_tests/tls_hooks/ssl/server.pem | 20 ++-- tests/tools/microServer/ssl/server.pem| 20 ++-- 5 files changed, 50 insertions(+), 50 deletions(-) diff --git a/tests/gold_tests/h2/ssl/server.pem b/tests/gold_tests/h2/ssl/server.pem index a1de94f..3584a2e 100644 --- a/tests/gold_tests/h2/ssl/server.pem +++ b/tests/gold_tests/h2/ssl/server.pem @@ -14,19 +14,19 @@ lORoveLvotl4HOruSsMCQQCAx9dV9JUSFoyc1CWILp/FgUH/se4cjQCThGO0DoQQ vGTYmntY7j9WRJ9esQrjdD6Clw8zM/45GIBNwnXzqo7Z -END RSA PRIVATE KEY- -BEGIN CERTIFICATE- -MIICszCCAhwCCQCRJsJJ+mTsdDANBgkqhkiG9w0BAQsFADCBnTELMAkGA1UEBhMC -VVMxCzAJBgNVBAgMAklMMRIwEAYDVQQHDAlDaGFtcGFpZ24xDjAMBgNVBAoMBVlh -aG9vMQ0wCwYDVQQLDARFZGdlMSgwJgYDVQQDDB9qdWljZXByb2R1Y2UuY29ycC5u +MIICszCCAhwCCQCl0Y79KkYjpzANBgkqhkiG9w0BAQUFADCBnTELMAkGA1UEBhMC +VVMxCzAJBgNVBAgTAklMMRIwEAYDVQQHEwlDaGFtcGFpZ24xDjAMBgNVBAoTBVlh +aG9vMQ0wCwYDVQQLEwRFZGdlMSgwJgYDVQQDEx9qdWljZXByb2R1Y2UuY29ycC5u ZTEueWFob28uY29tMSQwIgYJKoZIhvcNAQkBFhVwZXJzaWEuYXppekB5YWhvby5j -b20wHhcNMTYwODI1MjI1NzIxWhcNMTcwODI1MjI1NzIxWjCBnTELMAkGA1UEBhMC -VVMxCzAJBgNVBAgMAklMMRIwEAYDVQQHDAlDaGFtcGFpZ24xDjAMBgNVBAoMBVlh -aG9vMQ0wCwYDVQQLDARFZGdlMSgwJgYDVQQDDB9qdWljZXByb2R1Y2UuY29ycC5u +b20wHhcNMTcwODI4MDI1MjI5WhcNMjcwODI2MDI1MjI5WjCBnTELMAkGA1UEBhMC +VVMxCzAJBgNVBAgTAklMMRIwEAYDVQQHEwlDaGFtcGFpZ24xDjAMBgNVBAoTBVlh +aG9vMQ0wCwYDVQQLEwRFZGdlMSgwJgYDVQQDEx9qdWljZXByb2R1Y2UuY29ycC5u ZTEueWFob28uY29tMSQwIgYJKoZIhvcNAQkBFhVwZXJzaWEuYXppekB5YWhvby5j b20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANYwc6JQX45GZmMDEjwxYT11 uVvuBBInfpYJeU8WIXHrKcX5LUSRcBikiKnlfSnMNRohsu6TElQACc60wQ7Q8KDE lBSsS1FaHzCIl1t1AkXRmz/1H65JSBvrV/6Z1NC+Gp58EbH7Gul8ByC1xaJm5ID1 -Dd++kOPlY5ZI9ZcFS7HLAgMBAAEwDQYJKoZIhvcNAQELBQADgYEAXSVfZ5p1TkhW -QiYq9nfQlBnX2NVaf8ymA8edQR0qH/QBv4/52bNNXC7V/V+ev9LCho2iRMeYYyXB -yo1wBAGR83lS9cF/tOABcYrxjdP54Sfkyh5fomcg8SV7zap6C8mhbV8r3EujbKCx -igH3fMX5F/eRwNCzaMMyQsXaxTJ3trk= +Dd++kOPlY5ZI9ZcFS7HLAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAASZbz+d+DdI+ +ypesJrlBRosXh0w8sIjkUSSdT/OuKEVzfH/dRcb4VZDW/W2gmm0VEqSN2xYYVpW3 +hUsW2J+kByqFqX6selREwo8ui8kkyBJVo0y/MCrGM0C3qw1cSaiKoa5OqlOyO3hb +ZC9IIyWmpBxRmJFfIwS6MoTpe0/ZTJQ= -END CERTIFICATE- diff --git a/tests/gold_tests/remap/ssl/server.pem b/tests/gold_tests/remap/ssl/server.pem index a1de94f..58b9b97 100644 --- a/tests/gold_tests/remap/ssl/server.pem +++ b/tests/gold_tests/remap/ssl/server.pem @@ -14,19 +14,19 @@ lORoveLvotl4HOruSsMCQQCAx9dV9JUSFoyc1CWILp/FgUH/se4cjQCThGO0DoQQ vGTYmntY7j9WRJ9esQrjdD6Clw8zM/45GIBNwnXzqo7Z -END RSA PRIVATE KEY- -BEGIN CERTIFICATE- -MIICszCCAhwCCQCRJsJJ+mTsdDANBgkqhkiG9w0BAQsFADCBnTELMAkGA1UEBhMC -VVMxCzAJBgNVBAgMAklMMRIwEAYDVQQHDAlDaGFtcGFpZ24xDjAMBgNVBAoMBVlh -aG9vMQ0wCwYDVQQLDARFZGdlMSgwJgYDVQQDDB9qdWljZXByb2R1Y2UuY29ycC5u +MIICszCCAhwCCQD4jSkztmlO1TANBgkqhkiG9w0BAQsFADCBnTELMAkGA1UEBhMC +VVMxCzAJBgNVBAgTAklMMRIwEAYDVQQHEwlDaGFtcGFpZ24xDjAMBgNVBAoTBVlh +aG9vMQ0wCwYDVQQLEwRFZGdlMSgwJgYDVQQDEx9qdWljZXByb2R1Y2UuY29ycC5u ZTEueWFob28uY29tMSQwIgYJKoZIhvcNAQkBFhVwZXJzaWEuYXppekB5YWhvby5j -b20wHhcNMTYwODI1MjI1NzIxWhcNMTcwODI1MjI1NzIxWjCBnTELMAkGA1UEBhMC -VVMxCzAJBgNVBAgMAklMMRIwEAYDVQQHDAlDaGFtcGFpZ24xDjAMBgNVBAoMBVlh -aG9vMQ0wCwYDVQQLDARFZGdlMSgwJgYDVQQDDB9qdWljZXByb2R1Y2UuY29ycC5u +b20wHhcNMTcwODI4MDM0NDQ1WhcNMjcwODI2MDM0NDQ1WjCBnTELMAkGA1UEBhMC +VVMxCzAJBgNVBAgTAklMMRIwEAYDVQQHEwlDaGFtcGFpZ24xDjAMBgNVBAoTBVlh +aG9vMQ0wCwYDVQQLEwRFZGdlMSgwJgYDVQQDEx9qdWljZXByb2R1Y2UuY29ycC5u ZTEueWFob28uY29tMSQwIgYJKoZIhvcNAQkBFhVwZXJzaWEuYXppekB5YWhvby5j b20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANYwc6JQX45GZmMDEjwxYT11 uVvuBBInfpYJeU8WIXHrKcX5LUSRcBikiKnlfSnMNRohsu6TElQACc60wQ7Q8KDE lBSsS1FaHzCIl1t1AkXRmz/1H65JSBvrV/6Z1NC+Gp58EbH7Gul8ByC1xaJm5ID1 -Dd++kOPlY5ZI9ZcFS7HLAgMBAAEwDQYJKoZIhvcNAQELBQADgYEAXSVfZ5p1TkhW -QiYq9nfQlBnX2NVaf8ymA8edQR0qH/QBv4/52bNNXC7V/V+ev9LCho2iRMeYYyXB -yo1wBAGR83lS9cF/tOABcYrxjdP54Sfkyh5fomcg8SV7zap6C8mhbV8r3EujbKCx -igH3fMX5F/eRwNCzaMMyQsXaxTJ3trk= +Dd++kOPlY5ZI9ZcFS7HLAgMBAAEwDQYJKoZIhvcNAQELBQADgYEATX7975NdhIbJ +glda+sXI9a86GgOpiuKO+vKubRJQZA+UlPf2vHEONjC2+7Y1aZvZYaKYL74vxGky +zkgp6ANSPl45lqD632x0e1Z7vzW5TkqK1JB2/xH2WgDcQZmP0FuQHzVNs4GjghDr +HCp1+sQDhfPB4aLmLFeyN0TkhdH1N3M= -END CERTIFICATE- diff --git a/tests/gold_tests/tls/ssl/server.pem b
[trafficserver] branch master updated: Correctly Handle EVENT_NONE in UnixNetVConnection::acceptEvent
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new a32f7ed Correctly Handle EVENT_NONE in UnixNetVConnection::acceptEvent a32f7ed is described below commit a32f7ed3e49f595633f59cc44481f42af01f7a58 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Tue Aug 22 15:03:39 2017 +0800 Correctly Handle EVENT_NONE in UnixNetVConnection::acceptEvent --- iocore/net/UnixNetVConnection.cc | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc index c974667..81c707c 100644 --- a/iocore/net/UnixNetVConnection.cc +++ b/iocore/net/UnixNetVConnection.cc @@ -1119,12 +1119,12 @@ UnixNetVConnection::startEvent(int /* event ATS_UNUSED */, Event *e) int UnixNetVConnection::acceptEvent(int event, Event *e) { - thread = e->ethread; + EThread *t = (e == nullptr) ? this_ethread() : e->ethread; - MUTEX_TRY_LOCK(lock, get_NetHandler(thread)->mutex, e->ethread); + MUTEX_TRY_LOCK(lock, get_NetHandler(t)->mutex, t); if (!lock.is_locked()) { if (event == EVENT_NONE) { - thread->schedule_in(this, HRTIME_MSECONDS(net_retry_delay)); + t->schedule_in(this, HRTIME_MSECONDS(net_retry_delay)); return EVENT_DONE; } else { e->schedule_in(HRTIME_MSECONDS(net_retry_delay)); @@ -1132,6 +1132,8 @@ UnixNetVConnection::acceptEvent(int event, Event *e) } } + thread = t; + if (action_.cancelled) { free(thread); return EVENT_DONE; -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: Out-of-bounds while get port from host field
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 25a0de4 Out-of-bounds while get port from host field 25a0de4 is described below commit 25a0de406c9c2e48882bfe3153de53ae3d76fb35 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Tue Aug 22 15:16:14 2017 +0800 Out-of-bounds while get port from host field --- proxy/hdrs/HTTP.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/proxy/hdrs/HTTP.cc b/proxy/hdrs/HTTP.cc index a6746a1..bcdd785 100644 --- a/proxy/hdrs/HTTP.cc +++ b/proxy/hdrs/HTTP.cc @@ -1544,6 +1544,7 @@ HTTPHdr::_fill_target_cache() const { URL *url = this->url_get(); const char *port_ptr; + int port_len; m_target_in_url = false; m_port_in_header = false; @@ -1555,10 +1556,10 @@ HTTPHdr::_fill_target_cache() const m_port_in_header = 0 != url->port_get_raw(); m_host_mime = nullptr; } else if (nullptr != - (m_host_mime = const_cast(this)->get_host_port_values(nullptr, _host_length, _ptr, nullptr))) { + (m_host_mime = const_cast(this)->get_host_port_values(nullptr, _host_length, _ptr, _len))) { m_port = 0; if (port_ptr) { - for (; is_digit(*port_ptr); ++port_ptr) { + for (; port_len > 0 && is_digit(*port_ptr); ++port_ptr, --port_len) { m_port = m_port * 10 + *port_ptr - '0'; } } -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: Avoid closing the last netvc if accept_till_done is set
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 6395adc Avoid closing the last netvc if accept_till_done is set 6395adc is described below commit 6395adc825523d38aea789db7bfce37f7173a298 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Mon Aug 21 20:33:30 2017 +0800 Avoid closing the last netvc if accept_till_done is set --- iocore/net/UnixNetAccept.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/iocore/net/UnixNetAccept.cc b/iocore/net/UnixNetAccept.cc index 1ce7fce..4f748be 100644 --- a/iocore/net/UnixNetAccept.cc +++ b/iocore/net/UnixNetAccept.cc @@ -470,6 +470,7 @@ NetAccept::acceptFastEvent(int event, void *ep) } else { close_UnixNetVConnection(vc, e->ethread); } +vc = nullptr; } while (loop); Ldone: -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: Optimize NetHandler & PollCont and reduce the redundant code
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new fe996a8 Optimize NetHandler & PollCont and reduce the redundant code fe996a8 is described below commit fe996a8d9a34f1194a312f5e52e0c2714c132370 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Mon Aug 21 21:28:16 2017 +0800 Optimize NetHandler & PollCont and reduce the redundant code --- iocore/net/P_UnixNet.h | 3 +- iocore/net/UnixNet.cc | 189 - 2 files changed, 80 insertions(+), 112 deletions(-) diff --git a/iocore/net/P_UnixNet.h b/iocore/net/P_UnixNet.h index b570b91..9b1f623 100644 --- a/iocore/net/P_UnixNet.h +++ b/iocore/net/P_UnixNet.h @@ -196,7 +196,8 @@ public: int startNetEvent(int event, Event *data); int mainNetEvent(int event, Event *data); int mainNetEventExt(int event, Event *data); - void process_enabled_list(NetHandler *); + void process_enabled_list(); + void process_ready_list(); void manage_keep_alive_queue(); bool manage_active_queue(bool ignore_queue_size); void add_to_keep_alive_queue(UnixNetVConnection *vc); diff --git a/iocore/net/UnixNet.cc b/iocore/net/UnixNet.cc index 435d477..4c46342 100644 --- a/iocore/net/UnixNet.cc +++ b/iocore/net/UnixNet.cc @@ -348,32 +348,98 @@ NetHandler::startNetEvent(int event, Event *e) // Move VC's enabled on a different thread to the ready list // void -NetHandler::process_enabled_list(NetHandler *nh) +NetHandler::process_enabled_list() { UnixNetVConnection *vc = nullptr; - SListM(UnixNetVConnection, NetState, read, enable_link) rq(nh->read_enable_list.popall()); + SListM(UnixNetVConnection, NetState, read, enable_link) rq(read_enable_list.popall()); while ((vc = rq.pop())) { vc->ep.modify(EVENTIO_READ); vc->ep.refresh(EVENTIO_READ); vc->read.in_enabled_list = 0; if ((vc->read.enabled && vc->read.triggered) || vc->closed) { - nh->read_ready_list.in_or_enqueue(vc); + read_ready_list.in_or_enqueue(vc); } } - SListM(UnixNetVConnection, NetState, write, enable_link) wq(nh->write_enable_list.popall()); + SListM(UnixNetVConnection, NetState, write, enable_link) wq(write_enable_list.popall()); while ((vc = wq.pop())) { vc->ep.modify(EVENTIO_WRITE); vc->ep.refresh(EVENTIO_WRITE); vc->write.in_enabled_list = 0; if ((vc->write.enabled && vc->write.triggered) || vc->closed) { - nh->write_ready_list.in_or_enqueue(vc); + write_ready_list.in_or_enqueue(vc); } } } // +// Walk through the ready list +// +void +NetHandler::process_ready_list() +{ + UnixNetVConnection *vc = nullptr; + +#if defined(USE_EDGE_TRIGGER) + // UnixNetVConnection * + while ((vc = read_ready_list.dequeue())) { +// Initialize the thread-local continuation flags +set_cont_flags(vc->control_flags); +if (vc->closed) + close_UnixNetVConnection(vc, trigger_event->ethread); +else if (vc->read.enabled && vc->read.triggered) + vc->net_read_io(this, trigger_event->ethread); +else if (!vc->read.enabled) { + read_ready_list.remove(vc); +#if defined(solaris) + if (vc->read.triggered && vc->write.enabled) { +vc->ep.modify(-EVENTIO_READ); +vc->ep.refresh(EVENTIO_WRITE); +vc->writeReschedule(this); + } +#endif +} + } + while ((vc = write_ready_list.dequeue())) { +set_cont_flags(vc->control_flags); +if (vc->closed) + close_UnixNetVConnection(vc, trigger_event->ethread); +else if (vc->write.enabled && vc->write.triggered) + write_to_net(this, vc, trigger_event->ethread); +else if (!vc->write.enabled) { + write_ready_list.remove(vc); +#if defined(solaris) + if (vc->write.triggered && vc->read.enabled) { +vc->ep.modify(-EVENTIO_WRITE); +vc->ep.refresh(EVENTIO_READ); +vc->readReschedule(this); + } +#endif +} + } +#else /* !USE_EDGE_TRIGGER */ + while ((vc = read_ready_list.dequeue())) { +diags->set_override(vc->control.debug_override); +if (vc->closed) + close_UnixNetVConnection(vc, trigger_event->ethread); +else if (vc->read.enabled && vc->read.triggered) + vc->net_read_io(this, trigger_event->ethread); +else if (!vc->read.enabled) + vc->ep.modify(-EVENTIO_READ); + } + while ((vc = write_ready_list.dequeue())) { +diags->set_override(vc->control.debug_override); +if (vc->closed) + close_UnixNetVConnection(vc, trigger_event->ethread); +else if (vc->write.enabled && vc->write.triggered) + write_to_net(this, vc, trigger_even
[trafficserver] branch master updated: The content-type of TRACE response should be message/http.
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 4a4b4e7 The content-type of TRACE response should be message/http. 4a4b4e7 is described below commit 4a4b4e705547352eba202599e01a89e284473229 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Fri Jun 23 20:22:59 2017 +0800 The content-type of TRACE response should be message/http. --- proxy/http/HttpTransact.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index 56621e6..f3c0326 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -5416,6 +5416,7 @@ HttpTransact::handle_trace_and_options_requests(State *s, HTTPHdr *incoming_hdr) done = incoming_hdr->print(s->internal_msg_buffer, s->internal_msg_buffer_size, , ); HTTP_RELEASE_ASSERT(done); s->internal_msg_buffer_size = used; + s->internal_msg_buffer_type = ats_strdup("message/http"); s->hdr_info.client_response.set_content_length(used); } else { -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: TS-4396: fix number_of_redirections off-by-one
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 452a2dc TS-4396: fix number_of_redirections off-by-one 452a2dc is described below commit 452a2dc6466eae58ac03a3d29868130815e599c0 Author: Zhao Yongming <ming@gmail.com> AuthorDate: Sat Jul 2 19:09:08 2016 +0800 TS-4396: fix number_of_redirections off-by-one --- proxy/http/HttpSM.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index eb11a48..8234a5c 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -1901,7 +1901,7 @@ HttpSM::state_read_server_response_header(int event, void *data) t_state.api_next_action = HttpTransact::SM_ACTION_API_READ_RESPONSE_HDR; // if exceeded limit deallocate postdata buffers and disable redirection -if (enable_redirection && (redirection_tries < t_state.txn_conf->number_of_redirections)) { +if (enable_redirection && (redirection_tries <= t_state.txn_conf->number_of_redirections)) { ++redirection_tries; } else { tunnel.deallocate_redirect_postdata_buffers(); @@ -7601,7 +7601,7 @@ void HttpSM::do_redirect() { DebugSM("http_redirect", "[HttpSM::do_redirect]"); - if (!enable_redirection || redirection_tries >= t_state.txn_conf->number_of_redirections) { + if (!enable_redirection || redirection_tries > t_state.txn_conf->number_of_redirections) { tunnel.deallocate_redirect_postdata_buffers(); return; } -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: Disable the post_transform retry due to coredump
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 8dd4aa9 Disable the post_transform retry due to coredump 8dd4aa9 is described below commit 8dd4aa930317caa598d7622d3b7e091a4a23f875 Author: scw00 <616955...@qq.com> AuthorDate: Sun May 28 08:40:27 2017 +0800 Disable the post_transform retry due to coredump --- proxy/http/HttpSM.h| 8 proxy/http/HttpTransact.cc | 5 + 2 files changed, 13 insertions(+) diff --git a/proxy/http/HttpSM.h b/proxy/http/HttpSM.h index cca6379..3226403 100644 --- a/proxy/http/HttpSM.h +++ b/proxy/http/HttpSM.h @@ -238,6 +238,14 @@ public: VConnection *do_transform_open(); VConnection *do_post_transform_open(); + // Called by transact(HttpTransact::is_request_retryable), temperarily. + // This function should be remove after #1994 fixed. + bool + is_post_transform_request() + { +return t_state.method == HTTP_WKSIDX_POST && post_transform_info.vc; + } + // Called from InkAPI.cc which acquires the state machine lock // before calling int state_api_callback(int event, void *data); diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index bdeb6d0..395b6f0 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -6326,6 +6326,11 @@ HttpTransact::is_request_retryable(State *s) return false; } + // FIXME: disable the post transform retry currently. + if (s->state_machine->is_post_transform_request()) { +return false; + } + if (s->state_machine->plugin_tunnel_type != HTTP_NO_PLUGIN_TUNNEL) { // API can override if (s->state_machine->plugin_tunnel_type == HTTP_PLUGIN_AS_SERVER && s->api_info.retry_intercept_failures == true) { -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: fix bg_fill abort when server completed
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 6521444 fix bg_fill abort when server completed 6521444 is described below commit 652144465188a4dec5df9554c3ee3e23f9bf6cc2 Author: scw00 <616955...@qq.com> AuthorDate: Sat May 20 15:44:16 2017 +0800 fix bg_fill abort when server completed --- proxy/http/HttpSM.cc | 34 +- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 9f62c57..53e1290 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -3052,11 +3052,22 @@ HttpSM::is_bg_fill_necessary(HttpTunnelConsumer *c) { ink_assert(c->vc_type == HT_HTTP_CLIENT); - if (c->producer->alive &&// something there to read - server_entry && server_entry->vc && // from an origin server - server_session && server_session->get_netvc() && // which is still open and valid - c->producer->num_consumers > 1 // with someone else reading it + if (c->producer->alive && // something there to read + // server_entry && server_entry->vc && // from an origin server + // server_session && server_session->get_netvc() && // which is still open and valid + c->producer->num_consumers > 1 // with someone else reading it ) { +HttpTunnelProducer *p = nullptr; + +if (!server_entry || !server_entry->vc || !server_session || !server_session->get_netvc()) { + // return true if we have finished the reading from OS when client aborted + p = c->producer->self_consumer ? c->producer->self_consumer->producer : c->producer; + if (p->vc_type == HT_HTTP_SERVER && p->read_success) { +return true; + } else { +return false; + } +} // If threshold is 0.0 or negative then do background // fill regardless of the content length. Since this // is floating point just make sure the number is near zero @@ -3110,15 +3121,20 @@ HttpSM::tunnel_handler_ua(int event, HttpTunnelConsumer *c) set_ua_abort(HttpTransact::ABORTED, event); if (is_bg_fill_necessary(c)) { + p = c->producer->self_consumer ? c->producer->self_consumer->producer : c->producer; DebugSM("http", "[%" PRId64 "] Initiating background fill", sm_id); - background_fill = BACKGROUND_FILL_STARTED; - HTTP_INCREMENT_DYN_STAT(http_background_fill_current_count_stat); + // check whether to finish the reading. + background_fill = p->read_success ? BACKGROUND_FILL_COMPLETED : BACKGROUND_FILL_STARTED; // There is another consumer (cache write) so // detach the user agent - ink_assert(server_entry->vc == server_session); - ink_assert(c->is_downstream_from(server_session)); - server_session->get_netvc()->set_active_timeout(HRTIME_SECONDS(t_state.txn_conf->background_fill_active_timeout)); + if (background_fill == BACKGROUND_FILL_STARTED) { +HTTP_INCREMENT_DYN_STAT(http_background_fill_current_count_stat); +ink_assert(server_entry->vc == server_session); +ink_assert(c->is_downstream_from(server_session)); + server_session->get_netvc()->set_active_timeout(HRTIME_SECONDS(t_state.txn_conf->background_fill_active_timeout)); + } + } else { // No background fill p = c->producer; -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: fix 100-continue
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 800f69e fix 100-continue 800f69e is described below commit 800f69e71d144d9ef0870b7c6d7286eb2991bb7d Author: scw00 <616955...@qq.com> AuthorDate: Wed May 17 09:03:32 2017 +0800 fix 100-continue --- proxy/hdrs/HTTP.h| 11 ++- proxy/http/HttpSM.cc | 25 ++--- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/proxy/hdrs/HTTP.h b/proxy/hdrs/HTTP.h index b4eb236..bfa48ab 100644 --- a/proxy/hdrs/HTTP.h +++ b/proxy/hdrs/HTTP.h @@ -486,11 +486,12 @@ public: HTTPHdrImpl *m_http = nullptr; // This is all cached data and so is mutable. mutable URL m_url_cached; - mutable MIMEField *m_host_mime = nullptr; - mutable int m_host_length = 0; ///< Length of hostname. - mutable int m_port = 0; ///< Target port. - mutable bool m_target_cached = false; ///< Whether host name and port are cached. - mutable bool m_target_in_url = false; ///< Whether host name and port are in the URL. + mutable MIMEField *m_host_mime = nullptr; + mutable int m_host_length= 0; ///< Length of hostname. + mutable int m_port = 0; ///< Target port. + mutable bool m_target_cached = false; ///< Whether host name and port are cached. + mutable bool m_target_in_url = false; ///< Whether host name and port are in the URL. + mutable bool m_100_continue_required = false; ///< Whether 100_continue is in the Expect header. /// Set if the port was effectively specified in the header. /// @c true if the target (in the URL or the HOST field) also specified /// a port. That is, @c true if whatever source had the target host diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index c3b57ad..9f62c57 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -715,9 +715,11 @@ HttpSM::state_read_client_request_header(int event, void *data) ua_entry->write_buffer= new_MIOBuffer(alloc_index); IOBufferReader *buf_start = ua_entry->write_buffer->alloc_reader(); +t_state.hdr_info.client_request.m_100_continue_required = true; + DebugSM("http_seq", "send 100 Continue response to client"); -int64_t nbytes = ua_entry->write_buffer->write(str_100_continue_response, len_100_continue_response); -ua_session->do_io_write(netvc, nbytes, buf_start); +int64_t nbytes = ua_entry->write_buffer->write(str_100_continue_response, len_100_continue_response); +ua_entry->write_vio = ua_session->do_io_write(this, nbytes, buf_start); } } @@ -811,7 +813,7 @@ HttpSM::state_watch_for_client_abort(int event, void *data) { STATE_ENTER(::state_watch_for_client_abort, event); - ink_assert(ua_entry->read_vio == (VIO *)data); + ink_assert(ua_entry->read_vio == (VIO *)data || ua_entry->write_vio == (VIO *)data); ink_assert(ua_entry->vc == ua_session); switch (event) { @@ -874,6 +876,20 @@ HttpSM::state_watch_for_client_abort(int event, void *data) // Ignore. Could be a pipelined request. We'll get to it //when we finish the current transaction break; + case VC_EVENT_WRITE_READY: +// 100-continue handler +ink_assert(t_state.hdr_info.client_request.m_100_continue_required); +ua_entry->write_vio->reenable(); +break; + case VC_EVENT_WRITE_COMPLETE: +// 100-continue handler +ink_assert(t_state.hdr_info.client_request.m_100_continue_required); +if (ua_entry->write_buffer) { + ink_assert(ua_entry->write_vio && !ua_entry->write_vio->ntodo()); + free_MIOBuffer(ua_entry->write_buffer); + ua_entry->write_buffer = nullptr; +} +break; default: ink_release_assert(0); break; @@ -3357,6 +3373,9 @@ HttpSM::tunnel_handler_post_ua(int event, HttpTunnelProducer *p) // send back 408 request timeout alloc_index = buffer_size_to_index(len_408_request_timeout_response + t_state.internal_msg_buffer_size); if (ua_entry->write_buffer) { +if (t_state.hdr_info.client_request.m_100_continue_required) { + ink_assert(ua_entry->write_vio && !ua_entry->write_vio->ntodo()); +} free_MIOBuffer(ua_entry->write_buffer); ua_entry->write_buffer = nullptr; } -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: spawn_thread with atomic operation
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 05cc3df spawn_thread with atomic operation 05cc3df is described below commit 05cc3df86672cbb16f17e8909c8b471fac618d4a Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Wed May 24 21:20:38 2017 +0800 spawn_thread with atomic operation The eventProcessor.spawn_thread() is used to create a DEDICATED EThread. The n_dthreads is total number of DEDICATED EThreads. When a new DEDICATED EThread created, it makes the `all_dthreads[n_dthreads]' point to the EThread object then do `n_dthreads++' It is not likes the spawn_event_threads() that only called from main() before any EThread runs. It is can be called from main() and/or any EThread. Therefore there is a race on accessing `all_dthreads[n_dthreads]' and `n_dthreads++'. --- iocore/eventsystem/I_EventProcessor.h| 2 +- iocore/eventsystem/UnixEventProcessor.cc | 12 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/iocore/eventsystem/I_EventProcessor.h b/iocore/eventsystem/I_EventProcessor.h index 53923d5..5e1d112 100644 --- a/iocore/eventsystem/I_EventProcessor.h +++ b/iocore/eventsystem/I_EventProcessor.h @@ -307,7 +307,7 @@ public: EThread *assign_thread(EventType etype); EThread *all_dthreads[MAX_EVENT_THREADS]; - int n_dthreads; // No. of dedicated threads + volatile int n_dthreads; // No. of dedicated threads volatile int thread_data_used; }; diff --git a/iocore/eventsystem/UnixEventProcessor.cc b/iocore/eventsystem/UnixEventProcessor.cc index 853d347..2b06c84 100644 --- a/iocore/eventsystem/UnixEventProcessor.cc +++ b/iocore/eventsystem/UnixEventProcessor.cc @@ -266,13 +266,17 @@ Event * EventProcessor::spawn_thread(Continuation *cont, const char *thr_name, size_t stacksize) { ink_release_assert(n_dthreads < MAX_EVENT_THREADS); + int n = ink_atomic_increment((int *)_dthreads, 1); + ink_release_assert(n < MAX_EVENT_THREADS); + Event *e = eventAllocator.alloc(); e->init(cont, 0, 0); - all_dthreads[n_dthreads] = new EThread(DEDICATED, e); - e->ethread = all_dthreads[n_dthreads]; - e->mutex = e->continuation->mutex = all_dthreads[n_dthreads]->mutex; - n_dthreads++; + all_dthreads[n] = new EThread(DEDICATED, e); + e->ethread = all_dthreads[n]; + e->mutex= all_dthreads[n]->mutex; + cont->mutex = all_dthreads[n]->mutex; + e->ethread->start(thr_name, stacksize, nullptr, nullptr, nullptr); return e; -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: convert int to boolean
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new a23df66 convert int to boolean a23df66 is described below commit a23df669239bd466a3e22ca2c028ed5cd3630674 Author: scw00 <616955...@qq.com> AuthorDate: Wed May 3 19:37:25 2017 +0800 convert int to boolean --- proxy/hdrs/MIME.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/proxy/hdrs/MIME.h b/proxy/hdrs/MIME.h index babdbc1..dcf9041 100644 --- a/proxy/hdrs/MIME.h +++ b/proxy/hdrs/MIME.h @@ -758,10 +758,10 @@ MIMEField::name_set(HdrHeap *heap, MIMEHdrImpl *mh, const char *name, int length if (hdrtoken_is_wks(name)) { name_wks_idx = hdrtoken_wks_to_index(name); -mime_field_name_set(heap, mh, this, name_wks_idx, name, length, 1); +mime_field_name_set(heap, mh, this, name_wks_idx, name, length, true); } else { int field_name_wks_idx = hdrtoken_tokenize(name, length, _wks); -mime_field_name_set(heap, mh, this, field_name_wks_idx, (field_name_wks_idx == -1 ? name : name_wks), length, 1); +mime_field_name_set(heap, mh, this, field_name_wks_idx, (field_name_wks_idx == -1 ? name : name_wks), length, true); } } @@ -827,7 +827,7 @@ MIMEField::value_get_comma_list(StrList *list) const inline void MIMEField::value_set(HdrHeap *heap, MIMEHdrImpl *mh, const char *value, int length) { - mime_field_value_set(heap, mh, this, value, length, 1); + mime_field_value_set(heap, mh, this, value, length, true); } inline void @@ -1118,7 +1118,7 @@ MIMEHdr::field_create(const char *name, int length) if (name) { int field_name_wks_idx = hdrtoken_tokenize(name, length); -mime_field_name_set(m_heap, m_mime, field, field_name_wks_idx, name, length, 1); +mime_field_name_set(m_heap, m_mime, field, field_name_wks_idx, name, length, true); } return (field); -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: Set HttpSM::tunnel_handler_post to handle write event for outputing HTTP 408 response.
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 7335d7c Set HttpSM::tunnel_handler_post to handle write event for outputing HTTP 408 response. 7335d7c is described below commit 7335d7c5d7e9a37f84f1ae24e039194fb59b0d4a Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Wed Mar 15 16:31:31 2017 +0800 Set HttpSM::tunnel_handler_post to handle write event for outputing HTTP 408 response. If POST transform plugin does not finished before the ua_session timeouted, the producer will received a TIMEOUT event and callback producer_handler (HttpSM::tunnel_handler_post_ua). The HttpSM::tunnel_handler_post_ua will send a 408 response to client. The ua_session will received TIMEOUT event again in the next second because it does not reset the ua_session's timeout. The TIMEOUT event will be sent to HttpSM default handler because we did not save VIO returned by do_io_write to ua_entry->write_vio. The default handler is HttpSM::state_request_wait_for_transform_read and the TIMEOUT event is unexpected, then ink_release_asserti(0) at L1333 (at the end of HttpSM::state_common_wait_for_transform_read). In HttpSM::tunnel_handler_post(), calling tunnel_handler_post_or_put(p) before vc_table.cleanup_all() and tunnel.chain_abort_all(p). --- proxy/http/HttpSM.cc | 39 +-- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 5035254..6ad2c96 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -2770,25 +2770,39 @@ HttpSM::tunnel_handler_post(int event, void *data) return 0; // Cannot do anything if there is no producer } - if (event != HTTP_TUNNEL_EVENT_DONE) { -if ((event == VC_EVENT_WRITE_COMPLETE) || (event == VC_EVENT_EOS)) { - if (ua_entry->write_buffer) { -free_MIOBuffer(ua_entry->write_buffer); -ua_entry->write_buffer = nullptr; - } -} + switch (event) { + case HTTP_TUNNEL_EVENT_DONE: // Tunnel done. +break; + case VC_EVENT_WRITE_READY: // iocore may callback first before send. +return 0; + case VC_EVENT_EOS:// SSLNetVC may callback EOS during write error (6.0.x or early) + case VC_EVENT_ERROR: // Send HTTP 408 error + case VC_EVENT_WRITE_COMPLETE: // tunnel_handler_post_ua has sent HTTP 408 response + case VC_EVENT_INACTIVITY_TIMEOUT: // ua_session timeout during sending the HTTP 408 response + case VC_EVENT_ACTIVE_TIMEOUT: // ua_session timeout +if (ua_entry->write_buffer) { + free_MIOBuffer(ua_entry->write_buffer); + ua_entry->write_buffer = nullptr; + ua_entry->vc->do_io_write(this, 0, NULL); +} +// The if statement will always true since these codes are all for HTTP 408 response sending. - by oknet xu if (p->handler_state == HTTP_SM_POST_UA_FAIL) { Debug("http_tunnel", "cleanup tunnel in tunnel_handler_post"); hsm_release_assert(ua_entry->in_tunnel == true); - ink_assert((event == VC_EVENT_WRITE_COMPLETE) || (event == VC_EVENT_EOS)); + tunnel_handler_post_or_put(p); vc_table.cleanup_all(); tunnel.chain_abort_all(p); p->read_vio = nullptr; p->vc->do_io_close(EHTTP_ERROR); - tunnel_handler_post_or_put(p); tunnel.kill_tunnel(); return 0; } +break; + case VC_EVENT_READ_READY: + case VC_EVENT_READ_COMPLETE: + default: +ink_assert(!"not reached"); +return 0; } ink_assert(event == HTTP_TUNNEL_EVENT_DONE); @@ -3518,7 +3532,12 @@ HttpSM::tunnel_handler_post_ua(int event, HttpTunnelProducer *p) nbytes = ua_entry->write_buffer->write(str_408_request_timeout_response, len_408_request_timeout_response); nbytes += ua_entry->write_buffer->write(t_state.internal_msg_buffer, t_state.internal_msg_buffer_size); - p->vc->do_io_write(this, nbytes, buf_start); + // The HttpSM default handler still is HttpSM::state_request_wait_for_transform_read. + // However, WRITE_COMPLETE/TIMEOUT/ERROR event should be managed/handled by tunnel_handler_post. + ua_entry->vc_handler = ::tunnel_handler_post; + ua_entry->write_vio = p->vc->do_io_write(this, nbytes, buf_start); + // Reset the inactivity timeout, otherwise the InactivityCop will callback again in the next second. + ua_session->set_inactivity_timeout(HRTIME_SECONDS(t_state.txn_conf->transaction_no_activity_timeout_in)); p->vc->do_io_shutdown(IO_SHUTDOWN_READ); return 0; } -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: NetVC maybe lost from read_ready_list if Plugin call TSVConnReenable()
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new f702e9a NetVC maybe lost from read_ready_list if Plugin call TSVConnReenable() f702e9a is described below commit f702e9a1dba0d7d2df35f7da5226b5c392980f09 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Tue Mar 7 21:35:07 2017 +0800 NetVC maybe lost from read_ready_list if Plugin call TSVConnReenable() --- iocore/net/SSLNetVConnection.cc | 2 +- proxy/InkAPI.cc | 26 +- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc index fb46aa8..334e709 100644 --- a/iocore/net/SSLNetVConnection.cc +++ b/iocore/net/SSLNetVConnection.cc @@ -1039,7 +1039,7 @@ SSLNetVConnection::sslServerHandShakeEvent(int ) sslPreAcceptHookState = SSL_HOOKS_DONE; } else { sslPreAcceptHookState = SSL_HOOKS_ACTIVE; -ContWrapper::wrap(mutex.get(), curHook->m_cont, TS_EVENT_VCONN_PRE_ACCEPT, this); +ContWrapper::wrap(nh->mutex.get(), curHook->m_cont, TS_EVENT_VCONN_PRE_ACCEPT, this); return SSL_WAIT_FOR_HOOK; } } else { // waiting for hook to complete diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc index 5fbd114..c249be9 100644 --- a/proxy/InkAPI.cc +++ b/proxy/InkAPI.cc @@ -9023,7 +9023,7 @@ TSHttpEventNameLookup(TSEvent event) class TSSslCallback : public Continuation { public: - TSSslCallback(SSLNetVConnection *vc) : Continuation(vc->mutex), m_vc(vc) { SET_HANDLER(::event_handler); } + TSSslCallback(SSLNetVConnection *vc) : Continuation(vc->nh->mutex), m_vc(vc) { SET_HANDLER(::event_handler); } int event_handler(int, void *) { @@ -9127,22 +9127,14 @@ TSVConnReenable(TSVConn vconn) SSLNetVConnection *ssl_vc = dynamic_cast(vc); // We really only deal with a SSLNetVConnection at the moment if (ssl_vc != nullptr) { -EThread *eth= this_ethread(); -bool reschedule = eth != ssl_vc->thread; - -if (!reschedule) { - // We use the VC mutex so we don't need to reschedule again if we - // can't get the lock. For this reason we need to execute the - // callback on the VC thread or it doesn't work (not sure why - - // deadlock or it ends up interacting with the wrong NetHandler). - MUTEX_TRY_LOCK(trylock, ssl_vc->mutex, eth); - if (trylock.is_locked()) { -ssl_vc->reenable(ssl_vc->nh); - } else { -reschedule = true; - } -} -if (reschedule) { +EThread *eth = this_ethread(); + +// We use the mutex of VC's NetHandler so we can put the VC into ready_list by reenable() +MUTEX_TRY_LOCK(trylock, ssl_vc->nh->mutex, eth); +if (trylock.is_locked()) { + ssl_vc->reenable(ssl_vc->nh); +} else { + // We schedule the reenable to the home thread of ssl_vc. ssl_vc->thread->schedule_imm(new TSSslCallback(ssl_vc)); } } -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: Crash at HttpSM::state_request_wait_for_transform_read
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new b8a96c7 Crash at HttpSM::state_request_wait_for_transform_read b8a96c7 is described below commit b8a96c74e14a9c2e8fe9ea774c54bfa3b2b1b36a Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Tue Feb 28 20:27:17 2017 +0800 Crash at HttpSM::state_request_wait_for_transform_read In the function, it is try to get int64_t from 'data': int64_t size = *((int64_t)data); But TransformTerminus::handle_event callback m_tvc->m_cont (HttpSM) with 'data == nullptr'. ATS will crash at here. We only get size from data when the event is TRANSFORM_READ_READY, otherwise we do not. --- proxy/Transform.cc | 2 +- proxy/http/HttpSM.cc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/proxy/Transform.cc b/proxy/Transform.cc index ef21d7c..f914dfa 100644 --- a/proxy/Transform.cc +++ b/proxy/Transform.cc @@ -254,7 +254,7 @@ TransformTerminus::handle_event(int event, void * /* edata ATS_UNUSED */) if (!m_called_user) { m_called_user = 1; - m_tvc->m_cont->handleEvent(ev, nullptr); + m_tvc->m_cont->handleEvent(ev, _read_vio); } else { ink_assert(m_read_vio._cont != nullptr); m_read_vio._cont->handleEvent(ev, _read_vio); diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index e520ea2..b530459 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -1188,10 +1188,11 @@ int HttpSM::state_request_wait_for_transform_read(int event, void *data) { STATE_ENTER(::state_request_wait_for_transform_read, event); - int64_t size = *((int64_t *)data); + int64_t size; switch (event) { case TRANSFORM_READ_READY: +size = *((int64_t *)data); if (size != INT64_MAX && size >= 0) { // We got a content length so update our internal // data as well as fix up the request header -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: Do not reschedule the periodic inactive_event and cancel it after signal timeout event to SM
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://git-dual.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 977e27d Do not reschedule the periodic inactive_event and cancel it after signal timeout event to SM 977e27d is described below commit 977e27d51c068118a491bc6d8a36d1f24a8bdd66 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Wed Jan 18 21:50:57 2017 +0800 Do not reschedule the periodic inactive_event and cancel it after signal timeout event to SM --- proxy/PluginVC.cc | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/proxy/PluginVC.cc b/proxy/PluginVC.cc index 1ad01d9..df1e111 100644 --- a/proxy/PluginVC.cc +++ b/proxy/PluginVC.cc @@ -211,7 +211,9 @@ PluginVC::main_handler(int event, void *data) } else if (call_event == inactive_event) { if (inactive_timeout_at && inactive_timeout_at < Thread::get_hrtime()) { process_timeout(_event, VC_EVENT_INACTIVITY_TIMEOUT); - call_event->cancel(); + if (nullptr == inactive_event) { +call_event->cancel(); + } } } else { if (call_event == sm_lock_retry_event) { @@ -749,13 +751,17 @@ PluginVC::process_timeout(Event **e, int event_to_send) if (closed) { // already closed, ignore the timeout event // to avoid handle_event asserting use-after-free +*e = nullptr; return; } if (read_state.vio.op == VIO::READ && !read_state.shutdown && read_state.vio.ntodo() > 0) { MUTEX_TRY_LOCK(lock, read_state.vio.mutex, (*e)->ethread); if (!lock.is_locked()) { - (*e)->schedule_in(PVC_LOCK_RETRY_TIME); + if (*e == active_event) { +// Only reschedule active_event due to inactive_event is perorid event. +(*e)->schedule_in(PVC_LOCK_RETRY_TIME); + } return; } *e = nullptr; @@ -763,7 +769,10 @@ PluginVC::process_timeout(Event **e, int event_to_send) } else if (write_state.vio.op == VIO::WRITE && !write_state.shutdown && write_state.vio.ntodo() > 0) { MUTEX_TRY_LOCK(lock, write_state.vio.mutex, (*e)->ethread); if (!lock.is_locked()) { - (*e)->schedule_in(PVC_LOCK_RETRY_TIME); + if (*e == active_event) { +// Only reschedule active_event due to inactive_event is perorid event. +(*e)->schedule_in(PVC_LOCK_RETRY_TIME); + } return; } *e = nullptr; -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: TS-5105: Do vc->con.setRemote(target) before socksEntry->init()
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://git-dual.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 25140ce TS-5105: Do vc->con.setRemote(target) before socksEntry->init() 25140ce is described below commit 25140ce7b2d2d8214bbc22dde6a2db9144ff2693 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Fri Dec 23 13:06:22 2016 +0800 TS-5105: Do vc->con.setRemote(target) before socksEntry->init() --- iocore/net/Socks.cc| 2 +- iocore/net/UnixNetProcessor.cc | 8 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/iocore/net/Socks.cc b/iocore/net/Socks.cc index 825fda1..30e3855 100644 --- a/iocore/net/Socks.cc +++ b/iocore/net/Socks.cc @@ -248,7 +248,7 @@ SocksEntry::mainEvent(int event, void *data) p[n_bytes++] = version; p[n_bytes++] = (socks_cmd == NORMAL_SOCKS) ? SOCKS_CONNECT : socks_cmd; - ts = ntohs(ats_ip_port_cast(_addr)); + ts = ats_ip_port_cast(_addr); if (version == SOCKS5_VERSION) { p[n_bytes++] = 0; // Reserved diff --git a/iocore/net/UnixNetProcessor.cc b/iocore/net/UnixNetProcessor.cc index c3d2fa7..490d92e 100644 --- a/iocore/net/UnixNetProcessor.cc +++ b/iocore/net/UnixNetProcessor.cc @@ -216,11 +216,16 @@ UnixNetProcessor::connect_re_internal(Continuation *cont, sockaddr const *target vc->submit_time = Thread::get_hrtime(); vc->mutex = cont->mutex; Action *result = >action_; + // Copy target to con.addr, + // then con.addr will copy to vc->remote_addr by set_remote_addr() + vc->con.setRemote(target); if (using_socks) { char buff[INET6_ADDRPORTSTRLEN]; Debug("Socks", "Using Socks ip: %s", ats_ip_nptop(target, buff, sizeof(buff))); socksEntry = socksAllocator.alloc(); +// The socksEntry->init() will get the origin server addr by vc->get_remote_addr(), +// and save it to socksEntry->req_data.dest_ip. socksEntry->init(cont->mutex, vc, opt->socks_support, opt->socks_version); /* remove last two args */ socksEntry->action_ = cont; cont= socksEntry; @@ -229,12 +234,13 @@ UnixNetProcessor::connect_re_internal(Continuation *cont, sockaddr const *target socksEntry->free(); return ACTION_RESULT_DONE; } +// At the end of socksEntry->init(), a socks server will be selected and saved to socksEntry->server_addr. +// Therefore, we should set the remote to socks server in order to establish a connection with socks server. vc->con.setRemote(>server_addr.sa); result = >action_; vc->action_ = socksEntry; } else { Debug("Socks", "Not Using Socks %d ", socks_conf_stuff->socks_needed); -vc->con.setRemote(target); vc->action_ = cont; } -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: TS-5106: Create ParentRoundRobin object as ParentRecord->selection_strategy for default parent proxy server
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://git-dual.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 7ffe037 TS-5106: Create ParentRoundRobin object as ParentRecord->selection_strategy for default parent proxy server 7ffe037 is described below commit 7ffe037845f45497aa9e95919a3a7bc0ca288163 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Fri Dec 23 15:53:50 2016 +0800 TS-5106: Create ParentRoundRobin object as ParentRecord->selection_strategy for default parent proxy server --- proxy/ParentSelection.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/proxy/ParentSelection.cc b/proxy/ParentSelection.cc index 974e6b7..3b08812 100644 --- a/proxy/ParentSelection.cc +++ b/proxy/ParentSelection.cc @@ -498,6 +498,9 @@ ParentRecord::DefaultInit(char *val) ats_free(errBuf); return false; } else { +ParentRR_t round_robin = P_NO_ROUND_ROBIN; +TSDebug("parent_select", "allocating ParentRoundRobin() lookup strategy."); +selection_strategy = new ParentRoundRobin(this, round_robin); return true; } } -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: TS-5082: define IOBufferReader::is_read_avail_more_than with TS_INLINE keyword
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://git-dual.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 662be1f TS-5082: define IOBufferReader::is_read_avail_more_than with TS_INLINE keyword 662be1f is described below commit 662be1f88be80e701634ece6ab82c16094250bf6 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Wed Dec 7 20:04:31 2016 +0800 TS-5082: define IOBufferReader::is_read_avail_more_than with TS_INLINE keyword --- iocore/eventsystem/P_IOBuffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iocore/eventsystem/P_IOBuffer.h b/iocore/eventsystem/P_IOBuffer.h index 0f46a51..18b273d 100644 --- a/iocore/eventsystem/P_IOBuffer.h +++ b/iocore/eventsystem/P_IOBuffer.h @@ -641,7 +641,7 @@ IOBufferReader::read_avail() return t; } -inline bool +TS_INLINE bool IOBufferReader::is_read_avail_more_than(int64_t size) { int64_t t= -start_offset; -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated: TS-5076: Test and set the in_enabled_list by atomic function
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://git-dual.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new f84b433 TS-5076: Test and set the in_enabled_list by atomic function f84b433 is described below commit f84b4333d2743a8275f4974e32c733e989968a67 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Sat Dec 3 13:07:38 2016 +0800 TS-5076: Test and set the in_enabled_list by atomic function --- iocore/net/UnixNetVConnection.cc | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc index ccfaa9a..31d4b9c 100644 --- a/iocore/net/UnixNetVConnection.cc +++ b/iocore/net/UnixNetVConnection.cc @@ -875,13 +875,13 @@ UnixNetVConnection::reenable(VIO *vio) MUTEX_TRY_LOCK(lock, nh->mutex, t); if (!lock.is_locked()) { if (vio == ) { -if (!read.in_enabled_list) { - read.in_enabled_list = 1; +int isin = ink_atomic_swap(_enabled_list, 1); +if (!isin) { nh->read_enable_list.push(this); } } else { -if (!write.in_enabled_list) { - write.in_enabled_list = 1; +int isin = ink_atomic_swap(_enabled_list, 1); +if (!isin) { nh->write_enable_list.push(this); } } -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] 01/01: Merge pull request #1046 from oknet/TS-4895
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://git-dual.apache.org/repos/asf/trafficserver.git commit 0063602acbad694b07228b1191507dd738b685cd Merge: 9228329 9108bc9 Author: Oknet <xuc...@gmail.com> AuthorDate: Mon Sep 26 14:11:38 2016 +0800 Merge pull request #1046 from oknet/TS-4895 TS-4895: Initialize default_inactivity_timeout (CID 1021743 from TS-4612) iocore/net/UnixNet.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- To stop receiving notification emails like this one, please contact "commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.
[trafficserver] branch master updated (9228329 -> 0063602)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a change to branch master in repository https://git-dual.apache.org/repos/asf/trafficserver.git. from 9228329 TS-4698: Adds an API call to identify WebSocket requests. adds 9108bc9 TS-4895: Initialize default_inactivity_timeout (CID 1021743 from TS-4612) new 0063602 Merge pull request #1046 from oknet/TS-4895 The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: iocore/net/UnixNet.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] 01/01: Merge pull request #771 from oknet/TS-4612
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://git-dual.apache.org/repos/asf/trafficserver.git commit 1935d445b197dfd9c070305fc868978b63a5709b Merge: 5c41dd1 425b696 Author: Oknet <xuc...@gmail.com> AuthorDate: Sat Sep 24 01:56:40 2016 +0800 Merge pull request #771 from oknet/TS-4612 TS-4612: Proposal: InactivityCop Optimize iocore/cluster/ClusterHandlerBase.cc | 1 + iocore/net/P_UnixNet.h | 5 ++- iocore/net/P_UnixNetVConnection.h| 41 ++- iocore/net/UnixNet.cc| 78 iocore/net/UnixNetAccept.cc | 1 + iocore/net/UnixNetVConnection.cc | 37 - 6 files changed, 70 insertions(+), 93 deletions(-) diff --cc iocore/net/P_UnixNet.h index 9c91790,be350d6..781ae93 --- a/iocore/net/P_UnixNet.h +++ b/iocore/net/P_UnixNet.h @@@ -195,7 -195,11 +195,8 @@@ public uint32_t inactive_threashold_in; uint32_t transaction_no_activity_timeout_in; uint32_t keep_alive_no_activity_timeout_in; + uint32_t default_inactivity_timeout; - time_t sec; - int cycles; - int startNetEvent(int event, Event *data); int mainNetEvent(int event, Event *data); int mainNetEventExt(int event, Event *data); -- To stop receiving notification emails like this one, please contact "commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.
[trafficserver] branch master updated (5924495 -> 4497680)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a change to branch master in repository https://git-dual.apache.org/repos/asf/trafficserver.git. from 5924495 Merge pull request #1040 from oknet/TS-4885 adds 3216b0c TS-4879: Checking con.fd == NO_FD in UnixNetVConnection::connectUp() while we get return from check_emergency_throttle() adds cd3f83a TS-4879: Checking con.fd == NO_FD in NetAccept::do_blocking_accept() new 4497680 Merge pull request #1033 from oknet/TS-4879 The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: iocore/net/P_UnixNet.h | 8 iocore/net/UnixNetAccept.cc | 10 -- iocore/net/UnixNetVConnection.cc | 23 --- 3 files changed, 28 insertions(+), 13 deletions(-) -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] branch master updated (86d9612 -> 5924495)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a change to branch master in repository https://git-dual.apache.org/repos/asf/trafficserver.git. from 86d9612 Merge pull request #1035 from zwoop/TS-4866 adds 98bdac0 TS-4885: Correct the calculation of fds_throttle and fds_limit new 5924495 Merge pull request #1040 from oknet/TS-4885 The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: proxy/Main.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].
[trafficserver] 01/01: Merge pull request #1040 from oknet/TS-4885
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://git-dual.apache.org/repos/asf/trafficserver.git commit 592449545fad3f499219173ec27fdbd2324702d7 Merge: 86d9612 98bdac0 Author: Oknet <xuc...@gmail.com> AuthorDate: Fri Sep 23 12:13:58 2016 +0800 Merge pull request #1040 from oknet/TS-4885 TS-4885: Correct the calculation of fds_throttle and fds_limit proxy/Main.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- To stop receiving notification emails like this one, please contact "commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.
[trafficserver] 01/01: Merge pull request #753 from oknet/netvc_context
This is an automated email from the ASF dual-hosted git repository. oknet pushed a commit to branch master in repository https://git-dual.apache.org/repos/asf/trafficserver.git commit 0ec497ba8b7be0f5cdd04d4d75bc5c55396cb8ce Merge: 6d2c6cb 724f7cb Author: Oknet <xuc...@gmail.com> AuthorDate: Fri Sep 23 01:56:39 2016 +0800 Merge pull request #753 from oknet/netvc_context TS-4705: Proposal: NetVC Context iocore/net/I_NetVConnection.h | 33 +++- iocore/net/P_SSLNetVConnection.h | 13 iocore/net/P_UnixNetVConnection.h | 14 - iocore/net/SSLClientUtils.cc | 2 +- iocore/net/SSLNetVConnection.cc | 8 ++--- iocore/net/SSLUtils.cc| 4 +-- iocore/net/Socks.cc | 2 +- iocore/net/UnixConnection.cc | 5 ++-- iocore/net/UnixNetAccept.cc | 63 +-- iocore/net/UnixNetPages.cc| 6 ++-- iocore/net/UnixNetProcessor.cc| 10 +++ iocore/net/UnixNetVConnection.cc | 15 ++ proxy/CoreUtils.cc| 4 +-- proxy/InkAPI.cc | 1 + 14 files changed, 89 insertions(+), 91 deletions(-) -- To stop receiving notification emails like this one, please contact "commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.
[trafficserver] branch master updated (6d2c6cb -> 0ec497b)
This is an automated email from the ASF dual-hosted git repository. oknet pushed a change to branch master in repository https://git-dual.apache.org/repos/asf/trafficserver.git. from 6d2c6cb TS-4715: total revamp of admin guide's logging sections, and promotion to top-level chapter adds 724f7cb Proposal: NetVC Context new 0ec497b Merge pull request #753 from oknet/netvc_context The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: iocore/net/I_NetVConnection.h | 33 +++- iocore/net/P_SSLNetVConnection.h | 13 iocore/net/P_UnixNetVConnection.h | 14 - iocore/net/SSLClientUtils.cc | 2 +- iocore/net/SSLNetVConnection.cc | 8 ++--- iocore/net/SSLUtils.cc| 4 +-- iocore/net/Socks.cc | 2 +- iocore/net/UnixConnection.cc | 5 ++-- iocore/net/UnixNetAccept.cc | 63 +-- iocore/net/UnixNetPages.cc| 6 ++-- iocore/net/UnixNetProcessor.cc| 10 +++ iocore/net/UnixNetVConnection.cc | 15 ++ proxy/CoreUtils.cc| 4 +-- proxy/InkAPI.cc | 1 + 14 files changed, 89 insertions(+), 91 deletions(-) -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].