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

failed to establish tcp connection on session connect #61

Open
Tracked by #60
jrobsonchase opened this issue Aug 20, 2024 · 0 comments
Open
Tracked by #60

failed to establish tcp connection on session connect #61

jrobsonchase opened this issue Aug 20, 2024 · 0 comments
Labels
android bug Something isn't working

Comments

@jrobsonchase
Copy link
Collaborator

jrobsonchase commented Aug 20, 2024

This is somewhat blocked by #50, since failing to load via the NativeSession's static block will prevent the runtime from getting initialized properly, which blocks everything else.

However, if you follow the suggested approach from #54 and copy the .so into your android project's JNI libs folder and load the library ahead of time, you can almost make it work. You still need to move the call to Runtime.init out of the try block where Runtime.load throws an exception.

Anyway, if you get all that accomplished, you can successfully call into Rust, which presents you with this lovely stack trace:

java.io.IOException: failed to establish tcp connection
	at com.ngrok.NativeSession.connectNative(Native Method)
	at com.ngrok.NativeSession.connect(NativeSession.java:46)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.ngrok.Session.connect(Session.java:47)
	at com.ngrok.Session$Builder.connect(Session.java:542)
	at com.example.myapplication.MainActivity.onCreate(MainActivity.kt:24)
	at android.app.Activity.performCreate(Activity.java:8780)
	at android.app.Activity.performCreate(Activity.java:8752)
	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1475)
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4067)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4243) 
	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:114) 
	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:144) 
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:101) 
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2705) 
	at android.os.Handler.dispatchMessage(Handler.java:106) 
	at android.os.Looper.loopOnce(Looper.java:255) 
	at android.os.Looper.loop(Looper.java:364) 
	at android.app.ActivityThread.main(ActivityThread.java:8938) 
	at java.lang.reflect.Method.invoke(Native Method) 
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572) 
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1053) 

Not super informative, but hacking up ngrok-java-native to stuff more context into that error tells us: failed to establish tcp connection to connect.ngrok-agent.com: failed to lookup address information: No address associated with hostname

Soooo DNS isn't working right? That's about as far as I've gotten. Possibly some nuance of android app networking that I'm not aware of, or maybe a bad system resolver being used by the rust lib?

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

No branches or pull requests

1 participant