Android Question Debugger: java.lang.RuntimeException: java.net.SocketException: Socket closed

Rusty

Well-Known Member
Licensed User
Longtime User
I saw your previous post on this error and note the response therein. However, this makes it where I can't use the debugger to debug my code.
When I compile in Debug mode, it get the following:
java.net.SocketTimeoutException
at java.net.PlainSocketImpl.read(PlainSocketImpl.java:491)
at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)
at java.io.InputStream.read(InputStream.java:162)
at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:142)
at java.io.BufferedInputStream.read(BufferedInputStream.java:227)
at anywheresoftware.b4a.shell.ShellConnector.readControlData(ShellConnector.java:190)
at anywheresoftware.b4a.shell.ShellConnector.connect(ShellConnector.java:185)
at anywheresoftware.b4a.shell.ShellConnector.run(ShellConnector.java:119)
at java.lang.Thread.run(Thread.java:841)
Shutting down VM
threadid=1: thread exiting with uncaught exception (group=0x437c0160)
java.lang.RuntimeException: java.net.SocketException: Socket closed
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:165)
at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:149)
at android.app.ActivityThread.main(ActivityThread.java:5257)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.net.SocketException: Socket closed
at libcore.io.Posix.recvfromBytes(Native Method)
at libcore.io.Posix.recvfrom(Posix.java:141)
at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:164)
at libcore.io.IoBridge.recvfrom(IoBridge.java:506)
at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)
at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)
at java.io.InputStream.read(InputStream.java:162)
at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:142)
at java.io.BufferedInputStream.read(BufferedInputStream.java:227)
at java.io.DataInputStream.readByte(DataInputStream.java:75)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:333)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
... 10 more
java.lang.RuntimeException: java.net.SocketException: Socket closed
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:165)
at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:149)
at android.app.ActivityThread.main(ActivityThread.java:5257)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.net.SocketException: Socket closed
at libcore.io.Posix.recvfromBytes(Native Method)
at libcore.io.Posix.recvfrom(Posix.java:141)
at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:164)
at libcore.io.IoBridge.recvfrom(IoBridge.java:506)
at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)
at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)
at java.io.InputStream.read(InputStream.java:162)
at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:142)
at java.io.BufferedInputStream.read(BufferedInputStream.java:227)
at java.io.DataInputStream.readByte(DataInputStream.java:75)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:333)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
... 10 more
registerBuffer() handle 0xb9138330/29 didn't require registration
System.exit() call: started ignoring fatal signals
GC_CONCURRENT freed 3382K, 17% free 62217K/74680K, paused 1ms+3ms, total 27ms
Compiler shutdown in progress - discarding request
Compiler shutdown in progress - discarding request
Compiler shutdown in progress - discarding request
Compiler shutdown in progress - discarding request
Compiler shutdown in progress - discarding request
Compiler shutdown in progress - discarding request
Compiler shutdown in progress - discarding request
Compiler shutdown in progress - discarding request
Compiler shutdown in progress - discarding request
Compiler shutdown in progress - discarding request
Compiler shutdown in progress - discarding request
Compiler shutdown in progress - discarding request
VM exiting with result code 0, cleanup skipped.
Process talkingsurvey.b4a.survey (pid 22156) has died.
WIN DEATH: Window{2255abc8 u0 id=0 talkingsurvey.b4a.survey/talkingsurvey.b4a.survey.main}
SMS received security event: App[STOP/talkingsurvey.b4a.survey]

The exact (unchanged) code compiled release (obfuscated) works perfectly, but the debug version dies and the running compiled code completely stops.
Any suggestions on how I can compile and use b4abridge (v2.14, ...newer version available?) in debug mode?
Thanks,
Rusty
 

Rusty

Well-Known Member
Licensed User
Longtime User
It seems to happen with the "main" application. The subordinate/supporting apps are all very small and don't seem to have this problem.
I also still have the problem (which may be related) that the debugger does not break on breakpoints unless I set/unset/set/unset... breakpoints or make a series of consecutive breakpoints around the point at which I wish to actually break.
For example:
upload_2016-11-22_3-36-24.png

USUALLY won't break, but:
upload_2016-11-22_3-37-9.png

Will USUALLY break, and it might not even break until you hit line (for example) 5077 or 5088.
It also helps if you set/reset...etc. continually while the program is installing (after compile) to b4aBridge or via USB. It is very unreliable to obtain a debug break.

I mention this because someone in a previous post mentioned that when one gets the error (in the post title), if they remove breakpoints it will work. I tried deleting all the breakpoints and the (title) error goes away...

BTW, the "main" app is very large, 13000+ lines in MAIN with about 100 services, classes and modules adding up to 1000's of line of more code. Don't know if this matters or not.
And finally, this is an app to which the Starter service can NOT be added.
Regards,
Rusty
 
Upvote 0
Top