Long running thread in WinDbg - asp.net

I have a thread (#39) that has been running for quite some time and trying to figure out why using windbg. The last instruction on the stack is NtRemoveIoCompletion. The application is ASP.Net 4.8. The application has been running 6 minutes when the dump was created. I am thinking this is some kind of low level completion port thread and perhaps can safely ignore it?
0:079> !runaway
User Mode Time
Thread Time
39:3898 0 days 0:00:37.859
26:3314 0 days 0:00:07.859
21:1030 0 days 0:00:04.921
23:2f10 0 days 0:00:04.859
24:4c9c 0 days 0:00:04.781
20:2798 0 days 0:00:04.656
11:4754 0 days 0:00:04.546
10:3238 0 days 0:00:04.390
27:48fc 0 days 0:00:04.328
25:3248 0 days 0:00:04.328
22:4434 0 days 0:00:04.140
60:1d90 0 days 0:00:00.406
0:039> !threads
ThreadCount: 47
UnstartedThread: 0
BackgroundThread: 40
PendingThread: 0
DeadThread: 3
Hosted Runtime: no
Lock
ID OSID ThreadOBJ State GC Mode GC Alloc Context Domain Count Apt Exception
11 1 4754 000000b2ee860f00 28220 Preemptive 000000B47A3EE318:000000B47A3EEFD0 000000b2ee85fec0 0 Ukn
28 2 398c 000000b2ee9ea0d0 2b220 Preemptive 0000000000000000:0000000000000000 000000b2ee85fec0 0 MTA (Finalizer)
30 3 4f28 000000b77a8bd970 102a220 Preemptive 0000000000000000:0000000000000000 000000b2ee85fec0 0 MTA (Threadpool Worker)
31 4 24a8 000000b77a8c7730 21220 Preemptive 0000000000000000:0000000000000000 000000b2ee85fec0 0 Ukn
33 6 4168 000000b77a9f9ec0 1020220 Preemptive 0000000000000000:0000000000000000 000000b2ee85fec0 0 Ukn (Threadpool Worker)
34 9 78 000000b77aa86e20 a029220 Preemptive 0000000000000000:0000000000000000 000000b77a8c66f0 0 MTA (Threadpool Completion Port)
35 10 44c0 000000b780a25150 202b020 Preemptive 000000B2F9661810:000000B2F9661FD0 000000b77a8c66f0 0 MTA
37 11 32d4 000000b780b925f0 202b020 Preemptive 000000B67CBF01A8:000000B67CBF1FD0 000000b77a8c66f0 0 MTA
38 12 1be0 000000b780b994b0 1029220 Preemptive 000000B3FA010F90:000000B3FA011FD0 000000b2ee85fec0 0 MTA (Threadpool Worker)
39 14 3898 000000b780c14110 8029220 Preemptive 000000B67CBDA3F0:000000B67CBDC000 000000b2ee85fec0 0 MTA (Threadpool Completion Port)
2 19 3188 000000b780bd05d0 20220 Preemptive 000000B2F96522F8:000000B2F9653FD0 000000b2ee85fec0 0 Ukn
40 20 2f00 000000b780bd0da0 202b220 Preemptive 0000000000000000:0000000000000000 000000b77a8c66f0 0 MTA
45 21 1b30 000000b780daeb60 1029220 Preemptive 000000B2F964EB60:000000B2F964FFD0 000000b2ee85fec0 0 MTA (Threadpool Worker)
46 22 38d8 000000b780dae390 1029220 Preemptive 000000B37C4C92A0:000000B37C4C9FD0 000000b2ee85fec0 0 MTA (Threadpool Worker)
47 23 40c8 000000b780dac450 1029220 Preemptive 000000B47A3E4C88:000000B47A3E4FD0 000000b2ee85fec0 0 MTA (Threadpool Worker)
[...]
0:039> kb
# RetAddr : Args to Child : Call Site
00 00007ffe`77d04943 : 000000b7`80c14110 00000000`00000000 00000000`00000001 000000b7`7aa6bb50 : ntdll!NtRemoveIoCompletion+0xa
01 00007ffe`722aea3c : 00000000`00003a98 000000b7`82fcf6c0 00000000`80010000 000000b7`80c14110 : KERNELBASE!GetQueuedCompletionStatus+0x3f
02 00007ffe`7219c1cf : 00000000`00000000 00000000`00000000 00000000`00000001 00007ffe`0000000c : clr!ThreadpoolMgr::CompletionPortThreadStart+0x210
03 00007ffe`79ed13d2 : 00007ffe`7219c150 000000b7`80bc2610 00000000`00000000 00000000`00000000 : clr!Thread::intermediateThreadProc+0x86
04 00007ffe`7a7a54f4 : 00007ffe`79ed13b0 00000000`00000000 00000000`00000000 00000000`00000000 : kernel32!BaseThreadInitThunk+0x22
05 00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x34

It's look like something is waiting to io completion port.
Please print all the native stacks.
~*k => command
and the cpu usage of your machine,
!threadpool (with sos.dll extension)
My guess it's you have hang (low cpu) and you wait in the other threads as well

Related

How access to display device in embedded-linux + Qt ? /dev/fb0 not found

1-I have built Qt5.4.1 and Qt4.8.4 for an embedded device (based on armv5tejl) and all things work except GUI.
2-It seems that no frame buffer device exists:
~/bin $ ls -alh /dev/
drwxr-xr-x 3 0 sandbox 0 Nov 10 11:48 .
drwxr-xr-x 14 0 root 0 Nov 14 2017 ..
srw-rw-rw- 1 0 root 0 Nov 10 11:48 log
crw-rw-rw- 1 0 root 1, 3 Nov 10 11:48 null
crw-rw-rw- 1 0 root 5, 2 Nov 10 12:10 ptmx
drwxr-xr-x 2 0 root 0 Jan 1 1970 pts
crw-rw-rw- 1 0 root 5, 0 Nov 10 11:48 tty
crw-rw-rw- 1 0 root 204, 66 Nov 10 12:05 ttyAMA2
crw-r--r-- 1 0 root 1, 9 Nov 10 11:48 urandom
/proc $ cat devices
Character devices:
1 mem
4 /dev/vc/0
4 tty
5 /dev/tty
5 /dev/console
5 /dev/ptmx
7 vcs
10 misc
/proc $ cat devices
Character devices:
1 mem
4 /dev/vc/0
4 tty
5 /dev/tty
5 /dev/console
5 /dev/ptmx
7 vcs
10 misc
13 input
21 sg
29 fb
89 i2c
90 mtd
100 softkey
116 alsa
122 pman
128 ptm
136 pts
150 pwmr
153 upc
154 kdrv_csc
180 usb
189 usb_device
204 ttyAMA
254 rtc
Block devices:
1 ramdisk
259 blkext
8 sd
31 mtdblock
65 sd
66 sd
67 sd
68 sd
69 sd
70 sd
71 sd
128 sd
129 sd
130 sd
131 sd
132 sd
133 sd
134 sd
135 sd
3-from dmesg log:
Console: switching to colour frame buffer device 80x30
CLCD: PL110 CLCD hardware, HIE AT-T050QGH-02, VGA Landscape (supports 640x480 # 24Mhz) display
4-Device itself has a SDK and display things using that SDK and libs in HTML format.
5-I have a restricted user on the device and I'm using my own BusyBox v1.20.0.
My Questions:
1-Is it possible for me to use device display via Qt without using provided SDK?
2-How could I access to the display device?
Any help would be appreciated.
Thank you very much

Converting Data frame to time series in R

I currently have this data set below, but I am unsure as to how I can convert this into a time series from the data frame format that it is currently in.
I am also unsure as to how I can split this data up to create an in-sample and out-of-sample data set for forecasting.
Date Observations
1 1975/01 5172
2 1975/02 6162
3 1975/03 6979
4 1975/04 5418
5 1976/01 4801
6 1976/02 5849
7 1976/03 6292
8 1976/04 5261
9 1977/01 4461
10 1977/02 5322
11 1977/03 6153
12 1977/04 5377
13 1978/01 4808
14 1978/02 5845
15 1978/03 6023
16 1978/04 5691
17 1979/01 4683
18 1979/02 5663
19 1979/03 6068
20 1979/04 5429
21 1980/01 4897
22 1980/02 5685
23 1980/03 5862
24 1980/04 4663
25 1981/01 4566
26 1981/02 5118
27 1981/03 5261
28 1981/04 4459
29 1982/01 4352
30 1982/02 4995
31 1982/03 5559
32 1982/04 4823
33 1983/01 4462
34 1983/02 5228
35 1983/03 5997
36 1983/04 4725
37 1984/01 4223
38 1984/02 4940
39 1984/03 5780
40 1984/04 5232
41 1985/01 4723
42 1985/02 5219
43 1985/03 5855
44 1985/04 5613
45 1986/01 4987
46 1986/02 6117
47 1986/03 5777
48 1986/04 5803
49 1987/01 5113
50 1987/02 6298
51 1987/03 7152
52 1987/04 6591
53 1988/01 6337
54 1988/02 6672
55 1988/03 7224
56 1988/04 6296
57 1989/01 6957
58 1989/02 7538
59 1989/03 8022
60 1989/04 7216
61 1990/01 6633
62 1990/02 7355
63 1990/03 7897
64 1990/04 7159
65 1991/01 6637
66 1991/02 7629
67 1991/03 8080
68 1991/04 7077
69 1992/01 7190
70 1992/02 7396
71 1992/03 7795
72 1992/04 7147

debugger freezes on X (arm)

I am developing an application for Olimex A20 with Qt 5.7. This app needs to run on X. If I just run the application it works perfectly fine. The issue is with the debuging - debugger freezes. This is the stack trace I see when I interrupt the debugger.
This is the line of code where the debugger is waiting for something to happen (qwaitcondition_unix.cpp - line 143).
code = pthread_cond_wait(&cond, &mutex);
This is the main stack trace from thread #1
1 __libc_do_syscall 0xb5dd6514
2 pthread_cond_wait * *GLIBC_2.4 0xb5dd1da6
3 QWaitConditionPrivate::wait qwaitcondition_unix.cpp 143 0xb63a7a44
4 QWaitCondition::wait qwaitcondition_unix.cpp 215 0xb63a7a44
5 QSemaphore::acquire qsemaphore.cpp 143 0xb63a2dba
6 QMetaObject::activate qobject.cpp 3708 0xb6506c6e
7 QMetaObject::activate qobject.cpp 3602 0xb6506fee
8 QDBusConnectionManager::connectionRequested moc_qdbusconnectionmanager_p.cpp 141 0xb3baf2a0
9 QDBusConnectionManager::connectToBus qdbusconnection.cpp 225 0xb3b6b37e
10 QDBusConnectionManager::busConnection qdbusconnection.cpp 134 0xb3b6b488
11 QDBusConnection::sessionBus qdbusconnection.cpp 1195 0xb3b6c058
12 DBusConnection::DBusConnection dbusconnection.cpp 73 0xb3e08a4c
13 QSpiAccessibleBridge::QSpiAccessibleBridge bridge.cpp 66 0xb3dff070
14 QXcbIntegration::accessibility qxcbintegration.cpp 337 0xb3dc563c
15 platformAccessibility qaccessible.cpp 485 0xb6a4ae34
16 QAccessible::isActive qaccessible.cpp 791 0xb6a4ae34
17 QQuickTextInputPrivate::emitCursorPositionChanged qquicktextinput.cpp 4206 0xb6eb5fde
18 QQuickTextInputPrivate::moveCursor qquicktextinput.cpp 3264 0xb6eb9d76
19 QQuickTextInputPrivate::setCursorPosition qquicktextinput_p_p.h 407 0xb6eb9e2a
20 QQuickTextInput::setReadOnly qquicktextinput.cpp 682 0xb6eb9e2a
21 QQuickTextInput::qt_static_metacall moc_qquicktextinput_p.cpp 1180 0xb6f593e8
22 QQuickTextInput::qt_metacall moc_qquicktextinput_p.cpp 1257 0xb6f59cf8
23 QQmlPropertyPrivate::write qqmlproperty.cpp 1254 0xb68a648a
24 QQmlPropertyPrivate::writeValueProperty qqmlproperty.cpp 1183 0xb68a7594
25 QQmlBinding::write qqmlbinding.cpp 333 0xb68f38da
26 QQmlBinding::update qqmlbinding.cpp 197 0xb68f46fc
27 QQmlObjectCreator::finalize qqmlobjectcreator.cpp 1202 0xb68faf92
28 QQmlComponentPrivate::complete qqmlcomponent.cpp 926 0xb68a861e
29 QQmlComponentPrivate::completeCreate qqmlcomponent.cpp 962 0xb68a8698
30 QQmlComponent::create qqmlcomponent.cpp 788 0xb68a85ac
31 QQmlApplicationEnginePrivate::_q_finishLoad qqmlapplicationengine.cpp 136 0xb68f55fc
32 QQmlApplicationEnginePrivate::startLoad qqmlapplicationengine.cpp 115 0xb68f57a4
33 QQmlApplicationEngine::load qqmlapplicationengine.cpp 260 0xb68f57de
34 main main.cpp 50 0x1fd60
This is thread #6
1 __libc_do_syscall 0xb5dd6514
2 pthread_cond_wait * *GLIBC_2.4 0xb5dd1da6
3 _mali_osu_lock_wait 0xb61ec7fe
4 __egl_worker_thread 0xb61e7096
5 start_thread 0xb5dcd5dc
6 ??
0xb5ffd71c
Anyone came across this issue? Any pointers would be appreciated.

AT+CSQ network percentage formula from rssi

Does anyone knows formula for calculating GSM network coverage into percents (0 .. 100) from rssi? It should be safe for 8bit AVR microcontroller CPU, without hardcore math operations like log or division by something that's not 2^n (bitshift is preferred). Creating array with 32 possible percentage values is poor solution.
possible rssi values (0..31 is valid values):
0 -113 dBm or less
1 -111 dBm
2...30 -109... -53 dBm
31 -51 dBm or greater
99 not known or not detectable
Approximate values i want:
RSSI %
0 0
1 3
2 6
3 10
4 13
5 16
6 19
7 23
8 26
9 29
10 32
11 36
12 39
13 42
14 45
15 48
16 52
17 55
18 58
19 61
20 65
21 68
22 71
23 74
24 78
25 81
26 84
27 87
28 90
29 94
30 97
31 100
99 ?
I'm out of ideas, so please advise me! Thanks for Your time!
(rssi * 827 + 127) >> 8
Multiply by 827, add 127 to simulate rounding to nearest, then drop the 8 low order bits, all in integer arithmetic.
This is unfortunately not a simple task to do if you want it to be accurate.
This article best explains the complexities of the task:
https://www.adriangranados.com/blog/dbm-to-percent-conversion
Without involving floats: RSSI*3+3 will miss high and low values, but will be OK mid-range. If accuracy at high values is more important add more than 3 and vice versa.

IIS 6.0 requests slowdown

I have a webapplicaton on IIS 6.0. It constantly processes huge amount of short-time requests (15-30 ms process time). When there comes some (1-10) long-time requests all short-time requests slow down (up to 2000-6000 ms process time and more than 100000 for some of them).
Should there be like an isolation between requests in IIS? It isn't supposed that one requests should not interrupt another?
In IIS logs it is look like:
[Normal work]
cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken
192.168.1.7 200 0 0 2394 524 734
192.168.1.7 200 0 0 2394 524 0
192.168.1.7 200 0 0 2394 524 0
192.168.1.7 200 0 0 2394 524 15
192.168.1.7 200 0 0 2394 524 15
192.168.1.7 200 0 0 2394 524 0
192.168.1.7 200 0 0 2394 524 0
192.168.1.7 200 0 0 2394 524 15
192.168.1.7 200 0 0 2394 524 46
[Slowdown]
cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken
192.168.1.7 200 0 64 0 522 508251
192.168.1.7 200 0 64 0 522 91827
192.168.1.7 200 0 64 0 522 386438
192.168.1.7 200 0 64 0 522 445947
192.168.1.7 200 0 0 178 522 35545
192.168.1.7 200 0 64 0 522 274130
sc-win32-status 64 means "The specified network is no longer available" but there was no disconnections.
I tried to tune IIS up with tools like IISTuner (http://iistuner.codeplex.com/) it causes no effect.
Why such situation happens?
How to troubleshoot that?
Looks like all the troubles were in appltication itself.
We used ASP.NET form with DataGridView on it (pages were formed on server-side). At the time long-running request comes server has to process it and load data into its memory - so that just blocks other activity.
We rewrite application using ASP.NET MVC (client-side pages) and the trouble was gone.

Resources