Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Net4j/CDO] Connection loss with TCP
[Net4j/CDO] Connection loss with TCP [message #421098] Wed, 23 July 2008 23:34 Go to next message
Tom Crockett is currently offline Tom CrockettFriend
Messages: 54
Registered: July 2009
Member
I think I touched on this in a previous post, but I'd like to revisit it
with a dedicated topic. There are two parts to the problem:

1) If the client loses connectivity, there is no immediate notification of
this event. I only hear about the disconnection once I try to commit a
transaction.

Here's an example. I attach an IListener to the connector at creation, and
print out the events it hears about. When the connection is first
established, it hears:

org.eclipse.net4j.util.lifecycle.LifecycleEvent[source=Clien tTCPConnector[host:port]]
ConnectorStateEvent[source=ClientTCPConnector[host:port],
oldState=CONNECTING, newState=CONNECTED]
ContainerEvent[source=ClientTCPConnector[host:port], Channel[0]=ADDED]

However, if I unplug the wire from my computer, the listener is silent (I
waited several minutes with no notification). Then when I try to commit a
transaction, the commit times out, and an exception gets thrown from the
TCPSelector thread, followed by a disconnect notification:

[ERROR] No route to host
java.net.NoRouteToHostException: No route to host
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java: 464)
at
org.eclipse.net4j.internal.tcp.TCPClientConnector.handleRegi stration(TCPClientConnector.java:96)
at
org.eclipse.net4j.internal.tcp.TCPSelector.executeRegistrati on(TCPSelector.java:410)
at
org.eclipse.net4j.internal.tcp.TCPSelector.access$1(TCPSelec tor.java:400)
at org.eclipse.net4j.internal.tcp.TCPSelector$2.run(TCPSelector .java:90)
at
org.eclipse.net4j.internal.tcp.TCPSelector.processOperations (TCPSelector.java:379)
at org.eclipse.net4j.internal.tcp.TCPSelector.run(TCPSelector.j ava:159)
at java.lang.Thread.run(Thread.java:613)

org.eclipse.net4j.util.lifecycle.LifecycleEvent[source=Clien tTCPConnector[host:port]]
ConnectorStateEvent[source=ClientTCPConnector[host:port],
oldState=CONNECTING, newState=DISCONNECTED]
org.eclipse.net4j.util.lifecycle.LifecycleEvent[source=Clien tTCPConnector[host:port]]

That's the notification I wanted to receive immediately upon disconnect,
not much later when I tried to commit!

2) In addition to not being notified of "real" disconnects (pulling the
wire or turning off the wireless on my laptop), connections seem to die
silently over time if there is no activity for a while. As above, the
client doesn't find out when this happens until it tries to commit a
transaction or access something that requires retrieving things from the
server. Then it times out, disconnects, etc. Any idea why this would
happen? I've worked around this second problem in my own code by creating
constant "chatter" over the wire... adding and removing temporary objects
from a special resource and committing every 30 seconds or so, but
obviously that's pretty hacky and shouldn't be necessary.

Should I file bugzillas for these?

Tom
Re: [Net4j/CDO] Connection loss with TCP [message #421100 is a reply to message #421098] Thu, 24 July 2008 05:12 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi Thomas,

Yes, please be so kind and file Bugzillas for these two. I suspect that
they're comparingly easy to fix by setting some socket options, but
let's see...

Cheers
/Eike



Thomas M Crockett schrieb:
> I think I touched on this in a previous post, but I'd like to revisit
> it with a dedicated topic. There are two parts to the problem:
>
> 1) If the client loses connectivity, there is no immediate
> notification of this event. I only hear about the disconnection once I
> try to commit a transaction.
> Here's an example. I attach an IListener to the connector at creation,
> and print out the events it hears about. When the connection is first
> established, it hears:
>
> org.eclipse.net4j.util.lifecycle.LifecycleEvent[source=Clien tTCPConnector[host:port]]
>
> ConnectorStateEvent[source=ClientTCPConnector[host:port],
> oldState=CONNECTING, newState=CONNECTED]
> ContainerEvent[source=ClientTCPConnector[host:port], Channel[0]=ADDED]
>
> However, if I unplug the wire from my computer, the listener is silent
> (I waited several minutes with no notification). Then when I try to
> commit a transaction, the commit times out, and an exception gets
> thrown from the TCPSelector thread, followed by a disconnect
> notification:
>
> [ERROR] No route to host
> java.net.NoRouteToHostException: No route to host
> at sun.nio.ch.Net.connect(Native Method)
> at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java: 464)
> at
> org.eclipse.net4j.internal.tcp.TCPClientConnector.handleRegi stration(TCPClientConnector.java:96)
>
> at
> org.eclipse.net4j.internal.tcp.TCPSelector.executeRegistrati on(TCPSelector.java:410)
>
> at
> org.eclipse.net4j.internal.tcp.TCPSelector.access$1(TCPSelec tor.java:400)
> at
> org.eclipse.net4j.internal.tcp.TCPSelector$2.run(TCPSelector .java:90)
> at
> org.eclipse.net4j.internal.tcp.TCPSelector.processOperations (TCPSelector.java:379)
>
> at
> org.eclipse.net4j.internal.tcp.TCPSelector.run(TCPSelector.j ava:159)
> at java.lang.Thread.run(Thread.java:613)
>
> org.eclipse.net4j.util.lifecycle.LifecycleEvent[source=Clien tTCPConnector[host:port]]
>
> ConnectorStateEvent[source=ClientTCPConnector[host:port],
> oldState=CONNECTING, newState=DISCONNECTED]
> org.eclipse.net4j.util.lifecycle.LifecycleEvent[source=Clien tTCPConnector[host:port]]
>
>
> That's the notification I wanted to receive immediately upon
> disconnect, not much later when I tried to commit!
>
> 2) In addition to not being notified of "real" disconnects (pulling
> the wire or turning off the wireless on my laptop), connections seem
> to die silently over time if there is no activity for a while. As
> above, the client doesn't find out when this happens until it tries to
> commit a transaction or access something that requires retrieving
> things from the server. Then it times out, disconnects, etc. Any idea
> why this would happen? I've worked around this second problem in my
> own code by creating constant "chatter" over the wire... adding and
> removing temporary objects from a special resource and committing
> every 30 seconds or so, but obviously that's pretty hacky and
> shouldn't be necessary.
>
> Should I file bugzillas for these?
>
> Tom
>
>


