Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

[Bug]: "Connection refused..." errors from logsender #1183

Closed
2 tasks done
gituser1000000 opened this issue Aug 5, 2023 · 9 comments
Closed
2 tasks done

[Bug]: "Connection refused..." errors from logsender #1183

gituser1000000 opened this issue Aug 5, 2023 · 9 comments
Labels
bug Something isn't working

Comments

@gituser1000000
Copy link

What happened?

v2.5.2-beta
App logs view is spamming with connection-refused errors.

From app logs:
08-05 11:48:47.163 25101 25101 D NetworkSecurityConfig_ No Network Security Config specified, using platform default
08-05 11:48:47.163 25101 25101 D NetworkSecurityConfig_ No Network Security Config specified, using platform default
...
08-05 11:48:47.403 25101 25101 I LogSender_ Connecting to log receiver
08-05 11:48:47.410 25101 25127 I LogSender_ Starting to read logs...
08-05 11:48:47.497 25101 25113 E ple.new252test_ failed to connect to jdwp control socket: Connection refused
08-05 11:48:48.248 25101 25113 E ple.new252test_ failed to connect to jdwp control socket: Connection refused
...

What's the expected behavior?

See actual log messages from the debug app

What version of AndroidIDE you're using?

v2.5.0 (debug builds)

Relevant log output

LogReceiverImpl           I   Connecting to client com.example.new252test2 
LogReceiverImpl           I   Total clients connected: 1 
MultiLogSenderHandler     I   A log sender has been connected 
BootClassProvider         D   Indexing boot classpath:  /data/data/com.itsaky.androidide/files/home/.androidide/android.jar 
LogReceiverImpl           I   Disconnecting from client: 'com.example.new252test2' 
LogSenderHandler          D   Closing log sender handler... 
LogReceiverImpl           I   Total clients connected: 0 
LogSenderHandler          E   An error occurred while reading from socket 
LogSenderHandler          E  java.net.SocketException: Socket closed
LogSenderHandler          E  	at java.net.SocketInputStream.socketRead0(Native Method)
LogSenderHandler          E  	at java.net.SocketInputStream.socketRead(SocketInputStream.java:119)
LogSenderHandler          E  	at java.net.SocketInputStream.read(SocketInputStream.java:176)
LogSenderHandler          E  	at java.net.SocketInputStream.read(SocketInputStream.java:144)
LogSenderHandler          E  	at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:291)
LogSenderHandler          E  	at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:355)
LogSenderHandler          E  	at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:181)
LogSenderHandler          E  	at java.io.InputStreamReader.read(InputStreamReader.java:184)
LogSenderHandler          E  	at java.io.BufferedReader.fill(BufferedReader.java:172)
LogSenderHandler          E  	at java.io.BufferedReader.readLine(BufferedReader.java:335)
LogSenderHandler          E  	at java.io.BufferedReader.readLine(BufferedReader.java:400)
LogSenderHandler          E  	at com.itsaky.androidide.services.log.LogSenderHandler.run(Unknown Source:39)
LogSenderHandler          E

Duplicate issues

  • This issue has not been reported yet.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@gituser1000000 gituser1000000 added the bug Something isn't working label Aug 5, 2023
@itsaky
Copy link
Member

itsaky commented Aug 6, 2023

08-05 11:48:47.497 25101 25113 E ple.new252test_ failed to connect to jdwp control socket: Connection refused

I don't think this is related to AndroidIDE. None of AndroidIDE components use JDWP. I'll look into the other issue you mentioned.

@gituser1000000
Copy link
Author

gituser1000000 commented Aug 6, 2023

I found out that if I turn on "USB Debugging" then the spamming errors stop. I don't remember seeing this as a requirement for using AndroidIDE (with app logs.) If docs for the IDE had it somewhere, I've apparently missed that.

Even if AndroidIDE does not use JDWP as you've said, the app logs feature seems to require it, hence, it has something to do with the IDE then right? :)

What if I prefered not to turn on USB Debugging? No other options?

EDIT:
I just remembered that when I had the v2.5.0 installed (which got hot and used more battery) I thought I saw some actual logs from the debug-app. I did not have USB Debugging enabled. So how could this be?

@itsaky
Copy link
Member

itsaky commented Aug 7, 2023

08-05 11:48:48.248 25101 25113 E ple.new252test_ failed to connect to jdwp control socket: Connection refused

Are you using LineageOS? This seems to happen in debug builds of LineageOS 18.1 (maybe newer as well?). Source.

I don't remember seeing this as a requirement for using AndroidIDE (with app logs.) If docs for the IDE had it somewhere, I've apparently missed that.

On some devices, the logsender doesn't work if USB debugging is turned off (logcat process doesn't start).

@itsaky
Copy link
Member

itsaky commented Aug 7, 2023

The SocketException was being incorrectly logged when the connection to logsender in the client application was closed. The above commit should fix it.

I'm not sure about the JDWP issue. It didn't occur on my test device.

@gituser1000000
Copy link
Author

Are you using LineageOS?

No, it's just a regular android 11, 64bit device with stock everything.

I've also tried on another device by the same maker, only with Android 12, and USB debugging disabled. It didn't spam that JDWP Connection refused error. Maybe you could test and confirm that it (is / or not) the case, and possibly a fix?

@itsaky
Copy link
Member

itsaky commented Aug 8, 2023

The message is being logged from the ADB connection client in the Android system. This is the line that prints the message. It uses the PLOG macro to log the message whose behavior is defined here.

I don't think we could fix this from our side.

EDIT:
If you have root, you can try to set the ro.debuggable property to 0 if it is set to 1. Source.

@gituser1000000
Copy link
Author

So could we confirm that it's Android 11 in general, or only this particular Android 11 that I have?

@itsaky
Copy link
Member

itsaky commented Aug 8, 2023

Honestly, I don't know much about this. That piece of code seems to be included in the latest Android as well.

There might some configuration issues with the AOSP build that is installed on your device which may be why you're seeing this error on that specific device.

This issue can be closed in my opinion.

@gituser1000000
Copy link
Author

Oh well... at least the other socket exception was noticed and got fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants