fast4x / RiMusic

A multilingual Android application for streaming music from YouTube Music.
https://rimusic.xyz
GNU General Public License v3.0
2.2k stars 114 forks source link

attempt to use Tоr leads to crashes at launch and loss of all songs: no backup done #2911

Closed Wjxfi closed 2 months ago

Wjxfi commented 2 months ago

Steps to reproduce

1. Settings

2. Other

3. Use proxy

4. Host: localhost

5. Port proxy: 9050

6. get instant crashes with the inability to restore songs


Solution

1. Have full Orbot proxy support for using Tor, every privacy lover will appreciate it

  1. Just fix crashes

Log

1721854961.699 10262 19040 19040 I .fast4x.rimusi: Using CollectorTypeCC GC.
1721854961.714 10262 19040 19040 E .fast4x.rimusi: Not starting debugger since process cannot load the jdwp agent.
1721854961.718 10262 19040 19040 D ProcessState: Binder ioctl to enable oneway spam detection failed: Invalid argument
1721854961.744 10262 19040 19040 E MQSEventManagerDelegate: failed to get MQSService.
1721854961.744 10262 19040 19040 W MQSEventManagerDelegate: registerApplicationScoutThread getMQSService null
1721854961.744 10262 19040 19040 W ActivityThread: registerApplicationScoutThread result:false
1721854961.745 10262 19040 19040 D CompatibilityChangeReporter: Compat change id reported: 171979766; UID 10262; state: ENABLED
1721854961.755 10262 19040 19057 D AppScoutStateMachine: 19040-ScoutStateMachinecreated
1721854961.821 10262 19040 19040 D nativeloader: Configuring clns-4 for other apk /data/app/~~KpHHIduTn8Rg3AZjw5_Pzg==/it.fast4x.rimusic-EBdXdY7vfGzIa-tjwIgaIg==/base.apk. target_sdk_version=34, uses_libraries=, library_path=/data/app/~~KpHHIduTn8Rg3AZjw5_Pzg==/it.fast4x.rimusic-EBdXdY7vfGzIa-tjwIgaIg==/lib/arm64:/data/app/~~KpHHIduTn8Rg3AZjw5_Pzg==/it.fast4x.rimusic-EBdXdY7vfGzIa-tjwIgaIg==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand:/data/user/0/it.fast4x.rimusic
1721854961.831 10262 19040 19040 V GraphicsEnvironment: ANGLE Developer option for 'it.fast4x.rimusic' set to: 'default'
1721854961.832 10262 19040 19040 V GraphicsEnvironment: Updatable production driver is not supported on the device.
1721854961.833 10262 19040 19040 I ForceDarkHelperStubImpl: initialize for it.fast4x.rimusic , ForceDarkOrigin
1721854961.836 10262 19040 19040 D OpenGLRenderer: JNI_OnLoad success
1721854961.837 10262 19040 19040 I MiuiForceDarkConfig: setConfig density:2.750000, mainRule:0, secondaryRule:0, tertiaryRule:0
1721854961.837 10262 19040 19040 D NetworkSecurityConfig: No Network Security Config specified, using platform default
1721854961.837 10262 19040 19040 D NetworkSecurityConfig: No Network Security Config specified, using platform default
1721854961.853 10262 19040 19040 W .fast4x.rimusi: Accessing hidden field Ljava/util/Collections$SynchronizedCollection;->mutex:Ljava/lang/Object; (max-target-o, reflection, denied)
1721854961.853 10262 19040 19040 W .fast4x.rimusi: Accessing hidden method Ljava/util/Collections$SynchronizedSet;-><init>(Ljava/util/Set;Ljava/lang/Object;)V (max-target-o, reflection, denied)
1721854961.853 10262 19040 19040 W .fast4x.rimusi: Accessing hidden method Ljava/util/Collections$SynchronizedCollection;-><init>(Ljava/util/Collection;Ljava/lang/Object;)V (max-target-o, reflection, denied)
1721854961.882 10262 19040 19040 D ViewScrollStubImpl: the value of ScrollFrictionRes is: 0.03
1721854961.886 10262 19040 19040 D IS_CTS_MODE: false
1721854961.886 10262 19040 19040 D MULTI_WINDOW_SWITCH_ENABLED: false
1721854961.887 10262 19040 19040 D IS_CTS_MODE: false
1721854961.887 10262 19040 19040 D MULTI_WINDOW_SWITCH_ENABLED: false
1721854961.888 10262 19040 19040 D DecorView[]: getWindowModeFromSystem  windowmode is 1
1721854962.154 10262 19040 19040 D AndroidRuntime: Shutting down VM
1721854962.155 10262 19040 19040 E AndroidRuntime: FATAL EXCEPTION: main
1721854962.155 10262 19040 19040 E AndroidRuntime: Process: it.fast4x.rimusic, PID: 19040
1721854962.155 10262 19040 19040 E AndroidRuntime: java.lang.RuntimeException: Unable to create service it.fast4x.rimusic.service.PlayerService: android.os.NetworkOnMainThreadException
1721854962.155 10262 19040 19040 E AndroidRuntime:  at android.app.ActivityThread.handleCreateService(ActivityThread.java:4648)
1721854962.155 10262 19040 19040 E AndroidRuntime:  at android.app.ActivityThread.access$1800(ActivityThread.java:276)
1721854962.155 10262 19040 19040 E AndroidRuntime:  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2149)
1721854962.155 10262 19040 19040 E AndroidRuntime:  at android.os.Handler.dispatchMessage(Handler.java:106)
1721854962.155 10262 19040 19040 E AndroidRuntime:  at android.os.Looper.loopOnce(Looper.java:210)
1721854962.155 10262 19040 19040 E AndroidRuntime:  at android.os.Looper.loop(Looper.java:299)
1721854962.155 10262 19040 19040 E AndroidRuntime:  at android.app.ActivityThread.main(ActivityThread.java:8261)
1721854962.155 10262 19040 19040 E AndroidRuntime:  at java.lang.reflect.Method.invoke(Native Method)
1721854962.155 10262 19040 19040 E AndroidRuntime:  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
1721854962.155 10262 19040 19040 E AndroidRuntime:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)
1721854962.155 10262 19040 19040 E AndroidRuntime: Caused by: android.os.NetworkOnMainThreadException
1721854962.155 10262 19040 19040 E AndroidRuntime:  at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1668)
1721854962.155 10262 19040 19040 E AndroidRuntime:  at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:115)
1721854962.155 10262 19040 19040 E AndroidRuntime:  at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103)
1721854962.155 10262 19040 19040 E AndroidRuntime:  at java.net.InetAddress.getByName(InetAddress.java:1106)
1721854962.155 10262 19040 19040 E AndroidRuntime:  at java.net.InetSocketAddress.<init>(InetSocketAddress.java:245)
1721854962.155 10262 19040 19040 E AndroidRuntime:  at it.fast4x.rimusic.service.PlayerService.onCreate(SourceFile:757)
1721854962.155 10262 19040 19040 E AndroidRuntime:  at android.app.ActivityThread.handleCreateService(ActivityThread.java:4635)
1721854962.155 10262 19040 19040 E AndroidRuntime:  ... 9 more
1721854962.155 10262 19040 19040 E MQSEventManagerDelegate: failed to get MQSService.
1721854962.155 10262 19040 19040 D OOMEventManagerFK: checkEventAndDumpForJE: 0
1721854962.156 10262 19040 19040 E MQSEventManagerDelegate: failed to get MQSService.
1721854962.181 10262 19040 19040 I Process : Sending signal. PID: 19040 SIG: 9

