Unity Cardboard App crashes "Unfortuately, AppName has stopped." - google-project-tango

Creating a basic Cardboard Unity App following this tutorial:
https://developers.google.com/tango/apis/unity/unity-cardboard-integration
App loads fine on Unity and build. However, the app crashes without any errors when loading on the Project Tango Tablet.
Error message reads:
./adb logcat
I/dalvikvm( 4242): Could not find method com.google.unity.GoogleUnityActivity.showAndroidViewLayer, referenced from method com.projecttango.unityuxhelper.TangoUnityUxHelper$1.run
W/dalvikvm( 4242): VFY: unable to resolve virtual method 11944: Lcom/google/unity/GoogleUnityActivity;.showAndroidViewLayer (Landroid/view/View;)V
D/dalvikvm( 4242): VFY: replacing opcode 0x6e at 0x0024
D/TangoUnityHelper( 4242): Binding to Tango Android service.
D/AndroidRuntime( 4242): Shutting down VM
W/dalvikvm( 4242): threadid=1: thread exiting with uncaught exception (group=0x4175bba8)
E/AndroidRuntime( 4242): FATAL EXCEPTION: main
E/AndroidRuntime( 4242): Process: com.google.tango.prefab, PID: 4242
E/AndroidRuntime( 4242): java.lang.Error: FATAL EXCEPTION [main]
E/AndroidRuntime( 4242): Unity version : 5.6.0b10
E/AndroidRuntime( 4242): Device model : Google Project Tango Tablet Development Kit
E/AndroidRuntime( 4242): Device fingerprint: google/tango/yellowstone:4.4.2/KOT49H.161129/161129002:user/release-keys
E/AndroidRuntime( 4242):
E/AndroidRuntime( 4242): Caused by: java.lang.NoSuchMethodError: com.google.unity.GoogleUnityActivity.showAndroidViewLayer
E/AndroidRuntime( 4242): at com.projecttango.unityuxhelper.TangoUnityUxHelper$1.run(TangoUnityUxHelper.java:39)
E/AndroidRuntime( 4242): at android.os.Handler.handleCallback(Handler.java:733)
E/AndroidRuntime( 4242): at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime( 4242): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 4242): at android.app.ActivityThread.main(ActivityThread.java:5030)
E/AndroidRuntime( 4242): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 4242): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 4242): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime( 4242): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
E/AndroidRuntime( 4242): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 974): Force finishing activity com.google.tango.prefab/com.google.unity.GoogleUnityActivity
I/dalvikvm-heap( 974): Grow heap (frag case) to 26.696MB for 566416-byte allocation
D/dalvikvm( 4242): GC_CONCURRENT freed 398K, 14% free 3400K/3912K, paused 2ms+1ms, total 13ms
W/ActivityManager( 974): Activity pause timeout for ActivityRecord{42185408 u0 com.google.tango.prefab/com.google.unity.GoogleUnityActivity t10 f}
W/dalvikvm( 1257): a sleep of (0ms, 0ns) requested: forcing a longer delay
D/dalvikvm( 1257): GC_CONCURRENT freed 6330K, 35% free 13908K/21272K, paused 0ms+7ms, total 30ms
D/dalvikvm( 1257): WAIT_FOR_CONCURRENT_GC blocked 17ms
D/dalvikvm( 1257): GC_CONCURRENT freed 2984K, 40% free 12871K/21272K, paused 2ms+2ms, total 22ms
I/ActivityManager( 974): Displayed com.android.launcher/com.android.launcher2.Launcher: +1s171ms
I/dalvikvm-heap( 1257): Grow heap (frag case) to 19.156MB for 468952-byte allocation
D/dalvikvm( 1257): GC_CONCURRENT freed 1235K, 25% free 15971K/21272K, paused 3ms+2ms, total 29ms
D/dalvikvm( 4242): GC_CONCURRENT freed 394K, 14% free 3391K/3912K, paused 1ms+1ms, total 17ms
W/PlatformStatsUtil( 1306): Could not retrieve Usage & Diagnostics setting. Giving up.
W/ActivityManager( 974): Activity destroy timeout for ActivityRecord{42185408 u0 com.google.tango.prefab/com.google.unity.GoogleUnityActivity t10 f}
D/dalvikvm( 4242): GC_CONCURRENT freed 391K, 13% free 3386K/3864K, paused 1ms+1ms, total 25ms
E/WifiController( 974): Not handled here 155652
D/WifiController( 974): battery changed pluggedType: 2
D/dalvikvm( 4242): GC_CONCURRENT freed 386K, 13% free 3387K/3864K, paused 3ms+1ms, total 21ms
D/dalvikvm( 4242): GC_CONCURRENT freed 386K, 13% free 3386K/3864K, paused 3ms+1ms, total 38ms
E/WifiController( 974): Not handled here 155652
D/WifiController( 974): battery changed pluggedType: 2
D/dalvikvm( 4242): GC_CONCURRENT freed 387K, 13% free 3386K/3864K, paused 3ms+1ms, total 19ms
D/dalvikvm( 4242): GC_CONCURRENT freed 387K, 13% free 3386K/3864K, paused 3ms+2ms, total 29ms
E/WifiController( 974): Not handled here 155652
D/WifiController( 974): battery changed pluggedType: 2
D/dalvikvm( 4242): GC_CONCURRENT freed 387K, 13% free 3386K/3864K, paused 2ms+1ms, total 22ms
D/dalvikvm( 4242): GC_CONCURRENT freed 387K, 13% free 3386K/3864K, paused 1ms+1ms, total 13ms
I/ProcessStatsService( 974): Prepared write state in 30ms
I/EventLogChimeraService( 1306): Aggregate from 1492063872720 (log), 1492063872720 (data)
W/PlatformStatsUtil( 1306): Could not retrieve Usage & Diagnostics setting. Giving up.
E/WifiController( 974): Not handled here 155652
D/WifiController( 974): battery changed pluggedType: 2
I/PlayCommon( 1529): [102] com.google.android.play.a.g.e(940): Preparing logs for uploading
I/PlayCommon( 1529): [102] com.google.android.play.a.g.e(942): No file ready to send
I/PlayCommon( 1529): [68] com.google.android.play.a.g.e(940): Preparing logs for uploading
I/PlayCommon( 1529): [68] com.google.android.play.a.g.e(942): No file ready to send
D/dalvikvm( 4242): GC_CONCURRENT freed 387K, 13% free 3386K/3864K, paused 2ms+1ms, total 18ms
D/Raydium_ts_main( 246): ## Report rate in 10 seconds =304
I/Process ( 4242): Sending signal. PID: 4242 SIG: 9
W/InputDispatcher( 974): channel '42384d88 com.google.tango.prefab/com.google.unity.GoogleUnityActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9
E/InputDispatcher( 974): channel '42384d88 com.google.tango.prefab/com.google.unity.GoogleUnityActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
I/ActivityManager( 974): Process com.google.tango.prefab (pid 4242) has died.
E/Sensors ( 974): [nosae] setDelay: 8000000 sec
D/Sensors ( 974): Writing packet 54 32 0A 04 40 1F 00 00 74
W/InputDispatcher( 974): Attempted to unregister already unregistered input channel '42384d88 com.google.tango.prefab/com.google.unity.GoogleUnityActivity (server)'
I/WindowState( 974): WIN DEATH: Window{42384d88 u0 com.google.tango.prefab/com.google.unity.GoogleUnityActivity}
W/WindowManager( 974): Force-removing child win Window{428f0850 u0 SurfaceView} from container Window{42384d88 u0 com.google.tango.prefab/com.google.unity.GoogleUnityActivity}
D/Sensors ( 974): Writing packet 54 36 0A 00 74
W/WindowManager( 974): Failed looking up window
W/WindowManager( 974): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy#4232de78 does not exist
W/WindowManager( 974): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7960)
W/WindowManager( 974): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7951)
W/WindowManager( 974): at com.android.server.wm.WindowState$DeathRecipient.binderDied(WindowState.java:1047)
W/WindowManager( 974): at android.os.BinderProxy.sendDeathNotice(Binder.java:493)
W/WindowManager( 974): at dalvik.system.NativeStart.run(Native Method)
I/WindowState( 974): WIN DEATH: null
D/Sensors ( 974): Writing packet 54 31 0A 00 74
I/MemoryTrimmer( 2300): Trimming objects from memory, since app is in the background.
E/NvWFDSvc( 1672): onTrimMemory lvl = 5
D/Sensors ( 974): Writing packet 54 36 0B 00 74
D/Sensors ( 974): Writing packet 54 31 0B 00 74
I/Finsky ( 1529): [1] com.google.android.finsky.utils.cb.onTrimMemory(17): Memory trim requested to level 60
D/Sensors ( 974): Writing packet 54 36 0C 00 74
D/phs:ipc-loc( 181): Socket 11: hangup from client "com.google.tango.prefab"
D/Sensors ( 974): Writing packet 54 31 0C 00 74
E/WifiController( 974): Not handled here 155652
D/WifiController( 974): battery changed pluggedType: 2

