getlantern / lantern-client

Lantern Client code
GNU General Public License v3.0
14 stars 3 forks source link

Session Model Migration Android. #1131

Closed jigar-f closed 2 months ago

jigar-f commented 4 months ago

Ticket-:https://github.com/getlantern/engineering/issues/1475

atavism commented 4 months ago

@jigar-f I'm not sure if you wanted me to try testing this yet (I had to pass inAppBilling to PaymentsUtil to get the current code to compile); after doing that, however, it's working great for me. Happy to do more testing whenever it's ready!

jigar-f commented 4 months ago

@atavism I am working on this, I am making some changes, It should be ready in day or two.

jigar-f commented 4 months ago

@atavism You can take this for a spin, Most of the changes look good, Let me know if get into any issues.

atavism commented 4 months ago

@jigar-f Thanks! I will start reviewing and do some more testing of this shortly

atavism commented 4 months ago

Hmm, I'm getting an error trying to build the app all of a sudden:

> Task :app:kaptGenerateStubsProdDebugKotlin
w: Flag is not supported by this version of the compiler: -Xallow-result-return-type
w: Kapt currently doesn't support language version 2.0+. Falling back to 1.9.
e: Could not load module <Error module>
jigar-f commented 4 months ago

an error trying to build the app all

Somehow, I am not getting any error. Can you try Flutter Clean or Build Clean and if they work?

jigar-f commented 3 months ago

@atavism Did you get a chance to run this on a different android studio? (mine is Android Studio Jellyfish | 2023.3.1)

atavism commented 3 months ago

@atavism Did you get a chance to run this on a different android studio? (mine is Android Studio Jellyfish | 2023.3.1)

@jigar-f I was able to get it working with these changes: https://github.com/getlantern/lantern-client/pull/1146

jigar-f commented 3 months ago

Thanks, @atavism, I'll do a bit more testing to merge this.

jigar-f commented 3 months ago

@atavism Could you take look at the comments?

atavism commented 3 months ago

Just FYI, I'm trying to do some more testing, but I'm running into the following issue. It happens on startup with a debug build (the app gets stuck on the splash screen):

08-21 09:53:49.090 26121     0 E Go      : fatal error: runtime: stack split at bad time
08-21 09:53:49.090 26121 26214 E GoLog   :  /Users/paul/go/pkg/mod/github.com/getlantern/pathdb@v0.0.0-20240812024914-abec1aaccbc1/minisql/api.go:14 +0x6c fp=0x4000084c60 sp=0x4000084c20 pc=0x75e8f9c42c
08-21 09:53:49.090 26121 26214 E GoLog   : github.com/getlantern/pathdb.NewDB({0x75e97450c8, 0x4000580000}, {0x75e7ed0c05, 0x3})
08-21 09:53:49.090 26121 26214 E GoLog   :  /Users/paul/go/pkg/mod/github.com/getlantern/pathdb@v0.0.0-20240812024914-abec1aaccbc1/db.go:125 +0x14c fp=0x4000084d40 sp=0x4000084c60 pc=0x75e8fa0f4c
08-21 09:53:49.090 26121 26214 E GoLog   : github.com/getlantern/lantern-client/internalsdk.newModel({0x75e7ed0c05, 0x3}, {0x75e97450c8?, 0x4000580000?})
08-21 09:53:49.090 26121 26214 E GoLog   :  /Users/paul/go/src/github.com/getlantern/lantern-client/internalsdk/model.go:87 +0x44 fp=0x4000084d80 sp=0x4000084d40 pc=0x75e9147c24
08-21 09:53:49.090 26121 26214 E GoLog   : github.com/getlantern/lantern-client/internalsdk.NewVPNModel({0x75e97450c8?, 0x4000580000?})
08-21 09:53:49.090 26121 26214 E GoLog   :  /Users/paul/go/src/github.com/getlantern/lantern-client/internalsdk/vpn_model.go:27 +0x38 fp=0x4000084dc0 sp=0x4000084d80 pc=0x75e915ffe8
atavism commented 3 months ago

Looking into the above. Here's the query that's failing: "CREATE TABLE IF NOT EXISTS vpn_data (path TEXT PRIMARY KEY, value BLOB, rowid INTEGER) WITHOUT ROWID"

atavism commented 3 months ago

Another error I'm seeing all of a sudden:

> Task :app:compileProdSideloadKotlin
w: Flag is not supported by this version of the compiler: -Xallow-result-return-type

> Task :app:compileProdSideloadJavaWithJavac FAILED
/Users/paul/go/src/github.com/getlantern/lantern-client/build/app/generated/source/kapt/prodSideload/org/getlantern/lantern/service/LanternService_.java:14: error: cannot inherit from final LanternService
    extends LanternService

Adding open to the LanternService class resolves the issue

atavism commented 3 months ago

I'm trying to do some more testing, but I'm running into the following issue

I'm able to get around this issue by testing a release build, but there's a few new issues now:

Screenshot_20240821-194319

