[qpid-dispatch] branch main updated: Bump apache-rat-plugin from 0.13 to 0.14

2022-06-14 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 94f36ebd Bump apache-rat-plugin from 0.13 to 0.14
94f36ebd is described below

commit 94f36ebdd64f47419eb55cef6988ca1c3e46ff93
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
AuthorDate: Mon Jun 13 17:06:21 2022 +

Bump apache-rat-plugin from 0.13 to 0.14

Bumps apache-rat-plugin from 0.13 to 0.14.

---
updated-dependencies:
- dependency-name: org.apache.rat:apache-rat-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] 
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 54e9351c..13ab8d06 100644
--- a/pom.xml
+++ b/pom.xml
@@ -47,7 +47,7 @@
 
 org.apache.rat
 apache-rat-plugin
-0.13
+0.14
 
   
 verify


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



[qpid-dispatch] branch dependabot/npm_and_yarn/console/react/prettier-2.7.0 created (now 90178654)

2022-06-14 Thread github-bot
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a change to branch 
dependabot/npm_and_yarn/console/react/prettier-2.7.0
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


  at 90178654 Bump prettier from 2.5.1 to 2.7.0 in /console/react

No new revisions were added by this update.


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



[qpid-proton] 02/02: PROTON-2562: Use a fixed size buffer for more log messages

2022-06-14 Thread astitcher
This is an automated email from the ASF dual-hosted git repository.

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

commit a0443f64b2394947100c4f364f72af9a9f41ee31
Author: Andrew Stitcher 
AuthorDate: Wed Dec 15 22:28:50 2021 -0500

PROTON-2562: Use a fixed size buffer for more log messages

The log messages that still use a pn_string_t either use that type
because of internal APIs.
---
 c/src/core/logger.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/c/src/core/logger.c b/c/src/core/logger.c
