This is an automated email from the ASF dual-hosted git repository.

robbie pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/main by this push:
     new 642a2c79fd ARTEMIS-4913 provide more details on error callbacks
642a2c79fd is described below

commit 642a2c79fd8976dd1443459ebbff8a10a9b7fa4b
Author: Justin Bertram <jbert...@apache.org>
AuthorDate: Tue Jul 9 11:02:41 2024 -0500

    ARTEMIS-4913 provide more details on error callbacks
---
 .../activemq/artemis/jdbc/store/file/JDBCSequentialFile.java   |  6 +++---
 .../activemq/artemis/core/io/AbstractSequentialFile.java       |  2 +-
 .../apache/activemq/artemis/core/io/aio/AIOSequentialFile.java |  4 ++--
 .../activemq/artemis/core/io/aio/AIOSequentialFileFactory.java |  2 +-
 .../activemq/artemis/core/io/mapped/MappedSequentialFile.java  |  8 ++++----
 .../apache/activemq/artemis/core/io/nio/NIOSequentialFile.java |  8 ++++----
 .../activemq/artemis/core/paging/impl/PageSyncTimer.java       |  2 +-
 .../core/persistence/impl/journal/OperationContextImpl.java    |  2 +-
 .../activemq/artemis/core/server/ActiveMQServerLogger.java     |  6 +++---
 .../artemis/core/transaction/impl/TransactionImpl.java         | 10 +++++-----
 10 files changed, 25 insertions(+), 25 deletions(-)

diff --git 
a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFile.java
 
b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFile.java
index 5289313ba3..771e5c47a1 100644
--- 
a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFile.java
+++ 
b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFile.java
@@ -197,7 +197,7 @@ public class JDBCSequentialFile implements SequentialFile {
          }
       } catch (Exception e) {
          if (callback != null)
-            callback.onError(ActiveMQExceptionType.IO_ERROR.getCode(), 
e.getMessage());
+            callback.onError(ActiveMQExceptionType.IO_ERROR.getCode(), 
e.getClass() + " during JDBC write:" + e.getMessage());
          fileFactory.onIOError(e, "Error writing to JDBC file.", this);
       }
       return 0;