08-21 19:42:56.822 25739 25953 D Database: BEGIN
08-21 19:42:56.825 25739 25953 D Database: SAVEPOINT 'ad7f6a22-1330-4963-aea1-d347e00b14ba' created
08-21 19:42:56.827 25739 25847 D Database: BEGIN
08-21 19:42:56.828 25739 25845 E GoLog   : Aug 22 02:42:56.827 - 0m10s DEBUG bandit: bandit.go:149 Dialer wigglytuff-b9fb7ade-b145-482f-ae31-414e38f35fd4 dialed in 1.158318197 seconds [force_proxied=true force_proxied_reason=proxyall local_proxy_type=http op=proxied_dialer origin_port=443 remotely_proxied=true root_op=proxy user_agent=Dalvik/2.1.0 (Linux; U; Android 14; Pixel 8 Build/AP2A.240705.005)]
08-21 19:42:56.828 25739 25953 D GoModel : notifying io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler$EventSinkImplementation@3e3d8e5.get() on path /bandwidth updates: {/bandwidth=[B@a374fba}
08-21 19:42:56.828 25739 25847 D Database: SAVEPOINT '01cc21c1-7c79-4b73-aac1-712681497f39' created
08-21 19:42:56.829 25739 25953 D Database: RELEASE 'ad7f6a22-1330-4963-aea1-d347e00b14ba'
08-21 19:42:56.830 25739 25847 D GoModel : notifying io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler$EventSinkImplementation@3e3d8e5.get() on path hasOnSuccess updates: {hasOnSuccess=true}
08-21 19:42:56.832 25739 25847 E Database: Error while commit
08-21 19:42:56.832 25739 25847 E Database: android.database.sqlite.SQLiteException: no such savepoint: 01cc21c1-7c79-4b73-aac1-712681497f39: RELEASE '01cc21c1-7c79-4b73-aac1-712681497f39'
08-21 19:42:56.832 25739 25847 E Database:  at net.sqlcipher.database.SQLiteDatabase.native_execSQL(Native Method)
08-21 19:42:56.832 25739 25847 E Database:  at net.sqlcipher.database.SQLiteDatabase.execSQL(SourceFile:2442)
08-21 19:42:56.832 25739 25847 E Database:  at io.lantern.model.dbadapter.TxAdapter.commit(SourceFile:58)
08-21 19:42:57.050 25739 25847 E GoLog   : Aug 22 02:42:57.048 - 0m10s DEBUG fronted: cache.go:76 Updating cache at /data/user/0/org.getlantern.lantern/files/.lantern/masquerade_cache
08-21 19:42:57.876 25739 25845 E GoLog   : Aug 22 02:42:57.874 - 0m11s DEBUG bypass: bypass.go:156 Using domain fronting [op=bypass_dial root_op=bypass_dial]

Screenshot_20240821-194306

jigar-f commented 3 months ago

@atavism thanks for testing, I know the issue about android.database.sqlite.SQLiteException: no such savepoint: 01cc21c1-7c79-4b73-aac1-712681497f39: RELEASE '01cc21c1-7c79-4b73-aac1-712681497f39', somehow I am not able to track it where it happens, I also added logs just for this reason. Looking at the logs, it seems like it started while committing changes to DB.

Also, I have not tested the app on the release build, let me test and see if I can reproduce blank screen and plan issues.

jigar-f commented 3 months ago

@atavism I pushed some changes, Do you mind try running and see if you are still facing some issues? Also, this issue is still there but android.database.sqlite.SQLiteException: no such savepoint: 01cc21c1-7c79-4b73-aac1-712681497f39: RELEASE '01cc21c1-7c79-4b73-aac1-712681497f39' app is not crashing and it works fine,

atavism commented 3 months ago

@jigar-f Working well for me now! Plans load fine and there's no longer any issue switching tabs

atavism commented 3 months ago

@jigar-f I just had two final comments to update some of Go dependencies. LGTM now otherwise! We can share a build for internal testing whenever you think its ready to be merged

jigar-f commented 3 months ago

Thanks, I am planing to merge this tomorrow and we need this #1113 PR for sharing build, Do you mind reviewing that PR?

jigar-f commented 3 months ago

@atavism Also you can see the test is failing in CI, I guess for the same reason., Can you take a look into this today, So I can merge this tomorrow?

atavism commented 3 months ago

Thanks, I am planing to merge this tomorrow and we need this https://github.com/getlantern/lantern-client/pull/1113 PR for sharing build, Do you mind reviewing that PR?

Taking a look now

atavism commented 3 months ago

@atavism Also you can see the test is failing in CI

If you downgrade go.opentelemetry.io/otel v1.28.0 => v1.19.0, that should resolve the issue. Here's a PR: https://github.com/getlantern/lantern-client/pull/1163

jigar-f commented 3 months ago

Thanks, I will look at this on Monday and merge it. meanwhile I found issue on this PR, and fixed it, you can test it if you want.

atavism commented 3 months ago

@jigar-f Just did some more testing with the latest changes, and it's working well for me