Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Communications Framework (ECF) » How to track down java.net.SocketException: Broken pipe
How to track down java.net.SocketException: Broken pipe [message #1706916] Mon, 31 August 2015 19:25 Go to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 480
Registered: December 2010
Location: Germany
Senior Member
Hello,

I am working on a project connecting a Raspberry Pi and a Desktop client via ECF remote services. I am using the whiteboard pattern to register a "Sniffer"-Service on the desktop.
public interface IOSniffer {
	boolean connect(String name, Signal signal);
	void onSignalChanged(String name, Signal signal);
	void disconnect(String name);
}

The simple equinox server running on the pi will pick this up using a ServiceTracker. When a IOSniffer is recognised the server will first call connect to inform the IOSniffer of an input or output and will then call onSignalChange if the pin state of the io pin changes. When I close the client the IOSniffer will unregister in which case the pi-server will remove the IOSniffer from its list of observers. No method on the IOSniffer is called (afaik).
ioSnifferTracker = new ServiceTracker<IOSniffer, IOSniffer>(bundleContext, IOSniffer.class, new ServiceTrackerCustomizer<IOSniffer, IOSniffer>() {
	@Override
	public IOSniffer addingService(ServiceReference<IOSniffer> reference) {
		IOSniffer sniffer = bundleContext.getService(reference);
		ioServiceList.forEach(ioService -> ioService.addSniffer(sniffer));
		return sniffer;
	}
	@Override
	public void removedService(ServiceReference<IOSniffer> reference, IOSniffer sniffer) {
		ioServiceList.forEach(ioService -> ioService.removeSniffer(sniffer));
	}
});
where ioService.removeSniffer(sniffer) will just remove the IOSniffer from its internal list.
So far so good ... working great!

The issue I am having is that I will nevertheless get an exception after the IOSniffer has unregistered on the pi server:
19:04:16.817 WARN  org.eclipse.ecf.provider - org.eclipse.core.runtime.Status[plugin=org.eclipse.ecf.provider;code=2;message=disconnect.sendSynch;severity2;exception=java.net.SocketException: Broken pipe;children=[]]
java.net.SocketException: Broken pipe
        at java.net.SocketOutputStream.socketWrite0(Native Method) ~[na:1.8.0]
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109) ~[na:1.8.0]
        at java.net.SocketOutputStream.write(SocketOutputStream.java:153) ~[na:1.8.0]
        at java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1877) ~[na:1.8.0]
        at java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(ObjectOutputStream.java:1786) ~[na:1.8.0]
        at java.io.ObjectOutputStream.writeNonProxyDesc(ObjectOutputStream.java:1286) ~[na:1.8.0]
        at java.io.ObjectOutputStream.writeClassDesc(ObjectOutputStream.java:1231) ~[na:1.8.0]
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1427) ~[na:1.8.0]
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178) ~[na:1.8.0]
        at java.io.ObjectOutputStream.writeFatalException(ObjectOutputStream.java:1577) ~[na:1.8.0]
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:351) ~[na:1.8.0]
        at org.eclipse.ecf.provider.comm.tcp.Client.send(Client.java:315) ~[na:na]
        at org.eclipse.ecf.provider.comm.tcp.Client.sendClose(Client.java:333) ~[na:na]
        at org.eclipse.ecf.provider.comm.tcp.Client.sendObject(Client.java:506) ~[na:na]
        at org.eclipse.ecf.provider.comm.tcp.Client.sendSynch(Client.java:515) ~[na:na]
        at org.eclipse.ecf.provider.generic.ClientSOContainer.disconnect(ClientSOContainer.java:448) ~[na:na]
        at org.eclipse.ecf.provider.generic.ClientSOContainer.processDisconnect(ClientSOContainer.java:471) ~[na:na]
        at org.eclipse.ecf.provider.generic.SOContainer$2.handleDisconnectEvent(SOContainer.java:202) ~[na:na]
        at org.eclipse.ecf.provider.comm.tcp.Client.handleException(Client.java:292) ~[na:na]
        at org.eclipse.ecf.provider.comm.tcp.Client$4.run(Client.java:358) ~[na:na]
        at java.lang.Thread.run(Thread.java:744) ~[na:1.8.0]

I see that this is "only" a warning and everything will continue to work, but I am still wondering if I didn't clean everything correctly.