@@ -330,7 +330,7 @@ public class JDBCSequentialFile implements SequentialFile {
                waitIOCallback.waitCompletion();
             }
          } catch (Exception e) {
-            waitIOCallback.onError(ActiveMQExceptionType.IO_ERROR.getCode(), 
"Error writing to JDBC file.");
+            waitIOCallback.onError(ActiveMQExceptionType.IO_ERROR.getCode(), 
e.getClass() + " during JDBC write direct:" + e.getMessage());
             fileFactory.onIOError(e, "Failed to write to file.", this);
          }
       } else {
@@ -361,7 +361,7 @@ public class JDBCSequentialFile implements SequentialFile {
             return read;
          } catch (SQLException e) {
             if (callback != null)
-               callback.onError(ActiveMQExceptionType.IO_ERROR.getCode(), 
e.getMessage());
+               callback.onError(ActiveMQExceptionType.IO_ERROR.getCode(), 
e.getClass() + " during JDBC read:" + e.getMessage());
             fileFactory.onIOError(e, "Error reading from JDBC file.", this);
          }
          return 0;
diff --git 
a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/AbstractSequentialFile.java
 
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/AbstractSequentialFile.java
index aa79f5b8d6..df8bfe9e49 100644
--- 
a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/AbstractSequentialFile.java
+++ 
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/AbstractSequentialFile.java
@@ -305,7 +305,7 @@ public abstract class AbstractSequentialFile implements 
SequentialFile {
             } catch (Throwable e) {
                logger.warn(e.getMessage(), e);
                if (callbacks != null) {
-                  callbacks.forEach(c -> 
c.onError(ActiveMQExceptionType.IO_ERROR.getCode(), e.getMessage()));
+                  callbacks.forEach(c -> 
c.onError(ActiveMQExceptionType.IO_ERROR.getCode(), e.getClass() + " during 
checkSync on " + file.getPath() + ": " + e.getMessage()));
                }
             }
          }
diff --git 
a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java
 
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java
index 422ce0774d..8f1a9d35d9 100644
--- 
a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java
+++ 
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java
@@ -223,7 +223,7 @@ public class AIOSequentialFile extends 
AbstractSequentialFile  {
          checkOpened();
       } catch (Exception e) {
          logger.warn(e.getMessage(), e);
-         completion.onError(-1, e.getMessage());
+         completion.onError(-1, e.getClass() + " during blocking write direct: 
" + e.getMessage());
          return;
       }
 
@@ -247,7 +247,7 @@ public class AIOSequentialFile extends 
AbstractSequentialFile  {
          checkOpened();
       } catch (Exception e) {
          logger.warn(e.getMessage(), e);
-         callback.onError(-1, e.getMessage());
+         callback.onError(-1, e.getClass() + " during write direct: " + 
e.getMessage());
          return;
       }
 
diff --git 
a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java
 
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java
index 91b093eecf..8b1662f02b 100644
--- 
a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java
+++ 
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java
@@ -362,7 +362,7 @@ public final class AIOSequentialFileFactory extends 
AbstractSequentialFileFactor
          try {
             libaioFile.write(position, bytes, buffer, this);
          } catch (IOException e) {
-            callback.onError(ActiveMQExceptionType.IO_ERROR.getCode(), 
e.getMessage());
+            callback.onError(ActiveMQExceptionType.IO_ERROR.getCode(), 
e.getClass() + " during write to " + sequentialFile.getFileName() + ": " + 
e.getMessage());
             onIOError(e, "Failed to write to file", sequentialFile);
          }
       }
diff --git 
a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/mapped/MappedSequentialFile.java
 
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/mapped/MappedSequentialFile.java
index 116d5804f2..56468d9de3 100644
--- 
a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/mapped/MappedSequentialFile.java
+++ 
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/mapped/MappedSequentialFile.java
@@ -170,7 +170,7 @@ final class MappedSequentialFile implements SequentialFile {
          if (this.criticalErrorListener != null) {
             this.criticalErrorListener.onIOException(new 
ActiveMQIOErrorException(e.getMessage(), e), e.getMessage(), 
this.getFileName());
          }
-         callback.onError(ActiveMQExceptionType.IO_ERROR.getCode(), 
e.getMessage());
+         callback.onError(ActiveMQExceptionType.IO_ERROR.getCode(), 
e.getClass() + " during write: " + e.getMessage());
          throw e;
       }
    }
@@ -206,7 +206,7 @@ final class MappedSequentialFile implements SequentialFile {
          if (this.criticalErrorListener != null) {
             this.criticalErrorListener.onIOException(new 
ActiveMQIOErrorException(e.getMessage(), e), e.getMessage(), 
this.getFileName());
          }
-         callback.onError(ActiveMQExceptionType.IO_ERROR.getCode(), 
e.getMessage());
+         callback.onError(ActiveMQExceptionType.IO_ERROR.getCode(), 
e.getClass() + " during write: " + e.getMessage());
          throw e;
       }
    }
@@ -243,7 +243,7 @@ final class MappedSequentialFile implements SequentialFile {
          if (this.criticalErrorListener != null) {
             this.criticalErrorListener.onIOException(new 
ActiveMQIOErrorException(e.getMessage(), e), e.getMessage(), 
this.getFileName());
          }
-         callback.onError(ActiveMQExceptionType.IO_ERROR.getCode(), 
e.getMessage());
+         callback.onError(ActiveMQExceptionType.IO_ERROR.getCode(), 
e.getClass() + " during write direct: " + e.getMessage());
          throw new RuntimeException(e);
       } finally {
          this.factory.releaseBuffer(bytes);
@@ -317,7 +317,7 @@ final class MappedSequentialFile implements SequentialFile {
          if (this.criticalErrorListener != null) {
             this.criticalErrorListener.onIOException(new 
ActiveMQIOErrorException(e.getMessage(), e), e.getMessage(), 
this.getFileName());
          }
-         callback.onError(ActiveMQExceptionType.IO_ERROR.getCode(), 
e.getMessage());
+         callback.onError(ActiveMQExceptionType.IO_ERROR.getCode(), 
e.getClass() + " during read: " + e.getMessage());
          throw e;
       }
    }
