esp32 calling a FREERTOS task from void loop - esp32

I need some help.
I create a FREERTOS vtask "void Mytask(*pvPerameters)" which works fine. Than within a void x() I create an if statement if(ledstate !=1) Mytask();
My problem is the compiler complains of the if statement " no enough arguments for Mytask().
In my project I want to run a wifi.scannetwork which seems to hang all other functions for a few seconds. My thoughts are, if I run this as a vtask on a seperate core it should keep the rest running without a delay. Ive read that all wifi functions run on core 1 but I still get a slow response from a web page during the time I call wifican. not sure if its because wifi cant do both server and scan at the same time?
I remove "Mytask" from FREERTOS and it all works fine. What am I missing

Related

Detect UI operation which will "hang" the application if running in service mode

Fellow experts!
I have faced the following dilemma: some of our tools (executables) are started as scheduled tasks, some are started as services and others as usual desktop apps with interactive Windows user. We are using the code sharing strategy for source management (this is not debatable for this question).
So the solution I want to find is the following:
Detect UI operation at run-time which leads to hanging service/background task (such as say call to Application.ShowException, ShowMessage, MessageDialog, TForm.Show etc.). And when such an action detected I want to raise the exception instead. Then the operation will fail, we will have stack trace etc. but the process will not hang up! The most problematic hang up is when some event processing is done in transaction and then in some of the code used to process event suddenly (because of error in code, design, whatever) there is UI code executed then the process hangs and the DB parts can be locked!
What I think I need to do is: Use DDetours library to intercept WinAPI calls to a certain routines and raise exception instead (so that the process does not hang, but just fail in some method). Also I know that the creation of forms and windows does not hang the app, but only the tries to show them to the user.
Is there some known method of handling this problem? Or maybe there is some list of WinAPI routine set which hangs in service mode?
Thank you in advance.

Logging Windows Syscalls in the kernel Level

Windows Syscall logging from the kernel
Hi. I'm trying to log specific system calls (win32k) that are called in Windows 7. I've tried a couple of ways already. The first thing i tried was drstrace. It's the exact kind of output that I need ( Function Name, Paramters, and return value ), but not all the system calls are getting logged. I'm not 100% sure why this happens but system calls like NtGdiSet~ types are called at once using NtGdiFlush, so these system calls cannot be captured at the user level.
Next I tried logman and xperf, and these seem log those functions drstrace couldn't but they do not resolve system call names (this is not such a big deal actually), and they don't log parameters. And also it does log the return value of the system call but it does not match from which call the return value came from and this is kind of a big deal.
I've thought of building a driver to hook functions at the kernel level, but I've never developed a driver and it didn't work out very well..
So I want to ask if there already is program that can do this or how can i build a driver that can log what I want?

VSS backups cause custom windows service to fail

I've built custom windows services in vb.net that run on a timer and look for files in a remote directory to process. On a few servers, they fail without any error at the same exact time, around 10:04PM when the VSS service fails. The service errors look like:
'The process cannot access the file filename.txt because it is being used by another process.'
Sometimes there are no errors but the service hangs. I am assuming this is the VSS service. Regardless, there is a huge spike in CPU up to 100% and back down.
I have logs (ie the file above that cannot be written to) that relay all activity to me, and each process is wrapped in a try..catch which will also report exceptions to logs for me. Nothing comes of this. The processes fail in random parts of code, usually in the poll timer and sometimes in the middle of processing without warning. The service hangs but says it's still running in services.msc.
Has anyone experienced this issue or know of a fix? I was thinking to make the services multi-threaded so one can check on another in case one thread hangs but am not sure if this would fix the problem. We have tried giving more resources to the servers and this seems to have helped a bit but did not completely fix the problem. Some days it overloads, others it doesnt. Using windows server 2008 x64.
Thanks in advance for you help!
Public Shared aTimer As New Timers.Timer
Public Shared Sub SetTimer()
aTimer.Interval = 60000
' Hook up the Elapsed event for the timer.
AddHandler aTimer.Elapsed, AddressOf OnTimedEvent
aTimer.Enabled = True
End Sub
' The event handler for the Timer.Elapsed event.
Private Shared Sub OnTimedEvent(source As Object, e As ElapsedEventArgs)
Dim gen = New Service1
aTimer.Enabled = False
gen.ProcessEvents() 'This is the main function of the service
aTimer.Enabled = True
End Sub
Update:
Had never thought of a simple solution like this, but in the Task Manager, I right clicked on the service and set the priority to "Realtime" in hopes that the high CPU load during backups would not affect the service. So far so good.
This can be done programatically so each time the service restarts it is in higher priority. This is in my OnStart():
VB.NET:
System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.RealTime

How do i make a Selenium WebDriver run for many hours(CHO) without it causing a crash / OutOfMemory problems?

I am using selenium-2.30.0 to run a single test(on windows) which runs for many hours (~ 8 Hrs). I was using the FF driver, but it runs out of memory after just 45 minutes or less, & the test execution just hangs. I was unable to use HTMLUnitDriver (i thought a pure java solution was the answer) to run the same way as the FF driver (as it needs to wait for page loads & I definitely didn't want to put random thread sleeps in my code or implement any new function by extending the HTMLUnitDriver).
I cannot break the test case to multiple smaller units.
I cannot reload the driver as and when i see heavy memory utilization
Is there any way to get this working?
I found this link:creating-firefox-profile-for-your-selenium-rc-tests, & was quite helpful. Created a new firefox profile with absolute minimal settings, & the test has been running without issues for the last 4 hours. Thanks a lot for the help guys !
What sort of testing are you doing? Selenium is used primarily for Acceptance tests. It sounds like what you're trying to do is more like a soak test on your system.
If that's the case, take a look at JMeter, it's much more suited to this type of work. However, a rather significant difference between the two technologies is that JMeter works at the protocol (HTTP Request) level as opposed to Selenium's use of the rendered HTML.
What does crash, your Java test code or Firefox itself? If it's the Java test code, then are you sure that you're not leaking memory? Or maybe the memory leak is in the server side?

Adding notification of USB (add/remove) in JNI (OSX) - Fails

I used the following code:
How to know when a HID USB/Bluetooth device is connected in Cocoa?
and added it to my jni library. Notification methods never gets called.
Then I tested the code in a small app (without in java / mostly C code). I works all good.
My guess is that Java is preventing the notification to take place.
Any ideas on what I can do ?
I believe this is because no run loop is being run in the Java/JNI environment.
Take a look at how javahidapi is implemented, specifically how it creates a separate thread to run hid_runloop_thread(), which then calls CFRunLoopRunInMode() until it returns a finished/cancelled status.
Note that run loops are thread-specific, so you need to do your CFRunLoopAddSource () and IOServiceAddMatchingNotification() calls from the same thread before calling CFRunLoopRunInMode().

Resources