Application Halt for few second on some client's systems - c#

i have a chat application which is perfectly working on debug mode and also running smoothly on client's machines but from last 2 days it's UI get stuck/halt for 10-30 seconds after that it start running again, this process of halt and running happen continuously. its happening only on few machines. i don't know where to start. All users are sitting on same floor so that's not an internet issue neither a system memory issue. If you guys think its a memory issue let me know what to check then?

it was due to internet, The machines where software was halting are on different internet which is little slow so that's is why this issue is occurring.

Related

all of my .NET Console application process showing up in RAMMAP on the server with 4K Private Bytes

I have a lot of console applications that run in a scheduler every 10 mins, I see the console applications are completing successfully, all the objects in the code are closed and disposed as needed. I ran processexplorer, perfview, process monitor and was not able to identify any applications hanging around.
But I see all my applications (1000's of them) are showing up in RAMMAP process section all of them with 4K Private bytes, please see screen shot attached.
Please advise is this normal or do i have a potential leak in all my applications? any tool that can be recommended to identify/resolve this issue?
Thanks

C#, BLE. Why does GetGattServicesAsync hang forever? Is there a work around such as turning off/on BLE?

I considered cross posting to the Super User site or similar but don't know how. As you will see this is not just a programming question.
I developed some C# code to communicate with an Onset InTemp thermometer via Bluetooth Low Energy (BLE). It works fine for a long time. I'm able to get beacons (which have the thermometer data) and also connect, get services and characteristics in case I need to get missed data or set parameters on the thermometer. However, after about 8 hours (can be as much as 24 hours) of continuously receiving beacons and connecting, getting historical data, etc., my app hangs on this line:
var gatt = await device.GetGattServicesAsync();
I put lines before and after this line and verified it's clearly hanging on this line. Again, it can be after 8 hours or 24 hours of use. It certainly chugs along just fine for quite a time. Killing and restarting the program is of no help. It hangs on the first call to:
device = await BluetoothLEDevice.FromBluetoothAddressAsync(args.BluetoothAddress);
Only rebooting the PC fixes the problem. This is not surprising given the messages in the Windows Event Logs before it hangs:
The Bluetooth driver expected an HCI event with a certain size but did not receive it.
It's for this reason that I stated that this might be a SuperUser board question. No matter how badly I programmed my code :), killing the program should get BLE working again. FWIW, I did try disabling/re-enabling BLE through settings before rebooting.
I have found some links to this problem, but nothing very definitive.
I'm also working on writing a smaller, complete program to show the problem. So far, I can't get example program to fail from which I conclude that either (1) I haven't let it run long enough, or (2) I'm not fully duplicating what is going on with my full program. Perhaps I'm not putting as much pressure on the BLE drivers or I'm not listening for beacons and attempting to connect in the same ratios or with the same timing.
I should say that I see a lot of gripes about Windows implementation of the BLE Host layer and BLE drivers. Unfortunately, I'm stuck with Windows. Nordic also suggested that everything I'm reporting is a "known problem" and using their Nordic dongle will solve the problem. See for example: https://devzone.nordicsemi.com/f/nordic-q-a/65516/using-nrf52840-dongle-as-receiver-client-for-onset-thermometer.
That may well be true, but it would be a lot of work as they have libraries in C++ and Node.JS but not C#.
Any help is greatly appreciated.
Thank you!

Two desktops running a windows form application shared on a network folder is slow and lags

My name is Grant and I am just graduating college and I have been working on a little reservation system for a campground and I am running into some issues with speed. I know my code is not perfect, but I do believe I have done a pretty good job at writing a nice, neat, organized program.
Right now how I run the application is by storing it on a shared network folder on one of the desktops, and then I run the application from the shared folder on the other desktop. The ISSUE I am having is that there seems to be a little bit of or its slow sometimes. Its almost like the computer cant keep up. Which is strange, because when you run the application on the desktop where the application is actually being shared from, the application works great. Its fast and responsive. So that makes me believe my code is fine because it runs great on that computer so it cant be my code. Which leads me to believe that its either my network(which I also have a hard time believing, because we have no problems streaming multiple things at the same time). We have never had any problems lately with internet speed. So where I am at now is could it possibly be the desktop itself. They are both pretty cheap desktops running the app. If I upgraded and bought two new desktop computers would the speed increase at all?
Any help or advice on the issue would be great. The application is working likes its suppose to, but the speed of it needs to be picked up. If anyone has any advice at all I would very much appreciate it.
Thanks in advance.

Windows 10 uwp sticky background service?

I'm trying to convert an Android app to Windows 10 UWP. On android its easy: when boot completed, app service is started. It connects to controller over internet, fetches system state and all data (temp sensors, pumps, valves, etc) and keeps everything in memory. Foreground app can get data as soon as service gets them and display values, charts realtime. After closing foreground app, service keeps working, I still have all system state and I can play alarm sound if needed.
Is it possible to do [almost] same functionality on Windows 10 uwp?
I cannot find a way to start service with windows. Service started with foreground app is stopped when foreground app is closed. SocketBackgroundTask keeps connection perfect, but system state is lost with service.
Should I save system state to file and analyze all data after each renew? Data flow varies from once in 10 minutes to ~10 per second.
Or should I forget Windows 10 as limited platform?
I am designing a similar piece of sensor control software, and I have found UWP/Win10 to be limiting. We ultimately resorted to using Assigned Access to keep the app permanently in the foreground.
Assigned Access
Assigned access assigns an app to an account. So when Mr. Bob logs in, the app starts full-screen, and it cannot be closed, and if it crashes, it is restarted.
Note that the only way to access other parts of the system is to hit ALT-CTRL-DEL and log in as a different user. That might be bad for some, but if you have critical process monitoring going on, then it's probably a good thing that the user can't mess about with the system or quit the app.
It's also quite simple to implement, you only need to add a declaration to the app manifest, and you need Win10 Pro or Higher.
Windows IoT
You could also look at Windows 10 IoT, when you deploy an app to it, it does pretty much the same thing. However the range of hardware is quite limited, and many of them aren't fully functional yet - RPi suffers from SDcards being inherently unreliable, and lack of graphics acceleration. Dragonboard lacks driver support for resolutions other than 720p, etc. https://developer.qualcomm.com/forum/qdn-forums/hardware/iot-development-platform/29652
Extended Execution
In addition we have experimented with using extended execution, which lets the app run in minimised state, potentially indefinitely. I have mixed feelings about it. Although the app will keep running most of the time, but if the OS is struggling for resources, the app will get suspended and won't be restarted until the user switches back to it.

Freezing managed threads

I'm working on a quite big application that is in charge of doing real-time motion tracking and camera movement controlling. Its tasks are:
Motion tracking (done by a native module, which decodes a video stream from a network camera and supplies both image buffers as big as 1280x720 pixels and the tracking results to the managed application via callbacks)
Receiving positioning feedback data from and sending movement data to a pan/tilt hardware about 20 times a second as well as zoom commands from/to the camera
Displaying the image data including live visualizations
Encoding and writing of the image and session data
Automatic postprocessing of the video is done by another process
The application uses .NET 4.0 and has a WPF user interface.
Managed threads freezing
From the beginning we had to face managed threads that freeze for between 500 to 1500ms, which is really much for a real-time application like this.
To find out when these hangs occur I created a thread whose only task is to do a sleep for 100ms all the time. I then calculated how long the sleep really took and got exactly the times when the camera movement stopped. It works very reliably, the threads all hang at the same time!
Unmanaged threads don't freeze
While all the managed threads freeze the unmanaged threads work without any problem. We check that by logs that are written independent from the managed part of the application.
Analysis
I tried to figure out with phenomenons could maybe cause this behaviour:
The whole machine slows down when we encounter these problems: Windows is responding very slowly (e.g. directory listings hang for half a minute in both Windows Explorer and my application, or launching applications takes incredibly long)
We read and write thousands of files at the same time (the tracking and postprocessing application), maybe this overcharges windows
The response of the GUI becomes very slow
The app uses about 1.3GB of virtual memory (according to Process.VirtualMemory64) / 500MB of working set memory (Process.WorkingSet64) - could it be that some of that is swapped onto the harddisk? (How can that be checked or solved?)
Of course if we kill the process Windows is responding fast again, but it takes Windows a while to be responding normally again
Hints on how to investigate into this would be highly appreciated. Thank you very much!
Maybe GC is working?
See the great article: http://samsaffron.com/archive/2011/10/28/in-managed-code-we-trust-our-recent-battles-with-the-net-garbage-collector
I would suggest taking a process dump as you are encountering the performance problem. You can do this several ways (taskmgr.exe or procdump.exe from SysInternals). Take a full memory dump.
Once you have the .dmp file, you can analyze it with windbg (or Visual Studio 2010). For managed processes you need to load the sos.dll extensions.
There are a lot of good windbg resources out there, but here are a few that have helped me:
1) Tess Fernandez video (ASP.NET process, but the techniques are the same)
2) WinDbg cheatsheet
The memory analysis will be able to give you the stack (!clrstack) while you are encountering the problem and tell you the exact culprit.

Categories

Resources