[ 
https://issues.apache.org/jira/browse/RATIS-1946?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tsz-wo Sze updated RATIS-1946:
------------------------------
    Component/s: util
    Description: 
The stack trace of the AnnotatedConnectException below is not printed.
{code}
2023-11-30 18:39:01,119 [Thread-1101] WARN  util.PeerProxyMap 
(PeerProxyMap.java:closeProxy(170)) - 
11465090-3010-4e96-be94-48488fc5822b-NettyServerStreamRpc: Failed to close 
proxy for peer 2ad30381-d2ef-4801-b4d0-3965e2d4accc|127.0.0.1:15023, proxy 
class: class org.apache.ratis.client.impl.DataStreamClientImpl
org.apache.ratis.thirdparty.io.netty.channel.AbstractChannel$AnnotatedConnectException:
 finishConnect(..) failed: Connection refused: /127.0.0.1:15024
Caused by: java.net.ConnectException: finishConnect(..) failed: Connection 
refused
        at 
org.apache.ratis.thirdparty.io.netty.channel.unix.Errors.newConnectException0(Errors.java:166)
        at 
org.apache.ratis.thirdparty.io.netty.channel.unix.Errors.handleConnectErrno(Errors.java:131)
        at 
org.apache.ratis.thirdparty.io.netty.channel.unix.Socket.finishConnect(Socket.java:359)
        at 
org.apache.ratis.thirdparty.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.doFinishConnect(AbstractEpollChannel.java:710)
        at 
org.apache.ratis.thirdparty.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.finishConnect(AbstractEpollChannel.java:687)
        at 
org.apache.ratis.thirdparty.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.epollOutReady(AbstractEpollChannel.java:567)
        at 
org.apache.ratis.thirdparty.io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:499)
        at 
org.apache.ratis.thirdparty.io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:407)
        at 
org.apache.ratis.thirdparty.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
        at 
org.apache.ratis.thirdparty.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at java.lang.Thread.run(Thread.java:750)
{code}


  was:
The "{}" message format syntax does not work for exception.
{code}
//PeerProxyMap.java
     } catch (IOException e) {
      LOG.warn("{}: Failed to close proxy for peer {}, proxy class: {}",
          name, pp, proxy.getClass(), e);
     }
{code}
As an example, the exception e and its stack trace will not be printed in the 
code above since it is calling
{code}
//org.slf4j.Logger
  void warn(String var1, Object... var2);
{code}
with one "{}" less.  There are three "{}" but four objects (including e).  The 
expectation is to call
{code}
  void warn(String var1, Object var2, Object var3, Object var4, Throwable var5);
{code}
but such method does not exist.


        Summary: PeerProxyMap: Stack trace may not be printed.  (was: slf4j: 
Exception may not be printed.)

[~adoroszlai], thanks for tips.  Revised the Summary and the Description.

> PeerProxyMap: Stack trace may not be printed.
> ---------------------------------------------
>
>                 Key: RATIS-1946
>                 URL: https://issues.apache.org/jira/browse/RATIS-1946
>             Project: Ratis
>          Issue Type: Improvement
>          Components: util
>            Reporter: Tsz-wo Sze
>            Assignee: Tsz-wo Sze
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> The stack trace of the AnnotatedConnectException below is not printed.
> {code}
> 2023-11-30 18:39:01,119 [Thread-1101] WARN  util.PeerProxyMap 
> (PeerProxyMap.java:closeProxy(170)) - 
> 11465090-3010-4e96-be94-48488fc5822b-NettyServerStreamRpc: Failed to close 
> proxy for peer 2ad30381-d2ef-4801-b4d0-3965e2d4accc|127.0.0.1:15023, proxy 
> class: class org.apache.ratis.client.impl.DataStreamClientImpl
> org.apache.ratis.thirdparty.io.netty.channel.AbstractChannel$AnnotatedConnectException:
>  finishConnect(..) failed: Connection refused: /127.0.0.1:15024
> Caused by: java.net.ConnectException: finishConnect(..) failed: Connection 
> refused
>       at 
> org.apache.ratis.thirdparty.io.netty.channel.unix.Errors.newConnectException0(Errors.java:166)
>       at 
> org.apache.ratis.thirdparty.io.netty.channel.unix.Errors.handleConnectErrno(Errors.java:131)
>       at 
> org.apache.ratis.thirdparty.io.netty.channel.unix.Socket.finishConnect(Socket.java:359)
>       at 
> org.apache.ratis.thirdparty.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.doFinishConnect(AbstractEpollChannel.java:710)
>       at 
> org.apache.ratis.thirdparty.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.finishConnect(AbstractEpollChannel.java:687)
>       at 
> org.apache.ratis.thirdparty.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.epollOutReady(AbstractEpollChannel.java:567)
>       at 
> org.apache.ratis.thirdparty.io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:499)
>       at 
> org.apache.ratis.thirdparty.io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:407)
>       at 
> org.apache.ratis.thirdparty.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
>       at 
> org.apache.ratis.thirdparty.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
>       at java.lang.Thread.run(Thread.java:750)
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to