Any pointers on what might be going wrong or how I could track down the reason for this exception are very welcome!

Thanks,
Christoph
Re: How to track down java.net.SocketException: Broken pipe [message #1706918 is a reply to message #1706916] Mon, 31 August 2015 19:52 Go to previous messageGo to next message
Scott Lewis is currently offline Scott LewisFriend
Messages: 1030
Registered: July 2009
Senior Member
Christoph Keimel wrote on Mon, 31 August 2015 15:25


<stuff deleted>

So far so good ... working great!

The issue I am having is that I will nevertheless get an exception after the IOSniffer has unregistered on the pi server:
19:04:16.817 WARN  org.eclipse.ecf.provider - org.eclipse.core.runtime.Status[plugin=org.eclipse.ecf.provider;code=2;message=disconnect.sendSynch;severity2;exception=java.net.SocketException: Broken pipe;children=[]]
java.net.SocketException: Broken pipe
        at java.net.SocketOutputStream.socketWrite0(Native Method) ~[na:1.8.0]
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109) ~[na:1.8.0]
        at java.net.SocketOutputStream.write(SocketOutputStream.java:153) ~[na:1.8.0]
        at java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1877) ~[na:1.8.0]
        at java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(ObjectOutputStream.java:1786) ~[na:1.8.0]
        at java.io.ObjectOutputStream.writeNonProxyDesc(ObjectOutputStream.java:1286) ~[na:1.8.0]
        at java.io.ObjectOutputStream.writeClassDesc(ObjectOutputStream.java:1231) ~[na:1.8.0]
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1427) ~[na:1.8.0]
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178) ~[na:1.8.0]
        at java.io.ObjectOutputStream.writeFatalException(ObjectOutputStream.java:1577) ~[na:1.8.0]
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:351) ~[na:1.8.0]
        at org.eclipse.ecf.provider.comm.tcp.Client.send(Client.java:315) ~[na:na]
        at org.eclipse.ecf.provider.comm.tcp.Client.sendClose(Client.java:333) ~[na:na]
        at org.eclipse.ecf.provider.comm.tcp.Client.sendObject(Client.java:506) ~[na:na]
        at org.eclipse.ecf.provider.comm.tcp.Client.sendSynch(Client.java:515) ~[na:na]
        at org.eclipse.ecf.provider.generic.ClientSOContainer.disconnect(ClientSOContainer.java:448) ~[na:na]
        at org.eclipse.ecf.provider.generic.ClientSOContainer.processDisconnect(ClientSOContainer.java:471) ~[na:na]
        at org.eclipse.ecf.provider.generic.SOContainer$2.handleDisconnectEvent(SOContainer.java:202) ~[na:na]
        at org.eclipse.ecf.provider.comm.tcp.Client.handleException(Client.java:292) ~[na:na]
        at org.eclipse.ecf.provider.comm.tcp.Client$4.run(Client.java:358) ~[na:na]
        at java.lang.Thread.run(Thread.java:744) ~[na:1.8.0]

I see that this is "only" a warning and everything will continue to work, but I am still wondering if I didn't clean everything correctly.

Any pointers on what might be going wrong or how I could track down the reason for this exception are very welcome!



You haven't done anything wrong. This exception should probably not be WARN (rather it shouldn't be reported at all) because it's just the result of a shutdown race. I've opened a bug

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

to revisit this choice of logging. You can safely ignore.

BTW, people on ecf-dev mailing list and others might be interested to here about (and possibly participate in) your work with ECF remote services, Raspberry Pi, IoT, etc. It sounds very interesting. Also, you might be interested by the fact that ECF has an MQTT-based provider: https://github.com/ECF/Mqtt-Provider

https://dev.eclipse.org/mailman/listinfo/ecf-dev

Thanks,

Scott


Re: How to track down java.net.SocketException: Broken pipe [message #1706953 is a reply to message #1706918] Tue, 01 September 2015 07:35 Go to previous message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 480
Registered: December 2010
Location: Germany
Senior Member
Thanks Scott!
When I have a working system I will blog about it and send a link over the mailing list Smile

Cheers,
Christoph
Previous Topic:Only one-way communication with ECF and XMPP ?
Next Topic:Install ECF into Karaf Offline
Goto Forum:
  


Current Time: Thu Nov 15 20:35:50 GMT 2018

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

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

Back to the top