Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strict mode error - Untagged socket detected #630

Closed
dbacinski opened this issue Oct 24, 2019 · 2 comments
Closed

Strict mode error - Untagged socket detected #630

dbacinski opened this issue Oct 24, 2019 · 2 comments
Labels
bug Confirmed bug released This feature/bug fix has been released

Comments

@dbacinski
Copy link

dbacinski commented Oct 24, 2019

Expected behavior

No strict mode errors.

Observed behavior

Bug snag is causing the android strict mode to complain

    java.lang.Throwable: Untagged socket detected; use TrafficStats.setThreadSocketTag() to track all network usage
        at android.os.StrictMode.onUntaggedSocket(StrictMode.java:2010)
        at com.android.server.NetworkManagementSocketTagger.tag(NetworkManagementSocketTagger.java:78)
        at libcore.io.BlockGuardOs.tagSocket(BlockGuardOs.java:47)
        at libcore.io.BlockGuardOs.socket(BlockGuardOs.java:310)
        at libcore.io.IoBridge.socket(IoBridge.java:667)
        at java.net.PlainSocketImpl.socketCreate(PlainSocketImpl.java:116)
        at java.net.AbstractPlainSocketImpl.create(AbstractPlainSocketImpl.java:98)
        at java.net.Socket.createImpl(Socket.java:484)
        at java.net.Socket.getImpl(Socket.java:547)
        at java.net.Socket.setSoTimeout(Socket.java:1175)
        at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:139)
        at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:112)
        at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:184)
        at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126)
        at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95)
        at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:281)
        at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224)
        at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:461)
        at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:127)
        at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:258)
        at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:218)
        at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getOutputStream(Unknown Source:0)
        at com.bugsnag.android.DefaultDelivery.deliver(DefaultDelivery.java:72)
        at com.bugsnag.android.DefaultDelivery.deliver(DefaultDelivery.java:27)
        at com.bugsnag.android.SessionTracker$1.run(SessionTracker.java:186)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)

Steps to reproduce

  1. Enable strict mode
        if (BuildConfig.DEBUG) {
            StrictMode.setThreadPolicy(
                StrictMode.ThreadPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .penaltyFlashScreen()
                    .build()
            )
            StrictMode.setVmPolicy(
                StrictMode.VmPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .build()
            )
        }
  1. run app on API 26+
  2. observe logcat

Version

implementation 'com.bugsnag:bugsnag-android:4.21.1'

Additional information

A related issue in okhttp with workaround square/okhttp#3537

@dbacinski dbacinski changed the title Strict mode Strict mode error - Untagged socket detected Oct 24, 2019
@fractalwrench fractalwrench added the bug Confirmed bug label Oct 25, 2019
@bugsnagbot bugsnagbot added the backlog We hope to fix this feature/bug in the future label Oct 25, 2019
@tomlongridge
Copy link
Contributor

@dbacinski - thanks for this. We'll look at tagging the socket when priorities allow.

@johnkiely1
Copy link
Member

Hi @dbacinski. This should no longer be an issue in the v5.11.0 release, as we have made some improvements in the area. We have also added some documentation around this here

@johnkiely1 johnkiely1 added released This feature/bug fix has been released and removed backlog We hope to fix this feature/bug in the future labels Aug 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug released This feature/bug fix has been released
Projects
None yet
Development

No branches or pull requests

5 participants