Unfortunately, it's what it is.
I faced same problem too...
After I've deleted all GoogleVR lib it started to work.
So, my point is, that you can't use Cardbord lib with Unity 5.6.
After you will delete it from your Assets, it would be ok.

Related

JMeter Threads Getting blocked after sometime in test

Using JMeter 5.4.1 and JDK 11 in Non-GUI mode, running at 40 Thread at 5 requests/sec.
All Listeners Off
Disabled all assertions, relying on application logs
Groovy used as scripting language in JSR223, using to emulate Pacing between requests
Heap Size increased to 12 GB
After around 40 mins or sometime 70 mins, JMeter stops generating load as seen on Web Server logs. I ran Visual VM on JMeter machine, hooked into JMeter process and took a Thread Dump.
Majority of my threads are in Monitor State
Log as below:
'''
"Script11 - GetRequest 11-1" #61 prio=5 os_prio=0 cpu=13390.63ms elapsed=4266.73s tid=0x000001d1599d9800 nid=0xee0 waiting for monitor entry [0x000000ca924fe000]
java.lang.Thread.State: BLOCKED (on object monitor)
at java.io.PrintStream.println(java.base#11.0.11/PrintStream.java:881)
- waiting to lock <0x0000000500857638> (a java.io.PrintStream)
at org.apache.jmeter.reporters.Summariser.formatAndWriteToLog(Summariser.java:329)
at org.apache.jmeter.reporters.Summariser.sampleOccurred(Summariser.java:208)
at org.apache.jmeter.threads.ListenerNotifier.notifyListeners(ListenerNotifier.java:58)
at org.apache.jmeter.threads.JMeterThread.notifyListeners(JMeterThread.java:1024)
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:579)
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
at java.lang.Thread.run(java.base#11.0.11/Thread.java:834)
Locked ownable synchronizers:
- None
"0x0000000500857638" is Locked on
"Script09 - GetRequest9 9-2" #55 prio=5 os_prio=0 cpu=13562.50ms elapsed=4266.74s tid=0x000001d1599d5000 nid=0x13e0 runnable [0x000000ca91efe000]
java.lang.Thread.State: RUNNABLE
at java.io.FileOutputStream.writeBytes(java.base#11.0.11/Native Method)
at java.io.FileOutputStream.write(java.base#11.0.11/FileOutputStream.java:354)
at java.io.BufferedOutputStream.flushBuffer(java.base#11.0.11/BufferedOutputStream.java:81)
at java.io.BufferedOutputStream.flush(java.base#11.0.11/BufferedOutputStream.java:142)
- locked <0x0000000500857660> (a java.io.BufferedOutputStream)
at java.io.PrintStream.write(java.base#11.0.11/PrintStream.java:561)
- locked <0x0000000500857638> (a java.io.PrintStream)
at sun.nio.cs.StreamEncoder.writeBytes(java.base#11.0.11/StreamEncoder.java:233)
at sun.nio.cs.StreamEncoder.implFlushBuffer(java.base#11.0.11/StreamEncoder.java:312)
at sun.nio.cs.StreamEncoder.flushBuffer(java.base#11.0.11/StreamEncoder.java:104)
- locked <0x00000005008577b8> (a java.io.OutputStreamWriter)
at java.io.OutputStreamWriter.flushBuffer(java.base#11.0.11/OutputStreamWriter.java:181)
at java.io.PrintStream.write(java.base#11.0.11/PrintStream.java:606)
- locked <0x0000000500857638> (a java.io.PrintStream)
at java.io.PrintStream.print(java.base#11.0.11/PrintStream.java:745)
at java.io.PrintStream.println(java.base#11.0.11/PrintStream.java:882)
- locked <0x0000000500857638> (a java.io.PrintStream)
at org.apache.jmeter.reporters.Summariser.formatAndWriteToLog(Summariser.java:329)
at org.apache.jmeter.reporters.Summariser.sampleOccurred(Summariser.java:208)
at org.apache.jmeter.threads.ListenerNotifier.notifyListeners(ListenerNotifier.java:58)
at org.apache.jmeter.threads.JMeterThread.notifyListeners(JMeterThread.java:1024)
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:579)
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
at java.lang.Thread.run(java.base#11.0.11/Thread.java:834)
Locked ownable synchronizers:
- None
Heap Utilization is around 1.5GB, allocation is 12 GB
CPU Utilization on host machine is around 15%
Any suggestions on how to avoid the JMeter threads getting blocked ?
Thanks.

Postgres connect time delay on Windows

There is a long delay between "forked new backend" and "connection received", from about 200 to 13000 ms. Postgres 12.2, Windows Server 2016.
During this delay the client is waiting for the network packet to start the authentication. Example:
14:26:33.312 CEST 3184 DEBUG: forked new backend, pid=4904 socket=5340
14:26:33.771 CEST 172.30.100.238 [unknown] 4904 LOG: connection received: host=* port=56983
This was discussed earlier here:
Postegresql slow connect time on Windows
But I have not found a solution.
After rebooting the server the delay is much shorter, about 50 ms. Then it gradually increases in the course of a few hours. There are about 100 clients connected.
I use ip addresses only in "pg_hba.conf". "log_hostname" is off.
There is BitDefender running on the server but switching it off did not help. Further, Postgres files are excluded from BitDefender checks.
I used Process Monitor which revealed the following: Forking the postgres.exe process needs 3 to 4 ms. Then, after loading DLLs, postgres.exe is looking for custom and extended locale info of 648 locales. It finds none of these. This locale search takes 560 ms (there is a gap of 420 ms, though). Perhaps this step can be skipped by setting a connection parameter. After reading some TCP/IP parameters, there are no events for 388 ms. This time period overlaps the 420 ms mentioned above. Then postgres.exe creates a thread. The total connection time measured by the client was 823 ms.
Locale example, performed 648 times:
"02.9760160","RegOpenKey","HKLM\System\CurrentControlSet\Control\Nls\CustomLocale","REPARSE","Desired Access: Read"
"02.9760500","RegOpenKey","HKLM\System\CurrentControlSet\Control\Nls\CustomLocale","SUCCESS","Desired Access: Read"
"02.9760673","RegQueryValue","HKLM\System\CurrentControlSet\Control\Nls\CustomLocale\bg-BG","NAME NOT FOUND","Length: 532"
"02.9760827","RegCloseKey","HKLM\System\CurrentControlSet\Control\Nls\CustomLocale","SUCCESS",""
"02.9761052","RegOpenKey","HKLM\System\CurrentControlSet\Control\Nls\ExtendedLocale","REPARSE","Desired Access: Read"
"02.9761309","RegOpenKey","HKLM\System\CurrentControlSet\Control\Nls\ExtendedLocale","SUCCESS","Desired Access: Read"
"02.9761502","RegQueryValue","HKLM\System\CurrentControlSet\Control\Nls\ExtendedLocale\bg-BG","NAME NOT FOUND","Length: 532"
"02.9761688","RegCloseKey","HKLM\System\CurrentControlSet\Control\Nls\ExtendedLocale","SUCCESS",""
No events for 388 ms:
"03.0988152","RegCloseKey","HKLM\System\CurrentControlSet\Services\Tcpip6\Parameters\Winsock","SUCCESS",""
"03.4869332","Thread Create","","SUCCESS","Thread ID: 2036"

spindump for Windows Kernel Debugging Devstudio

So, when running into a deadlock, mutex, lock reversal etc etc, on OSX the spindump tool is quite useful. It just dumps all the thread stacks on the system (userland and kernel) and it is fairly visible as to what threads are blocked.
Now using Devstudio to do Kernel Debugging on 2nd VM, I encounter a deadlock. I see I can use "!process 0 0" to dump all processes. And I believe I can switch to a process, and dump threads (?), then pick a thread with "!thread " and "k" to see the stack. But there are literally thousands of threads, surely there is a way to dump them all without manually doing it?
"!process 0 7" runs for about 40mins, and set none of the stacks has my functions in them.
spindump output looks like
Thread 0x8ab 1000 samples (1-1000) priority 81 (base 81)
*1000 call_continuation + 23 (kernel.development + 1927415)
*1000 arc_reclaim_thread + 2391 (arc.c:5095,11 in zfs + 131367)
*1000 cv_timedwait_hires + 206 (spl-condvar.c:172,14 in spl + 8125)
*1000 msleep + 98 (kernel.development + 7434066)
*1000 _sleep + 219 (kernel.development + 7432603)
*1000 lck_mtx_sleep_deadline + 147 (kernel.development + 2362339)
*1000 thread_block_reason + 286 (kernel.development + 2407438)
So nothing magical there, just that it iterates through all threads.
use !stacks with 0,1,2
quoted from the windbg chm file
The !stacks extension gives a brief summary of the state of every thread. You
can use this extension instead of the !process extension to get a quick overview
of the system, especially when debugging multithread issues such as resource
conflicts or deadlocks.
The !findstack user-mode extension also displays information about particular stacks.
Here is an example of the simplest !stacks display:
kd> !stacks 0
Proc.Thread .Thread ThreadState Blocker
[System]
4.000050 827eea10 Blocked +0xfe0343a5
[smss.exe]
[csrss.exe]
b0.0000a8 82723b70 Blocked ntoskrnl!_KiSystemService+0xc4
b0.0000c8 82719620 Blocked ntoskrnl!_KiSystemService+0xc4
b0.0000d0 827d5d50 Blocked ntoskrnl!_KiSystemService+0xc4
.....
edit
!stacks is a time consuming operation
the speed is relative to the transport being used
vm to vm has its own overhead
on a physical connection to a physical machine with net debugging or a
1394 on a pre win 10 is quiet faster than com port or pipe with 115200 baudrate
i am not sure what your vm is but if you are on vbox then you can try vmkd
any way to answer your comment
you can run this to log and grep the output
.logopen z:\foo.txt ; !stacks 0; .logclose
that will open a log file in your desired path and redirect all the output to the log file and close the log file once the command completes
also keep in mind !stacks accepts a wildcard filter string so that only stacks with a symbols that you know can be filtered
like
kd> .logopen c:\stacks.txt ; !stacks 0 Etw; .logclose
Opened log file 'c:\stacks.txt'
Proc.Thread .Thread Ticks ThreadState Blocker
Max cache size is : 1048576 bytes (0x400 KB)
Total memory in cache : 0 bytes (0 KB)
Number of regions cached: 0
0 full reads broken into 0 partial reads
counts: 0 cached/0 uncached, 0.00% cached
bytes : 0 cached/0 uncached, 0.00% cached
** Prototype PTEs are implicitly decoded
[82965600 Idle]
[840dcc40 System]
4.000078 8410ed48 0000081 Blocked nt!EtwpLogger+0xd0
4.000080 8410e4d8 0000081 Blocked nt!EtwpLogger+0xd0
4.000084 84142020 0000081 Blocked nt!EtwpLogger+0xd0
4.000088 84142d48 0000081 Blocked nt!EtwpLogger+0xd0
4.000090 8416c630 000001d Blocked nt!EtwpLogger+0xd0
4.000094 8496ea88 0000bf3 Blocked nt!EtwpLogger+0xd0
4.0000a0 84079a88 000004a Blocked nt!EtwpLogger+0xd0
4.000194 85144d48 000445c Blocked nt!EtwpLogger+0xd0
4.000308 851b9d48 0004035 Blocked nt!EtwpLogger+0xd0
4.00032c 851d3d48 0002d48 Blocked nt!EtwpLogger+0xd0
4.00034c 852e8d48 0003e4a Blocked nt!EtwpLogger+0xd0
4.000350 84973d48 0003df4 Blocked nt!EtwpLogger+0xd0
4.000354 84f0dd48 0003de4 Blocked nt!EtwpLogger+0xd0
4.000444 854c7970 0002158 Blocked nt!EtwpLogger+0xd0
[84f0b930 smss.exe]
[8409eb38 csrss.exe]
[84f34d40 wininit.exe]
[84f4d030 csrss.exe]
[850f8d40 winlogon.exe]
[8515bb38 services.exe]
[85161d40 lsass.exe]
[85163d40 lsm.exe]

In INET, why does ARPTest example network take over 500 seconds to run?

In the INET example project "ARPTest" running on top of OMNeT++, it seems that 1 megabyte of data is being transferred from each of three hosts over Ethernet cables with bandwidths of 512 Mb/s and 100 Mb/s to a server. In real life, it seems this data transfer should take less than a second. However when running the simulation full speed, the simulation runs for 500 virtual seconds and still isn't finished. Can someone explain this discrepancy regarding simulator time, or what am I missing?
First of all, always check the log outputs to see what a simulation is actually doing. The problem with running a simulation in Express mode is that log outputs are skipped, so you don't see what is actually happening.
Now, looking at your question, there is no discrepancy between the simulation time and the actual transmission time of the data transfer.
The 500 sec simulation time is courtesy of the simulation time limit, set in the omnetpp.ini via sim-time-limit = 500s.
OMNeT++ will stop the simulation at 500 seconds simulation time, regardless of further events to process.
For the sake of completeness, I'll post the final log outputs for the ARPtest:
** Event #385441 t=5.831682347368 ARPTest.server.tcp (TCP, id=257) on ACK (inet::tcp::TCPSegment, id=499229)
DETAIL (TCP)ARPTest.server.tcp: Connection 10.0.0.14:1000 to 10.0.0.1:1025 on app[0], connId=8 in LAST_ACK
INFO (TCP)ARPTest.server.tcp: Seg arrived: .1025 > .1000: ack 2347163 win 7504
DETAIL (TCP)ARPTest.server.tcp: TCB: snd_una=2346444 snd_nxt=2346980 snd_max=2347163 snd_wnd=7504 rcv_nxt=1298578 rcv_wnd=7504 snd_cwnd=536 rto=2 ssthresh=3728
DETAIL (TCP)ARPTest.server.tcp: Processing ACK in a data transfer state
DETAIL (TCP)ARPTest.server.tcp: ACK acks our FIN
INFO (TCP)ARPTest.server.tcp: Updating send window from segment: new wnd=7504
INFO (TCP)ARPTest.server.tcp: ACK acks all outstanding segments, cancel REXMIT timer
INFO (TCP)ARPTest.server.tcp: cwnd <= ssthresh: Slow Start: increasing cwnd by one SMSS bytes to cwnd=1072
INFO (TCP)ARPTest.server.tcp: Last ACK arrived
INFO (TCP)ARPTest.server.tcp: Transition: LAST_ACK --> CLOSED (event was: RCV_ACK)
DEBUG (TCP)ARPTest.server.tcp: tcp: LAST_ACK --> CLOSED (on RCV_ACK)
INFO (TCP)ARPTest.server.tcp: Notifying app: CLOSED
INFO (TCP)ARPTest.server.tcp: Deleting TCP connection
** Event #385442 t=5.831682347368 ARPTest.server.tcpApp[0] (TCPEchoApp, id=256) on CLOSED (omnetpp::cMessage, id=499231)
** Event #385443 t=245.831667258618 ARPTest.client.tcp (TCP, id=30) on selfmsg 2MSL (omnetpp::cMessage, id=87)
DETAIL (TCP)ARPTest.client.tcp: Connection 10.0.0.1:1025 to 10.0.0.14:1000 on app[0], connId=7 in TIME_WAIT
DETAIL (TCP)ARPTest.client.tcp: 2MSL timer expired
INFO (TCP)ARPTest.client.tcp: Transition: TIME_WAIT --> CLOSED (event was: TIMEOUT_2MSL)
DEBUG (TCP)ARPTest.client.tcp: tcp: TIME_WAIT --> CLOSED (on TIMEOUT_2MSL)
INFO (TCP)ARPTest.client.tcp: Deleting TCP connection
** Event #385444 t=500 on endsimulation (omnetpp::cEndSimulationEvent)
<!> Simulation time limit reached -- at t=500s, event #385444
** Calling finish() methods of modules
INFO (TCPSessionApp)ARPTest.client.tcpApp[0]: ARPTest.client.tcpApp[0]: ARPTest.client.tcpApp[0]: received 2097152 bytes in 3447 packets
INFO (TCP)ARPTest.client.tcp: ARPTest.client.tcp: ARPTest.client.tcp: finishing with 0 connections open.
INFO (TCP)ARPTest.server.tcp: ARPTest.server.tcp: ARPTest.server.tcp: finishing with 1 connections open.
In the log output, you can clearly see that around 5.83 seconds, the last acknowledgments for the data transfer arrived and the TCP connection is finally closed. Afterwards, a timer expires around 245 seconds and at 500 seconds, the simulation exits (due to the simulation time limit).
The simulation would continue until all timers run out or no further events need to be processed (whatever is the first case for this example).

Radius Networks library randomly stop working

I'm using Radius Networks Open Source Android iBeacon Library, and for some reason at a times it just stops working, that is, it's working ok and then without any apparent reason it stops ranging or at least that's what it appears to be happening. I have experience the same behavior with their iBeacon Locate app.
When this problem occurs, closing and opening the app doesn't help. To get app work properly again I have to close the app, disable the bluetooth, open the app (so the app complains about the bluetooth being disabled), enable the bluetooth and then open the app again.
I have captured the LogCat when the app starts and works properly and when it doesn't, and I have noticed some differences between one and the other that might provide a clue of what's happening.
LogCat when starts and works properly:
07-07 19:51:54.519: D/IBeaconManager(1490): we have a connection to the service now
07-07 19:51:54.629: I/IBeaconService(1490): start ranging received
07-07 19:51:54.629: I/ActivityManager(592): Displayed com.core.vordrawer/.MainActivity: +654ms (total +999ms)
07-07 19:51:54.629: D/BluetoothAdapter(1490): startLeScan(): null
07-07 19:51:54.669: D/BtGatt.GattService(11998): registerClient() - UUID=2c657179-3c94-4f2f-9c0b-2035f646b8a4
07-07 19:51:54.669: D/BtGatt.btif(11998): btif_gattc_register_app
07-07 19:51:54.669: D/BtGatt.btif(11998): btgattc_handle_event: Event 1000
07-07 19:51:54.669: D/BtGatt.btif(11998): btif_gattc_upstreams_evt: Event 0
07-07 19:51:54.669: D/BtGatt.GattService(11998): onClientRegistered() - UUID=2c657179-3c94-4f2f-9c0b-2035f646b8a4, clientIf=5
07-07 19:51:54.669: D/BluetoothAdapter(1490): onClientRegistered() - status=0 clientIf=5
07-07 19:51:54.669: D/BtGatt.GattService(11998): startScan() - queue=0
07-07 19:51:54.669: D/BtGatt.GattService(11998): startScan() - adding client=5
07-07 19:51:54.669: D/BtGatt.btif(11998): btif_gattc_scan
07-07 19:51:54.669: D/BtGatt.btif(11998): btgattc_handle_event: Event 1002
07-07 19:51:54.689: I/bt-hci(11998): BLE HCI(id=62) event = 0x02)
07-07 19:51:54.689: I/bt-hci(11998): btu_ble_process_adv_pkt
07-07 19:51:54.689: I/bt-hci(11998): BLE HCI(id=62) event = 0x02)
07-07 19:51:54.689: I/bt-hci(11998): btu_ble_process_adv_pkt
07-07 19:51:54.699: I/bt-hci(11998): BLE HCI(id=62) event = 0x02)
07-07 19:51:54.699: I/bt-hci(11998): btu_ble_process_adv_pkt
07-07 19:51:54.699: D/BtGatt.btif(11998): btif_gattc_upstreams_evt: Event 4096
07-07 19:51:54.699: D/BtGatt.btif(11998): btif_gattc_add_remote_bdaddr device added idx=0
...
LogCat when starts and DOESN'T work properly:
07-07 19:58:48.270: D/IBeaconManager(4630): we have a connection to the service now
07-07 19:58:48.380: I/IBeaconService(4630): start ranging received
07-07 19:58:48.380: D/BluetoothAdapter(4630): startLeScan(): null
07-07 19:58:48.390: I/ActivityManager(592): Displayed com.core.vordrawer/.MainActivity: +644ms (total +846ms)
07-07 19:58:48.420: D/BtGatt.GattService(11998): registerClient() - UUID=33ecc2dc-ee8f-4bb1-b306-e5a2b82a1cba
07-07 19:58:48.420: D/BtGatt.btif(11998): btif_gattc_register_app
07-07 19:58:48.420: D/BtGatt.btif(11998): btgattc_handle_event: Event 1000
07-07 19:58:48.420: D/BtGatt.btif(11998): btif_gattc_upstreams_evt: Event 0
07-07 19:58:48.420: D/BtGatt.GattService(11998): onClientRegistered() - UUID=33ecc2dc-ee8f-4bb1-b306-e5a2b82a1cba, clientIf=7
07-07 19:58:48.420: D/BluetoothAdapter(4630): onClientRegistered() - status=0 clientIf=7
07-07 19:58:48.420: D/BtGatt.GattService(11998): startScan() - queue=0
07-07 19:58:48.420: D/BtGatt.GattService(11998): startScan() - adding client=7
07-07 19:58:48.420: D/BtGatt.btif(11998): btif_gattc_scan
07-07 19:58:48.420: D/BtGatt.btif(11998): btgattc_handle_event: Event 1002
07-07 19:58:48.420: I/IBeaconService(4630): Adjusted scanStopTime to be Mon Jul 07 19:58:49 GMT-04:30 2014
07-07 19:58:48.570: D/dalvikvm(20228): GC_EXPLICIT freed 2477K, 19% free 28473K/35068K, paused 2ms+7ms, total 41ms
07-07 19:58:48.831: D/dalvikvm(592): GC_EXPLICIT freed 523K, 22% free 26548K/33668K, paused 7ms+9ms, total 150ms
07-07 19:58:49.031: D/dalvikvm(21666): GC_EXPLICIT freed 257K, 7% free 9474K/10172K, paused 2ms+4ms, total 23ms
07-07 19:58:49.521: D/Callback(4630): attempting callback via intent: ComponentInfo{com.core.vordrawer/com.radiusnetworks.ibeacon.IBeaconIntentProcessor}
...
In this last LogCat I believe the usefull messages might be:
I/IBeaconService(4630): Adjusted scanStopTime to be Mon Jul 07 19:58:49 GMT-04:30 2014
D/Callback(4630): attempting callback via intent: ComponentInfo{com.core.vordrawer/com.radiusnetworks.ibeacon.IBeaconIntentProcessor}
But I don't know what to do with that...
Thanks in advance of any assistance you can give me.
It looks like this is a low-level issue with your bluetooth hardware or driver. In the second log snippet you don't see any lines like:
07-07 19:51:54.699: I/bt-hci(11998): BLE HCI(id=62) event = 0x02)
07-07 19:51:54.689: I/bt-hci(11998): btu_ble_process_adv_pkt
These log lines indicate that your Android device is detecting a bluetooth advertising packet from your beacon. Based on your description, it sounds like your bluetooth hardware is getting in a bad state and shutting off bluetooth and turning it back on clears the condition.
A few things you can try to see what is causing this problem:
Turn off wifi. On some Android phone models, wifi and bluetooth share an chip or antenna, and do not work well simultaneously.
Shut off any other apps which may be interfering with bluetooth. The best way to do this is to reboot your phone and see if the app works without any other apps running. (You may also have to go into settings and uninstall any apps that are on auto startup that might use bluetooth.)
Try on a different Android device if you have one available.

Resources