handle Google Oauth service unavailability
Google's Oauth service just had a hiccup for a few minutes, but Lantern just logs the error without trying to recover. Here's one example:
2148212 2013-03-04 17:57:45,514 DEBUG [Lantern-Netty-Server-Worker-Thread-1] proxy.HttpRequestHandler.exceptionCaught (HttpRequestHandler.java:873) - Caught an exception on browser to proxy channel: [id: 0x98fa570b, /10.0.1.4:44903 => /10.0.1.26:47458]
javax.net.ssl.SSLException: Received fatal alert: certificate_unknown
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:190)
at com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1447)
at com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1415)
at com.sun.net.ssl.internal.ssl.SSLEngineImpl.recvAlert(SSLEngineImpl.java:1581)
at com.sun.net.ssl.internal.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:1011)
at com.sun.net.ssl.internal.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:845)
at com.sun.net.ssl.internal.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:721)
at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:607)
at org.jboss.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1212)
at or2148213 2013-03-04 17:57:45,515 DEBUG [Lantern-Netty-Server-Worker-Thread-1] proxy.ProxyUtils.closeOnFlush (ProxyUtils.java:342) - Closing on flush: [id: 0x98fa570b, /10.0.1.4:44903 => /10.0.1.26:47458]
2148214 2013-03-04 17:57:45,516 DEBUG [Lantern-Netty-Server-Worker-Thread-1] proxy.HttpRequestHandler.exceptionCaught (HttpRequestHandler.java:873) - Caught an exception on browser to proxy channel: [id: 0x98fa570b, /10.0.1.4:44903 => /10.0.1.26:47458]
javax.net.ssl.SSLException: SSLEngine is closing/closed
at com.sun.net.ssl.internal.ssl.SSLEngineImpl.kickstartHandshake(SSLEngineImpl.java:664)
at com.sun.net.ssl.internal.ssl.SSLEngineImpl.beginHandshake(SSLEngineImpl.java:697)
at org.jboss.netty.handler.ssl.SslHandler.handshake(SslHandler.java:421)
at org.jboss.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1208)
at org.jboss.netty.handler.ssl.SslHandler.closeOutboundAndChannel(SslHandler.java:1416)
at org.jboss.netty.handler.ssl.SslHandler.handleDownstream(SslHandler.java:590)
at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:54)
at org.jboss.netty.channel.Channels.close(Channels.java:812)
at org.jboss.netty.channel.AbstractChannel.close(Ab2148214 2013-03-04 17:57:45,516 DEBUG [Lantern-Netty-Server-Worker-Thread-1] proxy.ProxyUtils.closeOnFlush (ProxyUtils.java:342) - Closing on flush: [id: 0x98fa570b, /10.0.1.4:44903 => /10.0.1.26:47458]
and another:
10631 2013-03-04 17:57:07,959 INFO [Lantern-Netty-Client-Worker-Thread-1] proxy.HttpConnectRelayingHandler.exceptionCaught (HttpConnectRelayingHandler.java:97) - Caught exception on proxy -> web connection: [id: 0x79a348d7, /10.0.1.4:44895 => lux.local/10.0.1.26:47458]
javax.net.ssl.SSLHandshakeException: General SSLEngine problem
at sun.security.ssl.Handshaker.checkThrown(Handshaker.java:1031)
at sun.security.ssl.SSLEngineImpl.checkTaskThrown(SSLEngineImpl.java:508)
at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:759)
at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:727)
at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:624)
at org.jboss.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1212)
at org.jboss.netty.handler.ssl.SslHandler.decode(SslHandler.java:910)
at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:425)
at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
at org.lantern.StatsTrackingHandler.messageReceived(StatsTrackingHandler.java:36)
at org.jboss.netty.handler.traffic.AbstractTrafficShapingHandler.messageReceived(AbstractTrafficShapingHandler.java:411)
at org.lantern.util.LanternTrafficCounterHandler.messageReceived(LanternTrafficCounterHandler.java:39)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:107)
at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312)
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88)
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:679)
Caused by: javax.net.ssl.SSLHandshakeException: General SSLEngine problem
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1507)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:259)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:251)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1168)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:153)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:609)
at sun.security.ssl.Handshaker$1.run(Handshaker.java:549)
at sun.security.ssl.Handshaker$1.run(Handshaker.java:547)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.ssl.Handshaker$DelegatedTask.run(Handshaker.java:968)
at org.jboss.netty.handler.ssl.SslHandler$4.run(SslHandler.java:1348)
at org.jboss.netty.handler.ssl.ImmediateExecutor.execute(ImmediateExecutor.java:31)
at org.jboss.netty.handler.ssl.SslHandler.runDelegatedTasks(SslHandler.java:1345)
at org.jboss.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1232)
... 16 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:324)
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:224)
at sun.security.validator.Validator.validate(Validator.java:235)
at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:147)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:230)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:270)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1147)
... 26 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:197)
at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:255)
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:319)
... 32 more
What should Lantern do in this circumstance?
When it happened when I observed it (first excerpt above), Lantern was in the middle of trying to sign me in, and after the error, the UI just got stuck there. Not sure what @leahxschmidt was doing when she observed it (second excerpt).
For the sign in step at least, Lantern can keep retrying with an increasing backoff.
In general the UI should never get stuck. We can keep the connectingStatus field up to date in the sign in modal to inform the user of what's going on. In other places a notification can be used, or we can add back some kind of "required service unavailable" modal if we have to block other user interaction and force the user to make a decision.
It looks like those errors are something different. Note the lines like:
/10.0.1.4:44903 => /10.0.1.26:47458]
So it's getting an error connecting to some peer on the local network, which should never pop up in the course of a Google Talk login. It's possible you'd see this when Lantern is trying to display the OAuth page in the dashboard but not when logging it to Google Talk. The underlying problem above is that proxying is not working because it's trying to connect to some other peer on the local network. We should talk about the setup that produced this.
Thanks for the explanation @myleshorton. The setup that produced this was @leahxschmidt and I each running Lantern from a recent source revision yesterday behind a Time Capsule router. lux.local refers to my machine, so I must have been at 10.0.1.26 and leah at 10.0.1.4.
For me the error did pop up in the course of Google Talk login (though it could have been coincidental), except the UI got stuck there, never made it to the next modal.
Closing for now -- see better UI in #590