Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[ecf-dev] New topic in forum Eclipse Communications Framework (ECF), called How to track down java.net.SocketException: Broken pipe, by Christoph Keimel

Title: Eclipse Community Forums
Subject: How to track down java.net.SocketException: Broken pipe Author: Christoph Keimel Date: Mon, 31 August 2015 21:25
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
[ Reply ][ Quote ][ View Topic/Message ][ Unsubscribe from this forum ]

Back to the top