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

UntaggedSocketViolation during firebase network request #6338

Open
IGR2014 opened this issue Oct 2, 2024 · 2 comments
Open

UntaggedSocketViolation during firebase network request #6338

IGR2014 opened this issue Oct 2, 2024 · 2 comments

Comments

@IGR2014
Copy link

IGR2014 commented Oct 2, 2024

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs in the code in this repository.
If you have a general question, need help debugging, or fall into some
other category use one of these other channels:

  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • For general Firebase discussion, use the firebase-talk
    google group.
  • For help troubleshooting your application that does not fall under one
    of the above categories, reach out to the personalized
    Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: Android Studio Ladybug | 2024.2.1
  • Firebase Component: Crashlytics (Database, Firestore, Storage, Functions, etc)
  • Component version: 19.2.0

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

  1. Add this to code (yes, I do understand this is due to penaltyDeath, but stil UntaggedSocketViolation should not occur IMHO):
// Debug ?
if (BuildConfig.DEBUG) {
	StrictMode.setThreadPolicy(ThreadPolicy.Builder()
		.detectAll()
		.penaltyLog()
		.build()
	)
	StrictMode.setVmPolicy(VmPolicy.Builder()
		.detectAll()
		.penaltyLog()
		.penaltyDeath()
		.build()
	)
}
  1. Launch in Debug mode

  2. Get this:

2024-10-02 18:14:31.890  5972-6022  TRuntime.C...ortBackend com.********.gui                     I  Making request to: https://firebaselogging-pa.googleapis.com/v1/firelog/legacy/batchlog
2024-10-02 18:14:31.917  5972-6022  DpmTcmClient            com.********.gui                     I  RegisterTcmMonitor from: $Proxy1
2024-10-02 18:14:31.937  5972-6022  StrictMode              com.********.gui                     D  StrictMode policy violation: android.os.strictmode.UntaggedSocketViolation: Untagged socket detected; use TrafficStats.setThreadSocketTag() to track all network usage
                                                                                                    	at android.os.StrictMode.onUntaggedSocket(StrictMode.java:2182)
                                                                                                    	at com.android.server.NetworkManagementSocketTagger.tag(NetworkManagementSocketTagger.java:82)
                                                                                                    	at libcore.io.BlockGuardOs.tagSocket(BlockGuardOs.java:54)
                                                                                                    	at libcore.io.BlockGuardOs.socket(BlockGuardOs.java:374)
                                                                                                    	at libcore.io.ForwardingOs.socket(ForwardingOs.java:216)
                                                                                                    	at libcore.io.IoBridge.socket(IoBridge.java:654)
                                                                                                    	at java.net.PlainSocketImpl.socketCreate(PlainSocketImpl.java:128)
                                                                                                    	at java.net.AbstractPlainSocketImpl.create(AbstractPlainSocketImpl.java:128)
                                                                                                    	at java.net.Socket.createImpl(Socket.java:489)
                                                                                                    	at java.net.Socket.getImpl(Socket.java:552)
                                                                                                    	at java.net.Socket.setSoTimeout(Socket.java:1180)
                                                                                                    	at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:143)
                                                                                                    	at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:116)
                                                                                                    	at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:186)
                                                                                                    	at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:128)
                                                                                                    	at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:97)
                                                                                                    	at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:289)
                                                                                                    	at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:232)
                                                                                                    	at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:465)
                                                                                                    	at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:131)
                                                                                                    	at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:262)
                                                                                                    	at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:219)
                                                                                                    	at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:30)
                                                                                                    	at com.google.android.datatransport.cct.CctTransportBackend.doSend(CctTransportBackend.java:341)
                                                                                                    	at com.google.android.datatransport.cct.CctTransportBackend.$r8$lambda$5Jm_DhYLwiwBKncaqypAUFDEpD8(Unknown Source:0)
                                                                                                    	at com.google.android.datatransport.cct.CctTransportBackend$$ExternalSyntheticLambda0.apply(D8$$SyntheticClass:0)
                                                                                                    	at com.google.android.datatransport.runtime.retries.Retries.retry(Retries.java:54)
                                                                                                    	at com.google.android.datatransport.cct.CctTransportBackend.send(CctTransportBackend.java:410)
                                                                                                    	at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader.logAndUpdateState(Uploader.java:148)
                                                                                                    	at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader.lambda$upload$1$com-google-android-datatransport-runtime-scheduling-jobscheduling-Uploader(Uploader.java:106)
                                                                                                    	at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader$$ExternalSyntheticLambda3.run(D8$$SyntheticClass:0)
                                                                                                    	at com.google.android.datatransport.runtime.SafeLoggingExecutor$SafeLoggingRunnable.run(SafeLoggingExecutor.java:47)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
                                                                                                    	at java.lang.Thread.run(Thread.java:923)
2024-10-02 18:14:31.937  5972-6022  System.err              com.********.gui                     W  StrictMode VmPolicy violation with POLICY_DEATH; shutting down.

P.S. Further investigation lead me to this StackOverflow which lead to this package:
image

Relevant Code:

// Debug ?
if (BuildConfig.DEBUG) {
	StrictMode.setThreadPolicy(ThreadPolicy.Builder()
		.detectAll()
		.penaltyLog()
		.build()
	)
	StrictMode.setVmPolicy(VmPolicy.Builder()
		.detectAll()
		.penaltyLog()
		.penaltyDeath()
		.build()
	)
}
@lehcar09
Copy link
Contributor

lehcar09 commented Oct 7, 2024

Hi @IGR2014, thank you for reaching out and reporting the issue. I was able to reproduce the issue you raised. I'll notify our engineers about this and see what we can do here. Thanks!

@IGR2014
Copy link
Author

IGR2014 commented Oct 7, 2024

Hi, thank you!

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

No branches or pull requests

4 participants