System: Android 12, Miui 13.0.5

for a private application this is one of the MOST NECESSARY FUNCTIONS among many others

Wjxfi commented 2 months ago

I can't listen to my library of tracks because of your buggy app, by fixing this terrible bug you will make your app beautiful, colorful, closer to ideal and perfection

Wjxfi commented 2 months ago

I can't listen to my library of tracks because of your buggy app, by fixing this terrible bug you will make your app beautiful, colorful, closer to ideal and perfection

True or false?

fast4x commented 2 months ago

I don’t like the way you ask for things. You have to be more respectful!

Wjxfi commented 2 months ago

I'm sorry, maybe I've become more toxic... thanks for letting me look at myself from the outside, it might help me

fast4x commented 2 months ago

Ok

Wjxfi commented 2 months ago

Fix it please , sorry I cannot use your app :/

ALMIGHTY-VC commented 2 months ago

Ok

Hmm i also wanna what are the parameters for which someone should be recommended custom version should he try

fast4x commented 2 months ago

Actually isn't a custom version with tor support

ALMIGHTY-VC commented 2 months ago

Actually isn't a custom version with tor support

Well i think tor support might slowdown the app due to its enhanced onion e layers and rimusic itself is Private and clean enough

fast4x commented 2 months ago

Yes, I'll try to check if tor would be slow down RiMusic

Elendil211 commented 2 months ago

This problem is not related to the usage of TOR, it's a general problem with the proxy setting. I tried using a normal https proxy, and I get the same crashes. I'm using the latest Version from F-Droid (0.6.45.1).

Btw: Sorry for the rude tone of the other guy. Your app is great, I have the highest respect for your work, and think you're quite fast with fixing issues. Last week I discovered your app, had an issue with moving songs in the playlist, and not a week later, it's already fixed. Really good work!

fast4x commented 2 months ago

This is much interesting, thanks

fast4x commented 2 months ago

This problem is not related to the usage of TOR, it's a general problem with the proxy setting. I tried using a normal https proxy, and I get the same crashes. I'm using the latest Version from F-Droid (0.6.45.1).

