Skip to content

Instantly share code, notes, and snippets.

@robUx4
Created August 7, 2013 06:31
Show Gist options
  • Select an option

  • Save robUx4/6171725 to your computer and use it in GitHub Desktop.

Select an option

Save robUx4/6171725 to your computer and use it in GitHub Desktop.
okhttp + GoogleAnalytics
08-07 08:25:19.383: V/PlumeStream(2853): UserStreamManager{a6a4f918 touiteurtest} onStreamConnected
08-07 08:25:20.367: A/libc(2853): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 2887 (GAThread)
08-07 08:25:20.467: I/DEBUG(100): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
08-07 08:25:20.467: I/DEBUG(100): Build fingerprint: 'generic/vbox86p/vbox86p:4.2.2/JDQ39E/eng.buildbot.20130717.143040:userdebug/test-keys'
08-07 08:25:20.467: I/DEBUG(100): Revision: '0'
08-07 08:25:20.467: I/DEBUG(100): pid: 2853, tid: 2887, name: GAThread >>> com.levelup.touiteur <<<
08-07 08:25:20.467: I/DEBUG(100): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
08-07 08:25:20.755: I/DEBUG(100): eax b816dcd5 ebx b6444ff4 ecx 00000020 edx b816dcd6
08-07 08:25:20.755: I/DEBUG(100): esi 00000000 edi 00000000
08-07 08:25:20.755: I/DEBUG(100): xcs 00000073 xds 0000007b xes 0000007b xfs 00000000 xss 0000007b
08-07 08:25:20.755: I/DEBUG(100): eip b6420df3 ebp ffffffff esp 97b898a0 flags 00010246
08-07 08:25:20.755: I/DEBUG(100): backtrace:
08-07 08:25:20.755: I/DEBUG(100): #00 pc 0003ddf3 /system/lib/libssl.so (SSL_select_next_proto+115)
08-07 08:25:20.755: I/DEBUG(100): stack:
08-07 08:25:20.755: I/DEBUG(100): 97b89860 00000000
08-07 08:25:20.755: I/DEBUG(100): 97b89864 00000000
08-07 08:25:20.755: I/DEBUG(100): 97b89868 00000000
08-07 08:25:20.755: I/DEBUG(100): 97b8986c 00000000
08-07 08:25:20.755: I/DEBUG(100): 97b89870 00000000
08-07 08:25:20.755: I/DEBUG(100): 97b89874 00000000
08-07 08:25:20.755: I/DEBUG(100): 97b89878 00000000
08-07 08:25:20.755: I/DEBUG(100): 97b8987c 00000000
08-07 08:25:20.755: I/DEBUG(100): 97b89880 00000000
08-07 08:25:20.755: I/DEBUG(100): 97b89884 00000000
08-07 08:25:20.755: I/DEBUG(100): 97b89888 00000000
08-07 08:25:20.755: I/DEBUG(100): 97b8988c 00000000
08-07 08:25:20.755: I/DEBUG(100): 97b89890 00000000
08-07 08:25:20.755: I/DEBUG(100): 97b89894 00000000
08-07 08:25:20.755: I/DEBUG(100): 97b89898 00000000
08-07 08:25:20.755: I/DEBUG(100): 97b8989c 00000000
08-07 08:25:20.755: I/DEBUG(100): #00 97b898a0 b812af88 [heap]
08-07 08:25:20.755: I/DEBUG(100): 97b898a4 00000000
08-07 08:25:20.755: I/DEBUG(100): 97b898a8 b65eaff4 /system/lib/libcrypto.so
08-07 08:25:20.755: I/DEBUG(100): 97b898ac b6489a7d /system/lib/libcrypto.so (default_malloc_ex+29)
08-07 08:25:20.755: I/DEBUG(100): 97b898b0 00000003
08-07 08:25:20.755: I/DEBUG(100): 97b898b4 00000000
08-07 08:25:20.755: I/DEBUG(100): 97b898b8 b75ded59 /system/lib/libc.so (dlfree+9)
08-07 08:25:20.755: I/DEBUG(100): 97b898bc 08444ff4
08-07 08:25:20.755: I/DEBUG(100): 97b898c0 00000008
08-07 08:25:20.755: I/DEBUG(100): 97b898c4 b816dcd6 [heap]
08-07 08:25:20.755: I/DEBUG(100): 97b898c8 00000000
08-07 08:25:20.755: I/DEBUG(100): 97b898cc b816dcd5 [heap]
08-07 08:25:20.755: I/DEBUG(100): 97b898d0 b814cb94 [heap]
08-07 08:25:20.755: I/DEBUG(100): 97b898d4 00000000
08-07 08:25:20.755: I/DEBUG(100): 97b898d8 b6420d89 /system/lib/libssl.so (SSL_select_next_proto+9)
08-07 08:25:20.755: I/DEBUG(100): 97b898dc 9db79ff4 /system/lib/libjavacore.so
@seviu
Copy link
Copy Markdown

seviu commented Jan 30, 2014

I am having this time sometimes. I believe this has some useful info:

square/okhttp#184
square/okhttp#319

So two ways to fix this:

When you intend to use OkHttp:

    OkHttpClient okHttpClient = new OkHttpClient();
    SSLContext sslContext;
    try {
        sslContext = SSLContext.getInstance("TLS");
        sslContext.init(null, null, null);
    } catch (GeneralSecurityException e) {
        throw new AssertionError(); // The system has no TLS. Just give up.
    }
    okHttpClient.setSslSocketFactory(sslContext.getSocketFactory());

And, when the app starts, force OkHttpClient for as the default URLStreamHandlerFactory

   OkHttpClient okHttpClient = new OkHttpClient();
    SSLContext sslContext;
    try {
        sslContext = SSLContext.getInstance("TLS");
        sslContext.init(null, null, null);
    } catch (GeneralSecurityException e) {
        throw new AssertionError(); // The system has no TLS. Just give up.
    }
    okHttpClient.setSslSocketFactory(sslContext.getSocketFactory());
    URL.setURLStreamHandlerFactory(okHttpClient);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment