buglabs/bugswarm-connector — Issue #52: Intermittent java.net.SocketException: Invalid argument 
Author: jconnolly
Created: 2011-12-12 15:59:11+00:00
State: open

I've got a BUG online using the xmpp connector and after a number of hours it appears that the connection is closed and I get a SocketException when smack is flushing its connection:

12.10 01:48:49 DEBUG ServiceEvent MODIFIED	[45]bugswarm-devicestats (3.0.86)
12.10 01:49:42 DEBUG Sent {"feed":{"users":"1 user","wifi.status":"up","battery.current":"0","battery.temp":"310","uptime":"20:49:42 up 9:19","storage.rootfs.used":"496960","swap.available":"0","wifi.signal":"182","swap.used":"0","ram.used":"174477312","wifi.packets.rx":"62225","ram.available":"60477440","wifi.noise":"163","battery.status":"Full","battery.present":"1","battery.capacity":"100","wifi.packets.tx":"2833","ram.total":"234954752","swap.total":"0","storage.rootfs.available":"1307372","battery.voltage":"4188","load":"0.83","storage.rootfs.total":"1900884"},"name":"bugswarm-devicestats"} to swarm d725179e23ee6a8ac1d14a9aaf8a673675e28fd0	[34]com.buglabs.bug.swarm.connector (0.3.88)
12.10 01:49:42 DEBUG ServiceEvent MODIFIED	[17]bugswarm-devicestats (3.0.0)
12.10 01:49:49 DEBUG Sent {"feed":{"users":"1 user","wifi.status":"up","battery.current":"0","battery.temp":"310","uptime":"20:49:49 up 9:19","storage.rootfs.used":"496960","swap.available":"0","wifi.signal":"186","swap.used":"0","ram.used":"174477312","wifi.packets.rx":"62243","ram.available":"60477440","wifi.noise":"163","battery.status":"Full","battery.present":"1","battery.capacity":"100","wifi.packets.tx":"2833","ram.total":"234954752","storage.rootfs.available":"1307372","swap.total":"0","battery.voltage":"4188","load":"0.82","storage.rootfs.total":"1900884"},"name":"bugswarm-devicestats"} to swarm d725179e23ee6a8ac1d14a9aaf8a673675e28fd0	[34]com.buglabs.bug.swarm.connector (0.3.88)
12.10 01:49:49 DEBUG ServiceEvent MODIFIED	[45]bugswarm-devicestats (3.0.86)
12.10 01:50:42 DEBUG Sent {"feed":{"users":"1 user","wifi.status":"up","battery.current":"0","battery.temp":"310","uptime":"20:50:42 up 9:20","storage.rootfs.used":"496960","swap.available":"0","wifi.signal":"182","swap.used":"0","ram.used":"174477312","wifi.packets.rx":"62350","ram.available":"60477440","wifi.noise":"161","battery.status":"Full","battery.present":"1","battery.capacity":"100","wifi.packets.tx":"2835","ram.total":"234954752","swap.total":"0","storage.rootfs.available":"1307372","battery.voltage":"4188","load":"0.79","storage.rootfs.total":"1900884"},"name":"bugswarm-devicestats"} to swarm d725179e23ee6a8ac1d14a9aaf8a673675e28fd0	[34]com.buglabs.bug.swarm.connector (0.3.88)
12.10 01:50:42 DEBUG ServiceEvent MODIFIED	[17]bugswarm-devicestats (3.0.0)
12.10 01:50:49 DEBUG Sent {"feed":{"users":"1 user","wifi.status":"up","battery.current":"0","battery.temp":"310","uptime":"20:50:49 up 9:20","storage.rootfs.used":"496960","swap.available":"0","wifi.signal":"181","swap.used":"0","ram.used":"174477312","wifi.packets.rx":"62356","ram.available":"60477440","wifi.noise":"162","battery.status":"Full","battery.present":"1","battery.capacity":"100","wifi.packets.tx":"2835","ram.total":"234954752","storage.rootfs.available":"1307372","swap.total":"0","battery.voltage":"4188","load":"0.79","storage.rootfs.total":"1900884"},"name":"bugswarm-devicestats"} to swarm d725179e23ee6a8ac1d14a9aaf8a673675e28fd0	[34]com.buglabs.bug.swarm.connector (0.3.88)
12.10 01:50:49 DEBUG ServiceEvent MODIFIED	[45]bugswarm-devicestats (3.0.86)
12.10 01:51:42 DEBUG Sent {"feed":{"users":"1 user","wifi.status":"up","battery.current":"0","battery.temp":"310","uptime":"20:51:42 up 9:21","storage.rootfs.used":"496960","swap.available":"0","wifi.signal":"182","swap.used":"0","ram.used":"174538752","wifi.packets.rx":"62422","ram.available":"60416000","wifi.noise":"161","battery.status":"Full","battery.present":"1","battery.capacity":"100","wifi.packets.tx":"2837","ram.total":"234954752","swap.total":"0","storage.rootfs.available":"1307372","battery.voltage":"4188","load":"0.83","storage.rootfs.total":"1900884"},"name":"bugswarm-devicestats"} to swarm d725179e23ee6a8ac1d14a9aaf8a673675e28fd0	[34]com.buglabs.bug.swarm.connector (0.3.88)
12.10 01:51:42 DEBUG ServiceEvent MODIFIED	[17]bugswarm-devicestats (3.0.0)
12.10 01:51:49 DEBUG Sent {"feed":{"users":"1 user","wifi.status":"up","battery.current":"0","battery.temp":"310","uptime":"20:51:49 up 9:21","storage.rootfs.used":"496960","swap.available":"0","wifi.signal":"181","swap.used":"0","ram.used":"174538752","wifi.packets.rx":"62437","ram.available":"60416000","wifi.noise":"162","battery.status":"Full","battery.present":"1","battery.capacity":"100","wifi.packets.tx":"2837","ram.total":"234954752","storage.rootfs.available":"1307372","swap.total":"0","battery.voltage":"4188","load":"0.83","storage.rootfs.total":"1900884"},"name":"bugswarm-devicestats"} to swarm d725179e23ee6a8ac1d14a9aaf8a673675e28fd0	[34]com.buglabs.bug.swarm.connector (0.3.88)
12.10 01:51:49 DEBUG ServiceEvent MODIFIED	[45]bugswarm-devicestats (3.0.86)
java.net.SocketException: Invalid argument
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
at sun.security.ssl.OutputRecord.writeBuffer(OutputRecord.java:314)
at sun.security.ssl.OutputRecord.write(OutputRecord.java:303)
at sun.security.ssl.SSLSocketImpl.writeRecordInternal(SSLSocketImpl.java:763)
at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:751)
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:78)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:220)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:290)
at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:294)
at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:140)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
at java.io.BufferedWriter.flush(BufferedWriter.java:253)
at org.jivesoftware.smack.PacketWriter.writePackets(PacketWriter.java:193)
at org.jivesoftware.smack.PacketWriter.access$000(PacketWriter.java:40)
at org.jivesoftware.smack.PacketWriter$1.run(PacketWriter.java:76)

I'm unable to induce this exception manually, so it's a bit difficult to troubleshoot. Additionally it doesn't seem that XMPP passes up the SocketException, or rectifies it, so it would require some refactoring of the underlying smackx library. Since this is an xmpp-only issue I'm going to leave it open.