grote / Transportr

Free Public Transport Assistant without Ads or Tracking
https://transportr.app
GNU General Public License v3.0
1.04k stars 187 forks source link

Bump sdk to 32 and update dependencies for MD3 #873

Closed Bnyro closed 1 year ago

Bnyro commented 1 year ago

closes #869

cla-bot[bot] commented 1 year ago

Thank you for your pull request and welcome to our community! We require contributors to sign our Contributor License Agreement, and we don't seem to have the user @Bnyro on file. In order for your code to get reviewed and merged, please explicitly state that you accept the agreement. Alternatively, you can add a commit that adds yourself to https://github.com/grote/Transportr/blob/master/.clabot

Bnyro commented 1 year ago

I noticed there's a crash:

  1. Enter two locations and search
  2. Select one of the suggested trips
  3. Press the back button
Log A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. java.lang.Throwable: Explicit termination method 'end' not called at dalvik.system.CloseGuard.open(CloseGuard.java:180) at java.util.zip.Inflater.(Inflater.java:104) at java.util.zip.GZIPInputStream.(GZIPInputStream.java:76) at java.util.zip.GZIPInputStream.(GZIPInputStream.java:89) at de.schildbach.pte.AbstractHafasLegacyProvider.lambda$queryTripsBinary$2$de-schildbach-pte-AbstractHafasLegacyProvider(AbstractHafasLegacyProvider.java:1430) at de.schildbach.pte.AbstractHafasLegacyProvider$$ExternalSyntheticLambda0.onSuccessful(D8$$SyntheticClass) at de.schildbach.pte.util.HttpClient.getInputStream(HttpClient.java:291) at de.schildbach.pte.util.HttpClient.getInputStream(HttpClient.java:228) at de.schildbach.pte.util.HttpClient.getInputStream(HttpClient.java:224) at de.schildbach.pte.AbstractHafasLegacyProvider.queryTripsBinary(AbstractHafasLegacyProvider.java:1428) at de.schildbach.pte.AbstractHafasLegacyProvider.queryTripsBinary(AbstractHafasLegacyProvider.java:1388) at de.schildbach.pte.AbstractHafasLegacyProvider.queryTrips(AbstractHafasLegacyProvider.java:688) at de.grobox.transportr.trips.search.TripsRepository.queryTrips(TripsRepository.kt:110) at de.grobox.transportr.trips.search.TripsRepository.access$queryTrips(TripsRepository.kt:52) at de.grobox.transportr.trips.search.TripsRepository$search$1.invoke(TripsRepository.kt:104) at de.grobox.transportr.trips.search.TripsRepository$search$1.invoke(TripsRepository.kt:104) at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)

Unfortunately I have really no idea how to fix that, it's already running in a try catch block so it shouldn't crash the app in theory :/

It looks like there's a memory leak in NetworkProvider#queryTrips (so from the pte library), but I've no clue how that's related to the SDK / AGP changes.

grote commented 1 year ago

This doesn't look like a crash, just a resource leak. Sure that's the right stack trace?

pt2121 commented 1 year ago

I haven't checked what would cause this but I can reproduce it. The app is just ANR with Input dispatching timed out

