- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个 Apache Camel 路由,它从 netty:udp 使用,可以选择将 UDP 响应发送回 UDP 客户端(如果请求),并生成 Kafka 主题。我偶尔会收到以下 java.net.SocketException ,这会导致 netty 停止监听配置的 UDP 端口。我想我关心的是所有套接字代码都是camel-netty,这似乎是一个严重的问题(即停止路由的相关netty UDP监听器,我已经通过Linux netstat命令验证了这一点)。
我目前正在使用 -Djava.net.preferIPv4Stack=true 测试 JVM 执行,正如其他帖子所建议的那样,但我担心的是“无效参数”SocketException 仅很少发生,所以不确定设置 -Djava.net.preferIPv4Stack=true 真的能解决问题吗?
我想知道是否升级到camel-netty4 能解决这个问题吗?我没有编写自己的套接字代码,都是 Camel/netty。
我正在使用 Java 1.7 和 RHEL-6 的 Linux 物理服务器上运行。任何想法都非常感激!!!
这是我的路线 XML:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<route startupOrder="104" customId="true" id="ROUTE_ID_RAW_DTC_EVENTS" xmlns="http://camel.apache.org/schema/spring">
<from uri="netty:udp://talend-es-edge-01.kiad0.s.mission.net:62265?serverPipelineFactory=#DTC_SERVER_PIPELINE_FACTORY_ROUTE_ID_RAW_DTC_EVENTS&keepAlive=true&sync=true&orderedThreadPoolExecutor=false&receiveBufferSize=8388608&sendBufferSize=8388608&allowDefaultCodec=false&disconnectOnNoReply=false&receiveBufferSizePredictor=8192"/>
<setProperty propertyName="CamelCharsetName" id="setProperty10">
<expressionDefinition>iso-8859-1</expressionDefinition>
</setProperty>
<threads poolSize="7" maxPoolSize="14" threadName="threads_ROUTE_ID_RAW_DTC_EVENTS" callerRunsWhenRejected="true" id="threads3">
<wireTap uri="netty:udp://abinitio-edge-02.kiad0.s.mission.net:62265?clientPipelineFactory=#DTC_CLIENT_PIPELINE_FACTORY_ROUTE_ID_RAW_DTC_EVENTS&sync=false&sendBufferSize=8388608&allowDefaultCodec=false" customId="true" id="ROUTE_ID_RAW_DTC_EVENTS_MIRROR"/>
<multicast parallelProcessing="true" id="multicast3">
<to uri="seda:SEDA_TOP_102?size=100000&concurrentConsumers=10&waitForTaskToComplete=Never&failIfNoConsumers=true&timeout=10000" id="to8"/>
<to uri="seda:SEDA_ACK_103?size=100000&concurrentConsumers=10&waitForTaskToComplete=IfReplyExpected&failIfNoConsumers=true&timeout=10000" customId="true" id="ROUTE_ID_RAW_DTC_EVENTS_TO_FIRST_URIS"/>
<setProperty propertyName="CamelCharsetName" id="setProperty11">
<expressionDefinition>iso-8859-1</expressionDefinition>
</setProperty>
</multicast>
</threads>
</route>
这是显示 SocketException 的堆栈跟踪:
java.nio.channels.ClosedChannelException
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.cleanUpWriteBuffer(AbstractNioWorker.java:433) ~[netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.socket.nio.NioDatagramWorker.writeFromUserCode(NioDatagramWorker.java:212) ~[netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.socket.nio.NioDatagramPipelineSink.eventSunk(NioDatagramPipelineSink.java:97) ~[netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendDownstream(DefaultChannelPipeline.java:779) ~[netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.Channels.write(Channels.java:725) ~[netty-3.9.6.Final.jar:?]
at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.doEncode(OneToOneEncoder.java:71) ~[netty-3.9.6.Final.jar:?]
at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:59) ~[netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:591) ~[netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:582) ~[netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.Channels.write(Channels.java:704) ~[netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:252) ~[netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.socket.nio.NioDatagramChannel.write(NioDatagramChannel.java:299) ~[netty-3.9.6.Final.jar:?]
at org.apache.camel.component.netty.NettyHelper.writeBodyAsync(NettyHelper.java:93) [camel-netty-2.15.2.jar:2.15.2]
at org.apache.camel.component.netty.NettyProducer.process(NettyProducer.java:263) [camel-netty-2.15.2.jar:2.15.2]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448) [camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191) [camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109) [camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87) [camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.WireTapProcessor$1.call(WireTapProcessor.java:119) [camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.WireTapProcessor$1.call(WireTapProcessor.java:113) [camel-core-2.15.2.jar:2.15.2]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [?:1.7.0_75]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [?:1.7.0_75]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [?:1.7.0_75]
at java.lang.Thread.run(Thread.java:745) [?:1.7.0_75]
[2015-09-04 21:45:02,532] WARN [New I/O worker #49] Caused by: [org.apache.camel.CamelExchangeException - Cannot write response to /188.122.39.102:0. Exchange[Message: ]. Caused by: [java.net.SocketException - Invalid argument]]
org.apache.camel.CamelExchangeException: Cannot write response to /188.122.39.102:0. Exchange[Message: ]. Caused by: [java.net.SocketException - Invalid argument]
at org.apache.camel.component.netty.handlers.ServerResponseFutureListener.operationComplete(ServerResponseFutureListener.java:53) [camel-netty-2.15.2.jar:2.15.2]
at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:431) [netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.DefaultChannelFuture.notifyListeners(DefaultChannelFuture.java:417) [netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.DefaultChannelFuture.setFailure(DefaultChannelFuture.java:384) [netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.socket.nio.NioDatagramWorker.write0(NioDatagramWorker.java:319) [netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.writeFromTaskLoop(AbstractNioWorker.java:151) [netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.socket.nio.AbstractNioChannel$WriteTask.run(AbstractNioChannel.java:335) [netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:391) [netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:315) [netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) [netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.socket.nio.NioDatagramWorker.run(NioDatagramWorker.java:343) [netty-3.9.6.Final.jar:?]
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) [netty-3.9.6.Final.jar:?]
at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) [netty-3.9.6.Final.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [?:1.7.0_75]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [?:1.7.0_75]
at java.lang.Thread.run(Thread.java:745) [?:1.7.0_75]
Caused by: java.net.SocketException: Invalid argument
at sun.nio.ch.DatagramChannelImpl.send0(Native Method) ~[?:1.7.0_75]
at sun.nio.ch.DatagramChannelImpl.sendFromNativeBuffer(DatagramChannelImpl.java:532) ~[?:1.7.0_75]
at sun.nio.ch.DatagramChannelImpl.send(DatagramChannelImpl.java:494) ~[?:1.7.0_75]
at sun.nio.ch.DatagramChannelImpl.send(DatagramChannelImpl.java:473) ~[?:1.7.0_75]
at org.jboss.netty.channel.socket.nio.SocketSendBufferPool$UnpooledSendBuffer.transferTo(SocketSendBufferPool.java:207) ~[netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.socket.nio.NioDatagramWorker.write0(NioDatagramWorker.java:281) ~[netty-3.9.6.Final.jar:?]
... 11 more
[2015-09-04 21:45:02,535] WARN [pool-17-thread-23] Closing channel as an exception was thrown from Netty. Caused by: [java.net.SocketException - Invalid argument]
java.net.SocketException: Invalid argument
at sun.nio.ch.DatagramChannelImpl.send0(Native Method) ~[?:1.7.0_75]
at sun.nio.ch.DatagramChannelImpl.sendFromNativeBuffer(DatagramChannelImpl.java:532) ~[?:1.7.0_75]
at sun.nio.ch.DatagramChannelImpl.send(DatagramChannelImpl.java:494) ~[?:1.7.0_75]
at sun.nio.ch.DatagramChannelImpl.send(DatagramChannelImpl.java:473) ~[?:1.7.0_75]
at org.jboss.netty.channel.socket.nio.SocketSendBufferPool$UnpooledSendBuffer.transferTo(SocketSendBufferPool.java:207) ~[netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.socket.nio.NioDatagramWorker.write0(NioDatagramWorker.java:281) ~[netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.writeFromTaskLoop(AbstractNioWorker.java:151) ~[netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.socket.nio.AbstractNioChannel$WriteTask.run(AbstractNioChannel.java:335) ~[netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:391) ~[netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:315) ~[netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) ~[netty-3.9.6.Final.jar:?]
at org.jboss.netty.channel.socket.nio.NioDatagramWorker.run(NioDatagramWorker.java:343) ~[netty-3.9.6.Final.jar:?]
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) ~[netty-3.9.6.Final.jar:?]
at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) ~[netty-3.9.6.Final.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [?:1.7.0_75]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [?:1.7.0_75]
at java.lang.Thread.run(Thread.java:745) [?:1.7.0_75]
最佳答案
我已经使用camel-netty4 UDP有一段时间了,没有出现这样的问题。我建议您使用camel-netty4,除非您有一些令人信服的理由坚持使用camel-netty(netty3)
关于linux - Camel 2.15.2/netty3 : "java.net.SocketException: Invalid argument" from DatagramChannelImpl. send0(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32466219/
我很难理解为什么这段代码无法编译: use std::cell::{Ref, RefCell}; struct St { data: RefCell } impl St { pub f
我从Richard Blum的一本书《 C#网络编程》中读到有关套接字的信息。以下摘录指出,不保证Send()方法可以发送所有传递给它的数据。 byte[] data = new byte[1024]
我有以下程序,它必须一次读取 1MB 的文件,将其发送到服务器(每次总是 1MB)并返回哈希码: #include #include #include #include #include #
代码在底部。 第 207 行的 send() 命令本身可以正常工作。但是,当我在第 218 行添加 send() 命令时,第一个命令失败 - 给出错误“地址错误”。我已经确认第二个 send() 命令
标记包含 !Send 的类型背后的原因是什么?字段(如 Rc 或 NonNull )与 Send特征?例如,标准库的 LinkedList 以这种方式工作:它包含 Option>字段并实现 Send特
我是新手,我正在尝试学习 goroutines 中信号函数的一些基本用法。我在 go 中有一个无限循环。通过这个 for 循环,我通过 channel 将值传递给 goroutine。 我也有一个阈值
如果数据是从另一台计算机(首先)“发送”的,我如何设置我的套接字例程以“发送”(首先)或(切换)“接收”? 谢谢 通用代码: -(void) TcpClient{ char buffer[12
这个问题已经有答案了: Java multiple file transfer over socket (3 个回答) 已关闭 4 年前。 我正在使用 Java Socket 将文件发送到服务器,然后
根据以下示例中的类型,Go编译器似乎将执行两个完全不同的语义操作: chanA <-chanB 如果chanA是类型(chan chan <-字符串),则此操作会将本身类型chanB的类型(chan
我正在尝试在 VBA 中使用 WinSock2 从本地主机 TCP 流发送(以及稍后接收)数据。 目前,我主要尝试从此处复制客户端示例,https://msdn.microsoft.com/en-us
我在我的 Mac OS X Yosemite 控制台中看到了这个: AppleEvents: Send port for process has no send right, port=( port:
我知道Clojure的“代理”是ref,带有“操作”的添加工作队列。 Action 是使用ref的值在第一个位置调用的函数,可以将其传递给其他参数。操作将返回ref的新值。因此,“代理”是一种计算re
我无法将任何对象或数组传递给 IPCRenderer。 通过 ipcs 传递对象或数组时出现错误,我什至尝试通过使用 JSON.stringify 转换为字符串来发送,但它会将其转换为空对象字符串。
我正在使用unix scoket进行数据传输(SOCK_STREAM模式) 我需要发送超过100k个字符的字符串。首先,我发送一个字符串的长度-它是sizeof(int)个字节。 length = s
Clojure API 将这两个函数描述为: (send a f & args) - Dispatch an action to an agent. Returns the agent immedia
def send_Button(): try: myMsg = "ME: " + text.get() msg = text.get() con
Ruby 对象都有一个“发送”方法,但是,我正在尝试使用一个 Java 库 ( netty-tools ),它的一个接口(interface)上有一个“发送”方法。 用法应该是 java_obj.se
Feb 8, 2011 11:56:49 AM com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPC onnection post SEVE
来自 man 2 send: MSG_MORE (since Linux 2.4.4) (…) Since Linux 2.6, this flag is also supported for UDP
我的网页中可以有一个按钮,用于将预填充的消息发送到特定号码吗? 我正在尝试 intent://send/+391234567890#Intent;scheme=smsto;package=com.wh
我是一名优秀的程序员,十分优秀!