[qpid-dispatch] branch main updated: DISPATCH-2218: Removed use of variable length arrays. Used the stream data iterator API. This closes #1328

2021-07-28 Thread gmurthy
This is an automated email from the ASF dual-hosted git repository.

gmurthy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/main by this push:
 new 85efbd7  DISPATCH-2218: Removed use of variable length arrays. Used 
the stream data iterator API. This closes #1328
85efbd7 is described below

commit 85efbd7ca4343a6f7348d7c10a160b78c64070fc
Author: Ganesh Murthy 
AuthorDate: Mon Jul 26 11:49:07 2021 -0400

DISPATCH-2218: Removed use of variable length arrays. Used the stream data 
iterator API. This closes #1328
---
 src/adaptors/http2/http2_adaptor.c | 121 +
 src/adaptors/http2/http2_adaptor.h |   6 +-
 2 files changed, 44 insertions(+), 83 deletions(-)

diff --git a/src/adaptors/http2/http2_adaptor.c 
b/src/adaptors/http2/http2_adaptor.c
index d7f2024..648f510 100644
--- a/src/adaptors/http2/http2_adaptor.c
+++ b/src/adaptors/http2/http2_adaptor.c
@@ -66,6 +66,7 @@ typedef struct qdr_http2_adaptor_t {
 
 static qdr_http2_adaptor_t *http2_adaptor;
 const int32_t WINDOW_SIZE = 65536;
+const int32_t MAX_FRAME_SIZE = 16384;
 
 static void handle_connection_event(pn_event_t *e, qd_server_t *qd_server, 
void *context);
 static void _http_record_request(qdr_http2_connection_t *conn, 
qdr_http2_stream_data_t *stream_data);
@@ -395,7 +396,9 @@ static void free_http2_stream_data(qdr_http2_stream_data_t 
*stream_data, bool on
 //
 if (stream_data->in_dlv && !stream_data->in_dlv_decrefed) {
 qd_message_stream_data_release(stream_data->curr_stream_data);
+qd_iterator_free(stream_data->curr_stream_data_iter);
 stream_data->curr_stream_data = 0;
+stream_data->curr_stream_data_iter = 0;
 
 qd_message_stream_data_release(stream_data->next_stream_data);
 stream_data->next_stream_data = 0;
@@ -405,7 +408,9 @@ static void free_http2_stream_data(qdr_http2_stream_data_t 
*stream_data, bool on
 
 if (stream_data->out_dlv && !stream_data->out_dlv_decrefed) {
 qd_message_stream_data_release(stream_data->curr_stream_data);
+qd_iterator_free(stream_data->curr_stream_data_iter);
 stream_data->curr_stream_data = 0;
+stream_data->curr_stream_data_iter = 0;
 
 qd_message_stream_data_release(stream_data->next_stream_data);
 stream_data->next_stream_data = 0;
@@ -625,48 +630,16 @@ static int snd_data_callback(nghttp2_session *session,
 // Insert the framehd of length 9 bytes into the buffer
 memcpy(qd_http2_buffer_cursor(http2_buff), framehd, 
HTTP2_DATA_FRAME_HEADER_LENGTH);
 qd_http2_buffer_insert(http2_buff, HTTP2_DATA_FRAME_HEADER_LENGTH);
-pn_raw_buffer_t pn_raw_buffs[stream_data->qd_buffers_to_send];
-int written = 
qd_message_stream_data_buffers(stream_data->curr_stream_data, pn_raw_buffs, 
stream_data->curr_stream_data_qd_buff_offset, stream_data->qd_buffers_to_send);
-(void)written;
-assert (written == stream_data->qd_buffers_to_send);
-
-int idx = 0;
-size_t bytes_to_send = length;
-
-while (idx < stream_data->qd_buffers_to_send) {
-if (pn_raw_buffs[idx].size > 0) {
-   if (bytes_to_send < pn_raw_buffs[idx].size) {
-   int bytes_remaining_in_buffer = pn_raw_buffs[idx].size 
- stream_data->curr_stream_data_offset;
-   if (bytes_remaining_in_buffer < bytes_to_send) {
-   memcpy(qd_http2_buffer_cursor(http2_buff), 
pn_raw_buffs[idx].bytes + stream_data->curr_stream_data_offset, 
bytes_remaining_in_buffer);
-   qd_http2_buffer_insert(http2_buff, 
bytes_remaining_in_buffer);
-   stream_data->curr_stream_data_offset = 0;
-   bytes_to_send -= bytes_remaining_in_buffer;
-   bytes_sent += bytes_remaining_in_buffer;
-   }
-   else {
-   
memcpy(qd_http2_buffer_cursor(http2_buff), pn_raw_buffs[idx].bytes + 
stream_data->curr_stream_data_offset, bytes_to_send);
-   
qd_http2_buffer_insert(http2_buff, bytes_to_send);
-   
qd_log(http2_adaptor->protocol_log_source, QD_LOG_TRACE, 
"[C%"PRIu64"][S%"PRId32"] snd_data_callback memcpy bytes_to_send=%zu", 
conn->conn_id, stream_data->stream_id, bytes_to_send);
-   
stream_data->curr_stream_data_offset += bytes_to_send;
-   bytes_sent += bytes_to_send;
-   if 
(stream_data->curr_stream_data_offset == BUFFER_SIZE || 
stream_data->curr_stream_data_offset == pn_raw_buffs[idx].size) {
-   
stream_data->curr_stream_data_offset

[qpid-dispatch] 02/03: DISPATCH-2213: [test] Fallback dest test to do less logging

2021-07-28 Thread kgiusti
This is an automated email from the ASF dual-hosted git repository.

kgiusti pushed a commit to branch 1.17.x
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git

commit 066047affa6b66e99060ab8040d5178b38417ce1
Author: Chuck Rolke 
AuthorDate: Tue Jul 27 14:27:18 2021 -0400

DISPATCH-2213: [test] Fallback dest test to do less logging

Log only every 100th event and provide some delays while waiting for
addresses to stabilize.

This prevents this single test from consuming the entire disk quota
for the entire test run and it gives the routers under test some
CPU time to do real work.

This closes #1323
---
 tests/system_tests_fallback_dest.py | 34 +++---
 1 file changed, 23 insertions(+), 11 deletions(-)

diff --git a/tests/system_tests_fallback_dest.py 
b/tests/system_tests_fallback_dest.py
index 85e6c89..d34ea65 100644
--- a/tests/system_tests_fallback_dest.py
+++ b/tests/system_tests_fallback_dest.py
@@ -23,6 +23,7 @@ from system_test import unittest
 from system_test import Logger
 from proton.handlers import MessagingHandler
 from proton.reactor import Container
+import time
 
 
 class AddrTimer(object):
@@ -577,6 +578,11 @@ class SwitchoverTest(MessagingHandler):
 self.addr   = addr
 self.count  = 300
 
+# DISPATCH-2213 back off on logging.
+self.log_sends  = 100  # every 100th send
+self.log_recvs  = 100  # every 100th receive
+self.log_released   = 100  # every 100th sender released
+
 self.sender_conn= None
 self.primary_conn   = None
 self.fallback_conn  = None
@@ -660,9 +666,10 @@ class SwitchoverTest(MessagingHandler):
 if self.sender.drain_mode:
 n_drained = self.sender.drained()
 self.logger.log("%s sender.drained() drained %d credits" % 
(self.log_prefix, n_drained))
-self.logger.log("%s send() exit: last sent '%s' phase=%d, 
credit=%3d->%3d, n_tx=%4d->%4d, tx_seq=%4d->%4d, n_rel=%4d" %
-(self.log_prefix, last_message.body, self.phase, 
e_credit, self.sender.credit,
- e_n_tx, self.n_tx, e_tx_seq, self.tx_seq, self.n_rel))
+if self.n_tx > e_n_tx and self.n_tx % self.log_sends == 0:  # if sent 
then log every Nth message
+self.logger.log("%s send() exit: last sent '%s' phase=%d, 
credit=%3d->%3d, n_tx=%4d->%4d, tx_seq=%4d->%4d, n_rel=%4d" %
+(self.log_prefix, last_message.body, self.phase, 
e_credit, self.sender.credit,
+ e_n_tx, self.n_tx, e_tx_seq, self.tx_seq, 
self.n_rel))
 
 def on_sendable(self, event):
 if event.sender == self.sender:
@@ -674,8 +681,9 @@ class SwitchoverTest(MessagingHandler):
 if event.receiver == self.primary_receiver:
 if self.phase == 0:
 self.n_rx += 1
-self.logger.log("%s Received phase 0 message '%s', n_rx=%d" %
-(self.log_prefix, event.message.body, 
self.n_rx))
+if self.n_rx % self.log_recvs == 0:
+self.logger.log("%s Received phase 0 message '%s', 
n_rx=%d" %
+(self.log_prefix, event.message.body, 
self.n_rx))
 if self.n_rx == self.count:
 self.logger.log("%s Triggering fallback by closing primary 
receiver on %s. Test phase 0->1." %
 (self.log_prefix, self.primary_name))
@@ -694,12 +702,15 @@ class SwitchoverTest(MessagingHandler):
 self.n_rel += 1
 self.n_tx -= 1
 self.local_rel += 1
-self.logger.log("%s Released phase 0 over fallback: msg:'%s', 
n_rx=%d, n_tx=%d, n_rel=%d, local_rel=%d" %
-(self.log_prefix, event.message.body, 
self.n_rx, self.n_tx, self.n_rel, self.local_rel))
+if self.local_rel % self.log_recvs == 0:
+self.logger.log("%s Released phase 0 over fallback: 
msg:'%s', n_rx=%d, n_tx=%d, n_rel=%d, local_rel=%d" %
+(self.log_prefix, event.message.body, 
self.n_rx, self.n_tx, self.n_rel, self.local_rel))
+time.sleep(0.02)
 else:
 self.n_rx += 1
-self.logger.log("%s Received phase 1 over fallback: msg:'%s', 
n_rx=%d" %
-(self.log_prefix, event.message.body, 
self.n_rx))
+if self.n_rx % self.log_recvs == 0:
+self.logger.log("%s Received phase 1 over fallback: 
msg:'%s', n_rx=%d" %
+(self.log_prefix, event.message.body, 
self.n_rx))
 if self.n_rx == self.count:
 self.logger.log("%s Success" % self.log_prefix)
 self.fail(None)
@@ -710,8 +721,9 @@ class SwitchoverTest(MessagingHandler):
 

[qpid-dispatch] branch 1.17.x created (now eccb236)

2021-07-28 Thread kgiusti
This is an automated email from the ASF dual-hosted git repository.

kgiusti pushed a change to branch 1.17.x
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git.


  at eccb236  DISPATCH-2214: Reduce logging in tcp_adaptor self test

This branch includes the following new commits:

 new 370ca07  DISPATCH-2168: Fix error that showed up in Coverity. Check 
for addr before dereferencing it. This closes #1326
 new 066047a  DISPATCH-2213: [test] Fallback dest test to do less logging
 new eccb236  DISPATCH-2214: Reduce logging in tcp_adaptor self test

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


-
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org



[qpid-dispatch] 01/03: DISPATCH-2168: Fix error that showed up in Coverity. Check for addr before dereferencing it. This closes #1326

2021-07-28 Thread kgiusti
This is an automated email from the ASF dual-hosted git repository.

kgiusti pushed a commit to branch 1.17.x
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git

commit 370ca07f39b519d644dcfb6c3598e190385bf3a6
Author: Ganesh Murthy 
AuthorDate: Mon Jul 26 14:38:56 2021 -0400

DISPATCH-2168: Fix error that showed up in Coverity. Check for addr before 
dereferencing it. This closes #1326
---
 src/router_core/connections.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/router_core/connections.c b/src/router_core/connections.c
index c6e8c26..4f28d48 100644
--- a/src/router_core/connections.c
+++ b/src/router_core/connections.c
@@ -2106,7 +2106,7 @@ static void qdr_link_inbound_detach_CT(qdr_core_t *core, 
qdr_action_t *action, b
 //
 // We had increased the ref_count if the link->no_route was true. Now 
reduce the ref_count
 //
-if (link->no_route && link->no_route_bound) {
+if (addr && link->no_route && link->no_route_bound) {
 addr->ref_count--;
 }
 

-
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org



[qpid-dispatch] 03/03: DISPATCH-2214: Reduce logging in tcp_adaptor self test

2021-07-28 Thread kgiusti
This is an automated email from the ASF dual-hosted git repository.

kgiusti pushed a commit to branch 1.17.x
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git

commit eccb2364e45aaee382775b1abba404cabd45aca0
Author: Chuck Rolke 
AuthorDate: Wed Jul 28 09:47:46 2021 -0400

DISPATCH-2214: Reduce logging in tcp_adaptor self test

 * Put restraints on echo tests startup wait loop
   Only poll N times; delay between polls
 * Print qdsdat address displays if polling fails

This closes #1327
---
 tests/system_tests_tcp_adaptor.py | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/tests/system_tests_tcp_adaptor.py 
b/tests/system_tests_tcp_adaptor.py
index 71bce4c..fe26dd4 100644
--- a/tests/system_tests_tcp_adaptor.py
+++ b/tests/system_tests_tcp_adaptor.py
@@ -322,7 +322,7 @@ class TcpAdaptor(TestCase):
 
 # define logging levels
 cls.print_logs_server = False
-cls.print_logs_client = True
+cls.print_logs_client = False
 parent_path = os.path.dirname(os.getcwd())
 cls.logger = Logger(title="TcpAdaptor-testClass",
 print_to_console=True,
@@ -505,6 +505,8 @@ class TcpAdaptor(TestCase):
 
 # wait for server addresses (mobile ES_) to propagate to all 
interior routers
 interior_rtrs = [rtr for rtr in cls.router_order if 
rtr.startswith('I')]
+poll_loops = 100
+poll_loop_delay = 0.5  # seconds
 found_all = False
 while not found_all:
 found_all = True
@@ -528,6 +530,15 @@ class TcpAdaptor(TestCase):
 unseen = [srv for srv in cls.router_order if "ES_" + srv 
not in seen]
 cls.logger.log("TCP_TEST Router %s sees only %d of %d 
addresses. Waiting for %s" %
(rtr, len(server_lines), 
len(cls.router_order), unseen))
+if poll_loops == 1:
+# last poll loop
+for line in lines:
+cls.logger.log("TCP_TEST Router %s : %s" % (rtr, line))
+poll_loops -= 1
+if poll_loops == 0:
+assert False, "TCP_TEST TCP_Adaptor test setup failed. Echo 
tests never executed."
+else:
+time.sleep(poll_loop_delay)
 cls.logger.log("TCP_TEST Done poll wait")
 
 @classmethod

-
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org



[qpid-dispatch] branch main updated: DISPATCH-2214: Reduce logging in tcp_adaptor self test

2021-07-28 Thread chug
This is an automated email from the ASF dual-hosted git repository.

chug pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/main by this push:
 new 967e00d  DISPATCH-2214: Reduce logging in tcp_adaptor self test
967e00d is described below

commit 967e00d14a1335557b1f3269e92d4e9020401c07
Author: Chuck Rolke 
AuthorDate: Wed Jul 28 09:47:46 2021 -0400

DISPATCH-2214: Reduce logging in tcp_adaptor self test

 * Put restraints on echo tests startup wait loop
   Only poll N times; delay between polls
 * Print qdsdat address displays if polling fails

This closes #1327
---
 tests/system_tests_tcp_adaptor.py | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/tests/system_tests_tcp_adaptor.py 
b/tests/system_tests_tcp_adaptor.py
index 71bce4c..fe26dd4 100644
--- a/tests/system_tests_tcp_adaptor.py
+++ b/tests/system_tests_tcp_adaptor.py
@@ -322,7 +322,7 @@ class TcpAdaptor(TestCase):
 
 # define logging levels
 cls.print_logs_server = False
-cls.print_logs_client = True
+cls.print_logs_client = False
 parent_path = os.path.dirname(os.getcwd())
 cls.logger = Logger(title="TcpAdaptor-testClass",
 print_to_console=True,
@@ -505,6 +505,8 @@ class TcpAdaptor(TestCase):
 
 # wait for server addresses (mobile ES_) to propagate to all 
interior routers
 interior_rtrs = [rtr for rtr in cls.router_order if 
rtr.startswith('I')]
+poll_loops = 100
+poll_loop_delay = 0.5  # seconds
 found_all = False
 while not found_all:
 found_all = True
@@ -528,6 +530,15 @@ class TcpAdaptor(TestCase):
 unseen = [srv for srv in cls.router_order if "ES_" + srv 
not in seen]
 cls.logger.log("TCP_TEST Router %s sees only %d of %d 
addresses. Waiting for %s" %
(rtr, len(server_lines), 
len(cls.router_order), unseen))
+if poll_loops == 1:
+# last poll loop
+for line in lines:
+cls.logger.log("TCP_TEST Router %s : %s" % (rtr, line))
+poll_loops -= 1
+if poll_loops == 0:
+assert False, "TCP_TEST TCP_Adaptor test setup failed. Echo 
tests never executed."
+else:
+time.sleep(poll_loop_delay)
 cls.logger.log("TCP_TEST Done poll wait")
 
 @classmethod

-
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org