Re: [Net4j/CDO] Connection loss with TCP [message #421113 is a reply to message #421100] Thu, 24 July 2008 17:54 Go to previous message
Tom Crockett is currently offline Tom CrockettFriend
Messages: 54
Registered: July 2009
Member
Done:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=242005
https://bugs.eclipse.org/bugs/show_bug.cgi?id=242006

Eike Stepper wrote:

> Hi Thomas,

> Yes, please be so kind and file Bugzillas for these two. I suspect that
> they're comparingly easy to fix by setting some socket options, but
> let's see...

> Cheers
> /Eike



> Thomas M Crockett schrieb:
>> I think I touched on this in a previous post, but I'd like to revisit
>> it with a dedicated topic. There are two parts to the problem:
>>
>> 1) If the client loses connectivity, there is no immediate
>> notification of this event. I only hear about the disconnection once I
>> try to commit a transaction.
>> Here's an example. I attach an IListener to the connector at creation,
>> and print out the events it hears about. When the connection is first
>> established, it hears:
>>
>>
org.eclipse.net4j.util.lifecycle.LifecycleEvent[source=Clien tTCPConnector[host:port]]
>>
>> ConnectorStateEvent[source=ClientTCPConnector[host:port],
>> oldState=CONNECTING, newState=CONNECTED]
>> ContainerEvent[source=ClientTCPConnector[host:port], Channel[0]=ADDED]
>>
>> However, if I unplug the wire from my computer, the listener is silent
>> (I waited several minutes with no notification). Then when I try to
>> commit a transaction, the commit times out, and an exception gets
>> thrown from the TCPSelector thread, followed by a disconnect
>> notification:
>>
>> [ERROR] No route to host
>> java.net.NoRouteToHostException: No route to host
>> at sun.nio.ch.Net.connect(Native Method)
>> at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java: 464)
>> at
>>
org.eclipse.net4j.internal.tcp.TCPClientConnector.handleRegi stration(TCPClientConnector.java:96)
>>
>> at
>>
org.eclipse.net4j.internal.tcp.TCPSelector.executeRegistrati on(TCPSelector.java:410)
>>
>> at
>> org.eclipse.net4j.internal.tcp.TCPSelector.access$1(TCPSelec tor.java:400)
>> at
>> org.eclipse.net4j.internal.tcp.TCPSelector$2.run(TCPSelector .java:90)
>> at
>>
org.eclipse.net4j.internal.tcp.TCPSelector.processOperations (TCPSelector.java:379)
>>
>> at
>> org.eclipse.net4j.internal.tcp.TCPSelector.run(TCPSelector.j ava:159)
>> at java.lang.Thread.run(Thread.java:613)
>>
>>
org.eclipse.net4j.util.lifecycle.LifecycleEvent[source=Clien tTCPConnector[host:port]]
>>
>> ConnectorStateEvent[source=ClientTCPConnector[host:port],
>> oldState=CONNECTING, newState=DISCONNECTED]
>>
org.eclipse.net4j.util.lifecycle.LifecycleEvent[source=Clien tTCPConnector[host:port]]
>>
>>
>> That's the notification I wanted to receive immediately upon
>> disconnect, not much later when I tried to commit!
>>
>> 2) In addition to not being notified of "real" disconnects (pulling
>> the wire or turning off the wireless on my laptop), connections seem
>> to die silently over time if there is no activity for a while. As
>> above, the client doesn't find out when this happens until it tries to
>> commit a transaction or access something that requires retrieving
>> things from the server. Then it times out, disconnects, etc. Any idea
>> why this would happen? I've worked around this second problem in my
>> own code by creating constant "chatter" over the wire... adding and
>> removing temporary objects from a special resource and committing
>> every 30 seconds or so, but obviously that's pretty hacky and
>> shouldn't be necessary.
>>
>> Should I file bugzillas for these?
>>
>> Tom
>>
>>
Previous Topic:Problem with multiple inheritance
Next Topic:Can I register 2 different EMF packages to a single ResourceSet ?
Goto Forum:
  


Current Time: Thu Apr 25 22:26:07 GMT 2024

Powered by FUDForum. Page generated in 0.03315 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top