I am fairly new to MINA, but have not been able to sort out an issue
that I have encountered by reading the documentation or FAQ. I
therefore believe I am within my rights to now post to this list. I
now humbly submit my situation and hope that there is some
configuration or setup issue that I have overlooked and someone can
set me straight about it.
My application is a UDP based server service which maintains some
information about all clients on the network. Anytime that a client
sends a registration message to the server, the server maintains the
IP address and Port of the client which may be used later for contact
from the server.
I first implemented the server UDP service using the 2.0_M2 stream,
but noticed an exception that would happen in certain situations. All
requests that either required no response or only a response to the
calling client worked fine. If a call to a client other than the
initiator was made, I would sometimes receive an exception like the
following. This does not happen all the time, but when it starts it
is terminal. It seems to happen in the case that the the session of
the non-initiator client (the client not doing the actual call to the
server) has not been used for a long period of time. This could be
due to the "non-initiator" client not connecting for a long period of
time, or having been shutdown.
java.net.SocketException: Operation not permitted
at sun.nio.ch.DatagramChannelImpl.send0(Native Method)
at
sun
.nio
.ch.DatagramChannelImpl.sendFromNativeBuffer(DatagramChannelImpl.java:
301)
at
sun.nio.ch.DatagramChannelImpl.send(DatagramChannelImpl.java:281)
at
sun.nio.ch.DatagramChannelImpl.send(DatagramChannelImpl.java:250)
at
org
.apache
.mina
.transport
.socket.nio.NioDatagramAcceptor.send(NioDatagramAcceptor.java:184)
at
org
.apache
.mina
.transport
.socket.nio.NioDatagramAcceptor.send(NioDatagramAcceptor.java:46)
at
org
.apache
.mina
.core
.polling
.AbstractPollingConnectionlessIoAcceptor
.flush(AbstractPollingConnectionlessIoAcceptor.java:468)
at
org
.apache
.mina
.core
.polling
.AbstractPollingConnectionlessIoAcceptor
.flushSessions(AbstractPollingConnectionlessIoAcceptor.java:422)
at
org
.apache
.mina.core.polling.AbstractPollingConnectionlessIoAcceptor.access
$700(AbstractPollingConnectionlessIoAcceptor.java:57)
at
org.apache.mina.core.polling.AbstractPollingConnectionlessIoAcceptor
$Worker.run(AbstractPollingConnectionlessIoAcceptor.java:336)
at
org
.apache
.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
I have subsequently tried various solutions in hopes that I would be
able to fix this, but so far I have not been able to rid myself of the
issue. Specifically I have made changes to:
Back ported the application to MINA 1.1.7
Do not close the session on a session idle indication.
Set the session idle to 0 (Which I believe means never notify of idle)
Maintain a permanent reference to an IoSession for a client, and only
close in the case that the exception happens
Pass the message being sent to the non-initiator client to a separate
thread to be processed later, outside of the "messageReceived" context.
Should I be able to use another IoSession to another client in the
midst of a "messageReceived" context? It works some of the time.
What specific areas should I be looking at for problems?
As a possible note of interest is that there was an unexplained power
reset that our hosting site could not give any information about, but
makes me wonder about either the quality of the hosting sites power
conditioning, or possibly the hardware itself. Probably not an issue,
but wanted to include for completeness.
Thanks in advance for any help you can give.
Hardware: Dell 2 X Intel Xeon 2.8 GHz
OS: Red Hat Enterprise Linux - 5.x
Container: Eclipse Equinox OSGi
Java: J2SE (build 1.6.0_06-b02)