应用程序的主线程在vpn断开连接后冻结

时间:2016-01-30 11:34:51

标签: java android java-native-interface httprequest vpn

我写了一个VPN应用程序,它有一些Http请求另一个工作,如获取帖子等。 我的应用程序使用本机函数调用和JNI调用VPN连接 当我断开它Http请求线程冻结

"Thread-9412@6917" prio=5 runnable
  java.lang.Thread.State: RUNNABLE
      at libcore.io.Posix.android_getaddrinfo(Posix.java:-1)
      at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:55)
      at java.net.InetAddress.lookupHostByName(InetAddress.java:451)
      at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
      at java.net.InetAddress.getAllByName(InetAddress.java:215)
      at com.android.okhttp.internal.Network$1.resolveInetAddresses(Network.java:29)
      at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:188)
      at com.android.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:157)
      at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:100)
      at com.android.okhttp.internal.http.HttpEngine.createNextConnection(HttpEngine.java:357)
      at com.android.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:340)
      at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:330)
      at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:248)
      at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:437)
      at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:114)
      at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.connect(DelegatingHttpsURLConnection.java:89)
      at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:-1)
      at com.helpers.http.SimpleHttpGet.execute(SimpleHttpGet.java:30)
      at com.tasks.ConfigurationTask.doInBackground(ConfigurationTask.java:571)
      - locked <0x1b2a> (a com.tasks.ConfigurationTask)
      at com.tasks.ConfigurationTask$1.run(ConfigurationTask.java:602)
      at java.lang.Thread.run(Thread.java:818)

当我多次离开应用程序并进入我的主线程冻结

"main@6852" prio=5 runnable
  java.lang.Thread.State: RUNNABLE
      at android.graphics.Paint.native_getRunAdvance(Paint.java:-1)
      at android.graphics.Paint.getRunAdvance(Paint.java:2322)
      at android.graphics.Paint.getRunAdvance(Paint.java:2354)
      at android.text.TextLine.handleText(TextLine.java:748)
      at android.text.TextLine.handleRun(TextLine.java:898)
      at android.text.TextLine.measureRun(TextLine.java:417)
      at android.text.TextLine.measure(TextLine.java:296)
      at android.text.TextLine.metrics(TextLine.java:270)
      at android.text.BoringLayout.isBoring(BoringLayout.java:311)
      at android.widget.TextView.onMeasure(TextView.java:6875)
      at android.view.View.measure(View.java:18794)
      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
      at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
      at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:1112)
      at android.widget.LinearLayout.onMeasure(LinearLayout.java:632)
      at android.view.View.measure(View.java:18794)
      at android.support.v7.widget.Toolbar.measureChildCollapseMargins(Toolbar.java:1165)
      at android.support.v7.widget.Toolbar.onMeasure(Toolbar.java:1273)
      at android.view.View.measure(View.java:18794)
      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
      at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
      at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
      at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
      at android.view.View.measure(View.java:18794)
      at android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:868)
      at android.view.View.measure(View.java:18794)
      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
      at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
      at android.support.v7.internal.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:124)
      at android.view.View.measure(View.java:18794)
      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
      at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
      at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
      at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
      at android.view.View.measure(View.java:18794)
      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
      at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
      at android.view.View.measure(View.java:18794)
      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
      at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
      at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
      at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
      at android.view.View.measure(View.java:18794)
      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
      at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
      at com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2643)
      at android.view.View.measure(View.java:18794)
      at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2100)
      at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1216)
      at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1452)
      at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
      at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
      at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
      at android.view.Choreographer.doCallbacks(Choreographer.java:670)
      at android.view.Choreographer.doFrame(Choreographer.java:606)
      at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
      at android.os.Handler.handleCallback(Handler.java:739)
      at android.os.Handler.dispatchMessage(Handler.java:95)
      at android.os.Looper.loop(Looper.java:148)
      at android.app.ActivityThread.main(ActivityThread.java:5417)
      at java.lang.reflect.Method.invoke(Method.java:-1)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

我完全拥有互联网许可,因为如果Vpn已连接或从未连接,则没有问题。

<uses-permission android:name="android.permission.INTERNET" />

另外,当我删除所有Http请求时,主线程没有问题。

到目前为止我尝试了什么:
1-从Vpn中排除App

我认为问题是我必须要做的事情才能断开VPN,但我不知道

感谢您的帮助。

0 个答案:

没有答案