Corda MQ节点错误 - 使用p2pAddress主机名的错误端点的消息

时间:2018-05-31 15:22:23

标签: corda

我正在运行Corda 3.1,并在不同的计算机上运行节点。如果我将p2pAddress指定为我的主机名,则在成功启动后,在IOU示例中尝试事务时收到错误端点错误的消息:

[ERROR] 2018-05-31T14:48:22,406Z [nioEventLoopGroup-2-1] O=Bank A,L=London,C=GB.write - Error in AMQP write processing {}
java.lang.IllegalArgumentException: Message for incorrect endpoint
    at net.corda.nodeapi.internal.protonwrapper.netty.AMQPChannelHandler.write(AMQPChannelHandler.kt:124) [corda-node-api-3.1-corda.jar:?]
    at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:738) [netty-all-4.1.9.Final.jar:4.1.9.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:730) [netty-all-4.1.9.Final.jar:4.1.9.Final]
    at io.netty.channel.AbstractChannelHandlerContext.access$1900(AbstractChannelHandlerContext.java:38) [netty-all-4.1.9.Final.jar:4.1.9.Final]
    at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.write(AbstractChannelHandlerContext.java:1089) [netty-all-4.1.9.Final.jar:4.1.9.Final]
    at io.netty.channel.AbstractChannelHandlerContext$WriteAndFlushTask.write(AbstractChannelHandlerContext.java:1136) [netty-all-4.1.9.Final.jar:4.1.9.Final]
    at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:1078) [netty-all-4.1.9.Final.jar:4.1.9.Final]
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) [netty-all-4.1.9.Final.jar:4.1.9.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403) [netty-all-4.1.9.Final.jar:4.1.9.Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:442) [netty-all-4.1.9.Final.jar:4.1.9.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) [netty-all-4.1.9.Final.jar:4.1.9.Final]
    at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144) [netty-all-4.1.9.Final.jar:4.1.9.Final]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_171] 

以下是我的node.conf的片段:

myLegalName : "O=Bank A,L=London,C=GB"
p2pAddress : "my-load-balancer-hostname.aws.com:10002"
rpcSettings = {
    address : "localhost:10003"
    adminAddress : "localhost:10004"
}
rpcUsers : [
    { username=user1, password=test, permissions=[ ALL ] }
]
devMode : true

我可以通过将机器的IP地址用作p2pAddress来解决此问题(并按预期跨节点进行事务处理)。但是,我的节点IP可能会改变,因此我想使用主机名?这可能吗?

2 个答案:

答案 0 :(得分:0)

这似乎与AWS负载均衡器有关。

答案 1 :(得分:0)

对此进行了进一步的调试,并找到了根本原因。

验证AMQ目标时,从AMQPChannelHandler.kt的第148行抛出了错误:

require(inetAddress == remoteAddress) { "Message for incorrect endpoint" }

由于IP更改,因此InetSocketAddress.java相等返回false。调试属性:

inetAddress.hostString: party-corda-node-dev.aws.co.com,
inetAddress.address: party-corda-node-dev.aws.co.com/10.224.8.233     
inetAddress.port: 10002
inetAddress.isUnresolved: false

remoteAddress.hostString: liberty-corda-node-dev.aws.co.com
remoteAddress.address: liberty-corda-node-dev.aws.co.com/10.224.10.46
remoteAddress.port: 10002
remoteAddress.isUnresolved: false

建议的修复程序,以针对解析的主机名删除该验证检查。

记录在拉取请求https://github.com/corda/corda/pull/3381