rabbitmq-cdi icon indicating copy to clipboard operation
rabbitmq-cdi copied to clipboard

Important Error Exception is swallowed

Open Gr33nbl00d opened this issue 4 years ago • 1 comments

Code in ConnectionManager (see below) does not print important exceptions anymore if debug is not enabled. Suggested change: always log ioexceptions with warning and exception only timeout exceptions with current code. I guess an ioexception is always an error case and should not happen in normal operation. Or am i wrong? At least it might would help to see the error message. (Might add at least e.getMessage() to log output) Exception which was swallowed in my example:

com.rabbitmq.client.ShutdownSignalException: connection error; protocol method: #method<connection.close>(reply-code=530, reply-text=NOT_ALLOWED - access to vhost '/' refused for user 'xxx', class-id=10, method-id=40)

Took me quite a while to figure this out :)

try { connectionManagerLock.lock(); connection = createNewConnection(); return true; } catch (IOException | TimeoutException e) { LOGGER.warn("Could not establish connection using {}", config, LOGGER.isDebugEnabled() ? e : null); } finally { connectionManagerLock.unlock(); }

Gr33nbl00d avatar Sep 02 '20 08:09 Gr33nbl00d

@Gr33nbl00d the question would be to take the multi catch apart and log a simple warning if it's a timeout exception without a stacktrace and an error with stacktrace in case of the remaining IOExceptions?

reinhapa avatar Sep 07 '20 07:09 reinhapa