Btw: Sorry for the rude tone of the other guy. Your app is great, I have the highest respect for your work, and think you're quite fast with fixing issues. Last week I discovered your app, had an issue with moving songs in the playlist, and not a week later, it's already fixed. Really good work!

please, enable debug log in miscellaneous settings and restart app After crash copy crash log from same settings and paste here.

Elendil211 commented 2 months ago

Unfortunately, I don't have that option in the settings. I only have the option to dump a whole system log - which is around 1 million lines. I tried to extract something useful, the best I could find was the line Dex parent of /data/app/~~<random_string>==/it.fast4x.rimusic-<other_random_string>==/base.apk is not writable: Permission denied.

Elendil211 commented 2 months ago

No, wait. I found a stacktrace:

08-01 23:49:06.679 10282  4788  4788 E AndroidRuntime: Process: it.fast4x.rimusic, PID: 4788
08-01 23:49:06.679 10282  4788  4788 E AndroidRuntime: java.lang.RuntimeException: Unable to create service it.fast4x.rimusic.service.PlayerService: android.os.NetworkOnMainThreadException
08-01 23:49:06.679 10282  4788  4788 E AndroidRuntime:  at android.app.ActivityThread.handleCreateService(ActivityThread.java:4925)
08-01 23:49:06.679 10282  4788  4788 E AndroidRuntime:  at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
08-01 23:49:06.679 10282  4788  4788 E AndroidRuntime:  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2407)
08-01 23:49:06.679 10282  4788  4788 E AndroidRuntime:  at android.os.Handler.dispatchMessage(Handler.java:107)
08-01 23:49:06.679 10282  4788  4788 E AndroidRuntime:  at android.os.Looper.loopOnce(Looper.java:232)
08-01 23:49:06.679 10282  4788  4788 E AndroidRuntime:  at android.os.Looper.loop(Looper.java:317)
08-01 23:49:06.679 10282  4788  4788 E AndroidRuntime:  at android.app.ActivityThread.main(ActivityThread.java:8592)
08-01 23:49:06.679 10282  4788  4788 E AndroidRuntime:  at java.lang.reflect.Method.invoke(Native Method)
08-01 23:49:06.679 10282  4788  4788 E AndroidRuntime:  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
08-01 23:49:06.679 10282  4788  4788 E AndroidRuntime:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
08-01 23:49:06.679 10282  4788  4788 E AndroidRuntime: Caused by: android.os.NetworkOnMainThreadException
08-01 23:49:06.679 10282  4788  4788 E AndroidRuntime:  at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1697)
08-01 23:49:06.679 10282  4788  4788 E AndroidRuntime:  at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:115)
08-01 23:49:06.679 10282  4788  4788 E AndroidRuntime:  at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103)
08-01 23:49:06.679 10282  4788  4788 E AndroidRuntime:  at java.net.InetAddress.getByName(InetAddress.java:1106)
08-01 23:49:06.679 10282  4788  4788 E AndroidRuntime:  at java.net.InetSocketAddress.<init>(InetSocketAddress.java:245)
08-01 23:49:06.679 10282  4788  4788 E AndroidRuntime:  at it.fast4x.rimusic.service.PlayerService.onCreate(SourceFile:688)
08-01 23:49:06.679 10282  4788  4788 E AndroidRuntime:  at android.app.ActivityThread.handleCreateService(ActivityThread.java:4912)
08-01 23:49:06.679 10282  4788  4788 E AndroidRuntime:  ... 9 more
fast4x commented 2 months ago

Unfortunately, I don't have that option in the settings. I only have the option to dump a whole system log - which is around 1 million lines. I tried to extract something useful, the best I could find was the line Dex parent of /data/app/~~<random_string>==/it.fast4x.rimusic-<other_random_string>==/base.apk is not writable: Permission denied.

RiMusic miscellanous settings, not system settings... It work nice with proxy https, in this moment i'm connected to 163.172.33.137:4371 Try from this list https://spys.one/en/https-ssl-proxy/

Elendil211 commented 2 months ago

RiMusic miscellanous settings, not system settings...

I can't retrieve the log, though, as the app doesn't open anymore. I suggest to add a path where the log is saved to, so that it's possible to retrieve the log without opening the app.

Or, (in case this is possible, I don't know anything about android app development) wrap the whole app in a try/catch block, so that it's possible to recover from problems like this. In the catch block, there could be displayed an error message with instructions on how to create an issue, or something like that. Maybe (again, not sure whether this is feasible) also some logic to bring the app back to a usable state.

Try from this list

This does work, indeed. I think I know what the problem is:

Therefore, I think, that the field only allows IP addresses, and not domain names. You probably call a library function, that expects an IP address, and that has no handling for domain names.

So the fix would be, to check whether the given string is an IP address or a domain name. And, in case of a domain name, to resolve it to the corresponding IP address.

fast4x commented 2 months ago

Ok, correct, I'll add a url checker. Thanks

fast4x commented 2 months ago

Fixed proxy crash when host isn't an ip address. Available from version 0.6.46