log 2023-06-14 18:42:42.399 1703-31190 ActivityManager system_server E ANR in de.grobox.liberario.debug (de.grobox.liberario.debug/de.grobox.transportr.trips.search.DirectionsActivity) PID: 25820 Reason: Input dispatching timed out (1d5bf3b de.grobox.liberario.debug/de.grobox.transportr.trips.search.DirectionsActivity (server) is not responding. Waited 5005ms for MotionEvent) Parent: de.grobox.liberario.debug/de.grobox.transportr.trips.search.DirectionsActivity Frozen: false Load: 3.83 / 3.92 / 2.7 ----- Output from /proc/pressure/memory ----- some avg10=3.73 avg60=2.47 avg300=1.52 total=15734827 full avg10=1.31 avg60=0.70 avg300=0.42 total=5567666 ----- End output from /proc/pressure/memory ----- CPU usage from 2ms to 9162ms later (2023-06-14 18:42:33.200 to 2023-06-14 18:42:42.360): 56% TOTAL: 21% user + 25% kernel + 6.1% iowait + 1.9% irq + 1.2% softirq 71% 1703/system_server: 25% user + 45% kernel / faults: 18282 minor 384 major 29% 31107/jp.naver.line.android: 21% user + 7.9% kernel / faults: 28765 minor 164 major 14% 30800/com.ubercab: 9.5% user + 5.4% kernel / faults: 7895 minor 1 major 14% 11984/com.motorola.motocare: 12% user + 1.7% kernel / faults: 15375 minor 4 major 11% 3794/com.google.android.gms: 5.3% user + 6.2% kernel / faults: 27982 minor 377 major 8.8% 619/android.hardware.keymaster@4.1-service-qti: 0.1% user + 8.7% kernel 7.7% 3556/kswapd0:1: 0% user + 7.7% kernel 7.4% 169/kswapd0:0: 0% user + 7.4% kernel 6.5% 1676/adbd: 2.1% user + 4.3% kernel / faults: 3426 minor 5.4% 3067/com.google.android.gms.persistent: 2.7% user + 2.7% kernel / faults: 1700 minor 2 major 4.5% 4281/com.google.android.inputmethod.latin: 2.6% user + 1.9% kernel / faults: 1519 minor 109 major 3.1% 26160/kworker/u16:11-kverityd: 0% user + 3.1% kernel / faults: 16 minor 3.1% 29523/com.android.vending: 1% user + 2% kernel / faults: 11549 minor 33 major 2.9% 1373/installd: 0.2% user + 2.7% kernel / faults: 216 minor 2.9% 6461/kworker/u16:12-ufs_clkscaling_0: 0% user + 2.9% kernel / faults: 5 minor 2.5% 594/logd: 0.6% user + 1.8% kernel / faults: 5 minor 2.2% 21303/kworker/u16:1-kverityd: 0% user + 2.2% kernel / faults: 3 minor 2.2% 30988/com.zerofasting.zero: 1% user + 1.2% kernel / faults: 10096 minor 3 major 2.1% 26162/kworker/u16:15-events_unbound: 0% user + 2.1% kernel / faults: 3 minor 2% 671/keystore2: 1% user + 0.9% kernel / faults: 153 minor 2 major 2% 2416/com.android.systemui: 1.4% user + 0.6% kernel / faults: 1020 minor 107 major 2% 25820/de.grobox.liberario.debug: 1% user + 0.9% kernel / faults: 4888 minor 14 major 2% 26161/kworker/u16:14-kverityd: 0% user + 2% kernel / faults: 4 minor 0.2% 1434/media.swcodec: 0.1% user + 0.1% kernel / faults: 4744 minor 57 major 1.7% 287/kworker/u16:4-ufs_clk_gating_0: 0% user + 1.7% kernel / faults: 7 minor 1.7% 366/kworker/u16:10-ufs_clkscaling_0: 0% user + 1.7% kernel / faults: 2 minor 1.6% 365/kworker/u16:9-ufs_clkscaling_0: 0% user + 1.6% kernel / faults: 11 minor 1.5% 2509/com.android.networkstack.process: 0.7% user + 0.7% kernel / faults: 1850 minor 47 major 1.5% 29800/com.android.vending:background: 0.4% user + 1% kernel / faults: 5707 minor 13 major 0.2% 1376/media.extractor: 0.1% user + 0.1% kernel / faults: 2852 minor 35 major 1.3% 595/lmkd: 0.1% user + 1.2% kernel 1.3% 866/statsd: 0.3% user + 0.9% kernel / faults: 119 minor 11 major 1.3% 1034/audioserver: 0.4% user + 0.8% kernel / faults: 288 minor 11 major 0.1% 1407/media.codec: 0.1% user + 0% kernel / faults: 3431 minor 19 major 1% 1039/surfaceflinger: 0.6% user + 0.4% kernel / faults: 64 minor 2 major 1% 2711/com.android.phone: 0.3% user + 0.7% kernel / faults: 961 minor 155 major 0.9% 670/android.system.suspend@1.0-service: 0.1% user + 0.8% kernel / faults: 22 minor 0.9% 867/netd: 0.3% user + 0.6% kernel / faults: 341 minor 10 major 0.9% 30334/logcat: 0.3% user + 0.6% kernel 0.7% 868/zygote64: 0% user + 0.7% kernel / faults: 343 minor 0.6% 11/rcu_preempt: 0% user + 0.6% kernel 0.6% 12/rcuog/0: 0% user + 0.6% kernel ---------------------------- PROCESS STARTED (24454) for package de.grobox.liberario.debug ----------------------------
Bnyro commented 1 year ago

I've downgraded some library versions now (since they depend on certain versions of each other), seems like we didn't actually require bumping all the versions so up for using Material Design 3.

Anyways it's a bit odd that the androidx.fragment library just can't be updated due to some issues with the MapBox SDK.

pt2121 commented 1 year ago

Anyways it's a bit odd that the androidx.fragment library just can't be updated due to some issues with the MapBox SDK.

Yeah, that's not great. From what I heard, we'll move eventually away from MapBox. :crossed_fingers:

pt2121 commented 1 year ago

Can you tell the bot again that you agree with the CLA?

Bnyro commented 1 year ago

Hey cla bot, I agree with the CLA :)

pt2121 commented 1 year ago

Build failed. may be have to update Java version in the workflow?

Bnyro commented 1 year ago

Yes, I agree to the CLA ...

ialokim commented 1 year ago

Build failed. may be have to update Java version in the workflow?

Looks like there is some problem with the dependency pinning again:

No dependency for integrity assertion 'Android:Sdk:platforms:core-for-system-modules.jar:c6560a19a3d6f4478e35a55e8984efb27866bad46ceb9988315cd80aafd8b352'

Maybe we'd need to update https://github.com/grote/Transportr/blob/master/update-dependency-pinning.sh to exclude that dependency from grade.witness.

Bnyro commented 1 year ago

Sounds reasonable. Would you mind suggesting the changes to update-dependency-pinning.sh needed or just pushing them to my branch?

pt2121 commented 1 year ago

Edit: never mind - pushed to your branch.

looks like the Java version is good now but we got a new error. from what ialokim suggested, can we try to update the update-dependency-pinning.sh?

I believe we have to change from :platforms:android.jar: to :platforms:core-for-system-modules.jar:.

The line should be

./gradlew -q calculateChecksums | grep -Ev "^(Skipping|Verifying)" | grep -Ev "files-2.1:|caches:transforms-3:|:build-tools:core-lambda-stubs.jar:|:platforms:core-for-system-modules.jar:|-linux.jar:" > $WITNESS

Thanks again!

pt2121 commented 1 year ago

Sounds reasonable. Would you mind suggesting the changes to update-dependency-pinning.sh needed or just pushing them to my branch?

I just pushed to your branch.

pt2121 commented 1 year ago

lol, failed with another error. I will look into this over the weekend then. Thanks for your patience.

Bnyro commented 1 year ago

Oh no, not yet an other one, the CI doesn't play in our team this time apparently :-p I will try to figure out the reason by using https://github.com/nektos/act tomorrow (I hope that works), but currently I don't have much of an idea what's causing it

pt2121 commented 1 year ago

Sorry for the delay - been slammed at work. I will re-test and merge over this coming weekend unless anyone wants to review.