diff --git 
a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/nio/NIOSequentialFile.java
 
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/nio/NIOSequentialFile.java
index 3dd7be7b0d..b823ca5d18 100644
--- 
a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/nio/NIOSequentialFile.java
+++ 
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/nio/NIOSequentialFile.java
@@ -306,7 +306,7 @@ public class NIOSequentialFile extends 
AbstractSequentialFile {
          throw e;
       } catch (IOException e) {
          if (callback != null) {
-            callback.onError(ActiveMQExceptionType.IO_ERROR.getCode(), 
e.getLocalizedMessage());
+            callback.onError(ActiveMQExceptionType.IO_ERROR.getCode(), 
e.getClass() + " during read: " + e.getLocalizedMessage());
          }
 
          factory.onIOError(new ActiveMQIOErrorException(e.getMessage(), e), 
e.getMessage(), this);
@@ -373,7 +373,7 @@ public class NIOSequentialFile extends 
AbstractSequentialFile {
       try {
          internalWrite(bytes, sync, callback, true);
       } catch (Exception e) {
-         callback.onError(ActiveMQExceptionType.GENERIC_EXCEPTION.getCode(), 
e.getMessage());
+         callback.onError(ActiveMQExceptionType.GENERIC_EXCEPTION.getCode(), 
e.getClass() + " during write direct: " + e.getMessage());
       }
    }
 
@@ -393,7 +393,7 @@ public class NIOSequentialFile extends 
AbstractSequentialFile {
                               boolean releaseBuffer) throws IOException, 
ActiveMQIOErrorException, InterruptedException {
       if (!isOpen()) {
          if (callback != null) {
-            callback.onError(ActiveMQExceptionType.IO_ERROR.getCode(), "File 
not opened - " + getFileName());
+            callback.onError(ActiveMQExceptionType.IO_ERROR.getCode(), "File 
not opened. Cannot write to " + getFileName());
          } else {
             throw ActiveMQJournalBundle.BUNDLE.fileNotOpened();
          }
@@ -480,7 +480,7 @@ public class NIOSequentialFile extends 
AbstractSequentialFile {
                   internalWrite(buffer, requestedSync, callback, false);
                } catch (Exception e) {
                   if (callbacks != null) {
-                     callbacks.forEach(c -> 
c.onError(ActiveMQExceptionType.GENERIC_EXCEPTION.getCode(), e.getMessage()));
+                     callbacks.forEach(c -> 
c.onError(ActiveMQExceptionType.GENERIC_EXCEPTION.getCode(), e.getClass() + " 
while flushing buffer: " + e.getMessage()));
                   }
                }
             } else {
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PageSyncTimer.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PageSyncTimer.java
index 821a9f8131..498167fcd6 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PageSyncTimer.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PageSyncTimer.java
@@ -86,7 +86,7 @@ final class PageSyncTimer extends ActiveMQScheduledComponent {
          }
       } catch (Exception e) {
          for (OperationContext ctx : pendingSyncsArray) {
-            ctx.onError(ActiveMQExceptionType.IO_ERROR.getCode(), 
e.getMessage());
+            ctx.onError(ActiveMQExceptionType.IO_ERROR.getCode(), e.getClass() 
+ " during ioSync for paging on " + store.getStoreName() + ": " + 
e.getMessage());
          }
       } finally {
          // In case of failure, The context should propagate an exception to 
the client
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/OperationContextImpl.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/OperationContextImpl.java
index 76ba063f4b..af61e206cc 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/OperationContextImpl.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/OperationContextImpl.java
@@ -323,7 +323,7 @@ public class OperationContextImpl implements 
OperationContext {
       } catch (Throwable e) {
          ActiveMQServerLogger.LOGGER.errorExecutingAIOCallback(e);
          EXECUTORS_PENDING_UPDATER.decrementAndGet(this);
-         task.onError(ActiveMQExceptionType.INTERNAL_ERROR.getCode(), "It 
wasn't possible to complete IO operation - " + e.getMessage());
+         task.onError(ActiveMQExceptionType.INTERNAL_ERROR.getCode(), "It 
wasn't possible to complete IO operation due to " + e.getClass() + ": " + 
e.getMessage());
       }
    }
 
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
index a29ad5f8df..6ace528ee2 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
@@ -512,7 +512,7 @@ public interface ActiveMQServerLogger {
    @LogMessage(id = 222062, value = "Cleared up resources for session {}", 
level = LogMessage.Level.WARN)
    void clearingUpSession(String name);
 
-   @LogMessage(id = 222063, value = "Error processing IOCallback code = {} 
message = {}", level = LogMessage.Level.WARN)
+   @LogMessage(id = 222063, value = "Error processing IOCallback; code = {}, 
message = {}", level = LogMessage.Level.WARN)
    void errorProcessingIOCallback(Integer errorCode, String errorMessage);
 
    @LogMessage(id = 222065, value = "Client is not being consistent on the 
request versioning. It just sent a version id={} while it informed {} 
previously", level = LogMessage.Level.DEBUG)
@@ -626,8 +626,8 @@ public interface ActiveMQServerLogger {
    @LogMessage(id = 222103, value = "transaction with xid {} timed out", level 
= LogMessage.Level.WARN)
    void timedOutXID(Xid xid);
 
-   @LogMessage(id = 222104, value = "IO Error completing the transaction, code 
= {}, message = {}", level = LogMessage.Level.WARN)
-   void ioErrorOnTX(Integer errorCode, String errorMessage);
+   @LogMessage(id = 222104, value = "IO Error completing transaction {}; code 
= {}, message = {}", level = LogMessage.Level.WARN)
+   void ioErrorOnTX(String op, Integer errorCode, String errorMessage);
 
    @LogMessage(id = 222106, value = "Replacing incomplete LargeMessage with 
ID={}", level = LogMessage.Level.WARN)
    void replacingIncompleteLargeMessage(Long messageID);
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImpl.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImpl.java
index b371e6745f..7cf8fd4800 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImpl.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImpl.java
@@ -228,7 +228,7 @@ public class TransactionImpl implements Transaction {
 
                @Override
                public void onError(final int errorCode, final String 
errorMessage) {
-                  ActiveMQServerLogger.LOGGER.ioErrorOnTX(errorCode, 
errorMessage);
+                  ActiveMQServerLogger.LOGGER.ioErrorOnTX("prepare", 
errorCode, errorMessage);
                }
 
                @Override
@@ -306,7 +306,7 @@ public class TransactionImpl implements Transaction {
 
             @Override
             public void onError(final int errorCode, final String 
errorMessage) {
-               ActiveMQServerLogger.LOGGER.ioErrorOnTX(errorCode, 
errorMessage);
+               ActiveMQServerLogger.LOGGER.ioErrorOnTX("commit - 
afterComplete", errorCode, errorMessage);
             }
 
             @Override
@@ -323,7 +323,7 @@ public class TransactionImpl implements Transaction {
 
                @Override
                public void onError(final int errorCode, final String 
errorMessage) {
-                  ActiveMQServerLogger.LOGGER.ioErrorOnTX(errorCode, 
errorMessage);
+                  ActiveMQServerLogger.LOGGER.ioErrorOnTX("commit - 
afterStore", errorCode, errorMessage);
                }
 
                @Override
@@ -428,7 +428,7 @@ public class TransactionImpl implements Transaction {
 
          @Override
          public void onError(final int errorCode, final String errorMessage) {
-            ActiveMQServerLogger.LOGGER.ioErrorOnTX(errorCode, errorMessage);
+            ActiveMQServerLogger.LOGGER.ioErrorOnTX("rollback - 
afterComplete", errorCode, errorMessage);
          }
 
          @Override
@@ -442,7 +442,7 @@ public class TransactionImpl implements Transaction {
 
             @Override
             public void onError(final int errorCode, final String 
errorMessage) {
-               ActiveMQServerLogger.LOGGER.ioErrorOnTX(errorCode, 
errorMessage);
+               ActiveMQServerLogger.LOGGER.ioErrorOnTX("rollback - 
afterStore", errorCode, errorMessage);
             }
 
             @Override


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@activemq.apache.org
For additional commands, e-mail: commits-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact


Reply via email to