index 0ea4fba59..2ee9e1dd1 100644
--- a/c/src/core/logger.c
+++ b/c/src/core/logger.c
@@ -247,8 +247,16 @@ void pni_logger_log(pn_logger_t *logger, 
pn_log_subsystem_t subsystem, pn_log_le
 void pni_logger_vlogf(pn_logger_t *logger, pn_log_subsystem_t subsystem, 
pn_log_level_t severity, const char *fmt, va_list ap)
 {
   assert(logger);
-  pn_string_vformat(logger->scratch, fmt, ap);
-  pni_logger_log(logger, subsystem, severity, pn_string_get(logger->scratch));
+  char buf[1024];
+  pn_fixed_string_t output = pn_fixed_string(buf, sizeof(buf));
+  pn_fixed_string_vaddf(&output, fmt, ap);
+  if (output.position==output.size) {
+// Message overflow
+const char truncated[] = " ... (truncated)";
+output.position -= sizeof(truncated);
+pn_fixed_string_append(&output, pn_string_const(truncated, 
sizeof(truncated)));
+  }
+  pni_logger_log(logger, subsystem, severity, buf);
 }
 
 void pn_logger_logf(pn_logger_t *logger, pn_log_subsystem_t subsystem, 
pn_log_level_t severity, const char *fmt, ...)


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



[qpid-proton] branch main updated (bc364b993 -> a0443f64b)

2022-06-14 Thread astitcher
This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git


from bc364b993 Revert "NO-JIRA Workaround Travis CI package installation 
issues (#311)" (#372)
 new 6de74a08c PROTON-2562: Fix pn_value_dump to output to a fixed size 
string buffer
 new a0443f64b PROTON-2562: Use a fixed size buffer for more log messages

The 2 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.


Summary of changes:
 c/src/core/fixed_string.h |  94 +++
 c/src/core/logger.c   |  36 +++
 c/src/core/value_dump.c   | 162 --
 c/src/core/value_dump.h   |   6 +-
 4 files changed, 207 insertions(+), 91 deletions(-)
 create mode 100644 c/src/core/fixed_string.h


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



[qpid-proton] 01/02: PROTON-2562: Fix pn_value_dump to output to a fixed size string buffer

2022-06-14 Thread astitcher
This is an automated email from the ASF dual-hosted git repository.

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

commit 6de74a08c9b1d4dc7cf375fddb2256f8b5b41b48
Author: Andrew Stitcher 
AuthorDate: Wed Dec 15 21:40:48 2021 -0500

PROTON-2562: Fix pn_value_dump to output to a fixed size string buffer

Introduce a new fixed size string type that does not grow and works in a
fixed buffer.

This is then used by the logger to avoid dynamically
growing the logger output.
---
 c/src/core/fixed_string.h |  94 +++
 c/src/core/logger.c   |  24 ---
 c/src/core/value_dump.c   | 162 --
 c/src/core/value_dump.h   |   6 +-
 4 files changed, 197 insertions(+), 89 deletions(-)

diff --git a/c/src/core/fixed_string.h b/c/src/core/fixed_string.h
new file mode 100644
index 0..fc36ee866
--- /dev/null
+++ b/c/src/core/fixed_string.h
@@ -0,0 +1,94 @@
+#ifndef PROTON_FIXED_STRING_H
+#define PROTON_FIXED_STRING_H 1
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include "util.h"
+
+#include 
+
+typedef struct pn_fixed_string_t {
+  char*bytes;
+  uint32_t size;
+  uint32_t position;
+} pn_fixed_string_t;
+
+typedef struct pn_string_const_t {
+  const char *bytes;
+  uint32_t size;
+} pn_string_const_t;
+
+static inline pn_fixed_string_t pn_fixed_string(char *bytes, uint32_t size) {
+  return (pn_fixed_string_t) {.bytes=bytes, .size=size, .position=0};
+}
+
+static inline pn_string_const_t pn_string_const(const char* bytes, uint32_t 
size) {
+  return (pn_string_const_t) {.bytes=bytes, .size=size};
+}
+
+#define STR_CONST(x) pn_string_const(#x, sizeof(#x)-1)
+
+static inline void pn_fixed_string_append(pn_fixed_string_t *str, const 
pn_string_const_t chars) {
+  uint32_t copy_size = pn_min(chars.size, str->size-str->position);
+  if (copy_size==0) return;
+
+  memcpy(&str->bytes[str->position], chars.bytes, copy_size);
+  str->position += copy_size;
+}
+
+static inline void pn_fixed_string_vaddf(pn_fixed_string_t *str, const char 
*format, va_list ap){
+  uint32_t bytes_left = str->size-str->position;
+  if (bytes_left==0) return;
+
+  char *out = &str->bytes[str->position];
+  int out_size = vsnprintf(out, bytes_left, format, ap);
+  if ( out_size<0 ) return;
+  str->position += pn_min((uint32_t)out_size, bytes_left);
+}
+
+static inline void pn_fixed_string_addf(pn_fixed_string_t *str, const char 
*format, ...) {
+  va_list ap;
+  va_start(ap, format);
+  pn_fixed_string_vaddf(str, format, ap);
+  va_end(ap);
+}
+
+static inline void pn_fixed_string_quote(pn_fixed_string_t *str, const char 
*data, size_t size) {
+  size_t bytes_left = str->size-str->position;
+  if (bytes_left==0) return;
+
+  char *out = &str->bytes[str->position];
+  ssize_t out_size = pn_quote_data(out, bytes_left, data, size);
+  // The only error (ie value less than 0) that can come from pn_quote_data is 
PN_OVERFLOW
+  if ( out_size>0 ) {
+str->position += out_size;
+  } else {
+str->position = str->size;
+  }
+}
+
+static inline void pn_fixed_string_terminate(pn_fixed_string_t *str) {
+  if (str->position==str->size) str->position--;
+  str->bytes[str->position] = 0;
+}
+
+#endif // PROTON_FIXED_STRING_H
diff --git a/c/src/core/logger.c b/c/src/core/logger.c
index e81dc172c..0ea4fba59 100644
--- a/c/src/core/logger.c
+++ b/c/src/core/logger.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 
+#include "fixed_string.h"
 #include "memory.h"
 #include "util.h"
 #include "value_dump.h"
@@ -216,22 +217,25 @@ void pni_logger_log_msg_inspect(pn_logger_t *logger, 
pn_log_subsystem_t subsyste
 
 void pni_logger_log_msg_frame(pn_logger_t *logger, pn_log_subsystem_t 
subsystem, pn_log_level_t severity, pn_bytes_t frame, const char *fmt, ...) {
   va_list ap;
+  char buf[1024];
+  pn_fixed_string_t output = pn_fixed_string(buf, sizeof(buf));
 
   va_start(ap, fmt);
-  pn_string_vformat(logger->scratch, fmt, ap);
+  pn_fixed_string_vaddf(&output, fmt, ap);
   va_end(ap);
-  size_t psize = pn_value_dump(frame, logger->scratch);
+  size_t psize = pni_value_dump(frame, &output);
   pn_bytes_t payload = {.size=frame.siz

[qpid-protonj2] branch main updated: PROTON-2564 Reduece memory alloactions on send and receive paths

2022-06-14 Thread tabish
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new 10747f4a PROTON-2564 Reduece memory alloactions on send and receive 
paths
10747f4a is described below

commit 10747f4a58819a29ba5fdcc09755b3f0e1440fd3
Author: Timothy Bish 
AuthorDate: Tue Jun 14 17:58:27 2022 -0400

PROTON-2564 Reduece memory alloactions on send and receive paths

Reduces the amount of memory allocations in the engine and client on
both the send and receive paths during normal operations.
---
 .../protonj2/client/impl/ClientMessageSupport.java |  9 ++-
 .../protonj2/client/util/FifoDeliveryQueue.java| 75 +--
 .../protonj2/client/impl/ClientMessageTest.java|  1 +
 .../codec/decoders/messaging/DataTypeDecoder.java  |  6 +-
 .../ApplicationPropertiesTypeEncoder.java  | 12 ++-
 .../codec/encoders/messaging/DataTypeEncoder.java  |  9 +--
 .../messaging/DeliveryAnnotationsTypeEncoder.java  | 12 ++-
 .../encoders/messaging/FooterTypeEncoder.java  | 12 ++-
 .../messaging/MessageAnnotationsTypeEncoder.java   | 12 ++-
 .../codec/encoders/primitives/MapTypeEncoder.java  | 22 ++
 .../apache/qpid/protonj2/types/messaging/Data.java | 86 --
 .../qpid/protonj2/codec/benchmark/Benchmark.java   |  7 +-
 .../codec/messaging/DataTypeCodecTest.java |  2 +-
 .../qpid/protonj2/types/messaging/DataTest.java| 52 +
 14 files changed, 182 insertions(+), 135 deletions(-)

diff --git 
a/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/impl/ClientMessageSupport.java
 
b/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/impl/ClientMessageSupport.java
index a7cba17d..cf4ad91f 100644
--- 
a/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/impl/ClientMessageSupport.java
+++ 
b/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/impl/ClientMessageSupport.java
@@ -54,6 +54,11 @@ public abstract class ClientMessageSupport {
 private static final Encoder DEFAULT_ENCODER = 
CodecFactory.getDefaultEncoder();
 private static final Decoder DEFAULT_DECODER = 
CodecFactory.getDefaultDecoder();
 
+private static final ThreadLocal THREAD_LOCAL_ENCODER_STATE =
+ThreadLocal.withInitial(() -> DEFAULT_ENCODER.newEncoderState());
+private static final ThreadLocal THREAD_LOCAL_DECODER_STATE =
+ThreadLocal.withInitial(() -> DEFAULT_DECODER.newDecoderState());
+
 //- Message Conversion
 
 /**
@@ -92,7 +97,7 @@ public abstract class ClientMessageSupport {
 //- Message Encoding
 
 public static ProtonBuffer encodeMessage(AdvancedMessage message, 
Map deliveryAnnotations) throws ClientException {
-return encodeMessage(DEFAULT_ENCODER, 
DEFAULT_ENCODER.newEncoderState(), ProtonByteBufferAllocator.DEFAULT, message, 
deliveryAnnotations);
+return encodeMessage(DEFAULT_ENCODER, 
THREAD_LOCAL_ENCODER_STATE.get(), ProtonByteBufferAllocator.DEFAULT, message, 
deliveryAnnotations);
 }
 
 public static ProtonBuffer encodeMessage(Encoder encoder, 
ProtonBufferAllocator allocator, AdvancedMessage message, Map deliveryAnnotations) throws ClientException {
@@ -136,7 +141,7 @@ public abstract class ClientMessageSupport {
 //- Message Decoding
 
 public static Message decodeMessage(ProtonBuffer buffer, 
Consumer daConsumer) throws ClientException {
-return decodeMessage(DEFAULT_DECODER, 
DEFAULT_DECODER.newDecoderState(), buffer, daConsumer);
+return decodeMessage(DEFAULT_DECODER, 
THREAD_LOCAL_DECODER_STATE.get(), buffer, daConsumer);
 }
 
 public static Message decodeMessage(Decoder decoder, ProtonBuffer 
buffer, Consumer daConsumer) throws ClientException {
diff --git 
a/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/util/FifoDeliveryQueue.java
 
b/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/util/FifoDeliveryQueue.java
index 634b1ec6..91fbaebe 100644
--- 
a/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/util/FifoDeliveryQueue.java
+++ 
b/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/util/FifoDeliveryQueue.java
@@ -20,8 +20,6 @@ import java.util.ArrayDeque;
 import java.util.Deque;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.ReentrantLock;
 
 import org.apache.qpid.protonj2.client.Delivery;
 import org.apache.qpid.protonj2.client.impl.ClientDelivery;
@@ -40,9 +38,6 @@ public final class FifoDeliveryQueue implements DeliveryQueue 
{
 
 private volatile int state = STOPPED;
 
-private final ReentrantLock lock = new ReentrantLock();
-private final Condition condition = lock.newCondition();
-
 private final Deque queue;
 
 /**
@@