Closed LI7XI closed 3 years ago
Thank you for your report. I believe I have found the issue: when Granularity in TimeResampler is too low, it floods the plugin with gigabytes of data, and it inflates the memory usage of the plugin. However, the case with the "TargetRate" option shouldn't give you any issues. In this case plugin would only read option "TargetRat" (which doesn't exist, so it wouldn't even be parsed as a number), and since option "TargetRate" wasn't specified, it would have a default value. Maybe you have also changed something else?
Please, check the attached file to see if any of the issues you described here are present in this build. AudioAnalyzer.zip I assumed you use 64-bit version of rainmeter. If not, let me know, I will make a 32-bit version.
I believe I have found the issue: when Granularity in TimeResampler is too low, it floods the plugin with gigabytes of data, and it inflates the memory usage of the plugin. Please, check the attached file to see if any of the issues you described here are present in this build.
Unfortunately the issue still occurs here, it happens for something like: Granularity ([#SomeVariable]+) In this example The + sign will cause it.
Maybe you have also changed something else?
I doubt it but i'll double check. P.S The issue was setting TargetRate to some low value, like 244, when removing the parameter or using a value like 48000 the issue doesn't occur.
I assumed you use 64-bit version of rainmeter. If not, let me know, I will make a 32-bit version.
Yep it's 64-bit, but for some reason, my visualizers look faster and smoother, is it because this is 64-bit and the one i had before was 32-bit?
Unfortunately the issue still occurs here, it happens for something like: Granularity ([#SomeVariable]+) In this example The + sign will cause it.
I can't reproduce it. Can you post you whole measure with variable values here? Just a parent measure description would be enough, without other stuff from the skin, like meters and measures.
Yep it's 64-bit, but for some reason, my visualizers look faster and smoother, is it because this is 64-bit and the one i had before was 32-bit?
I doubt it. Bitness of dlls must match bitness of the main application, otherwise dlls won't work at all.
Also, can you reload your whole Rainmeter application and test again? If some other skin uses the same plugin, it's possible that you tested the old version, because old dll file was already loaded into memory, and your skin used that version instead of reading new file.
Can you post you whole measure with variable values here? Just a parent measure description would be enough, without other stuff from the skin, like meters and measures.
[MeasureAudio]
Measure=Plugin
Plugin=AudioAnalyzer_1_1
Type=Parent
MagicNumber=104
; AV means Audio Value, Originally it was a Measure that sums all Bands Values
; SD means Silence Detector, it's for controlling the skin when no audio is playing
Processing=AV
Processing-AV=channels auto | handlers AVfft, AVresampler, AVmapper, AVFinalOutput, SDFinalOutput | filter none
; ------------------------------------------------------------------------
Handler-AVfft=type fft | binWidth [#QualitySteps] | overlapBoost [#OverlapBoost] | cascadesCount 1 | windowFunction hann
; ------------------------------------------------------------------------
Handler-AVresampler=type BandResampler | source AVfft | bands linear 1 [#FreqMin] ([#FreqMax]*2) | cubicInterpolation true | minCascade 0 | maxCascade 0
; ------------------------------------------------------------------------
Handler-AVmapper=type ValueTransformer | source AVresampler | transform db map[from ([#MaxDB]) : ([#MinDB])] clamp
; ------------------------------------------------------------------------
Handler-AVFinalOutput=type TimeResampler | source AVmapper | attack [#WpAttack] | decay [#WpDecay] | Granularity ([#UpdateRate]+)
; notice the 'plus' above, it causes the issue
Handler-SDFinalOutput=type TimeResampler | source AVmapper | attack [#SDAttack] | decay [#SDDecay] | Granularity ([#UpdateRate])
; but it's working fine here
; ------------------------------------------------------------------------
UpdateDivider=[#SilenceUD]
Group=#GroupName#Measures
; ------------------------------------------------------------------------
Threading=Policy separateThread | UpdateRate [#Fps]
; ========================================================================
When there is audio playing, there is a bang that sets the update divider of all measures and meters to [#UpdateRate]
value, usually it equals (30(the target fps) / 1000).
Also, can you reload your whole Rainmeter application and test again? If some other skin uses the same plugin, it's possible that you tested the old version, because old dll file was already loaded into memory, and your skin used that version instead of reading new file.
Reloaded twice before it crash and 3 times after it crashed, i refresh it after every reload and i even deleted the old versions of the plugin and kept the one you posted today, but still no luck. :/
I also need all the variable values to make it work.
I also need all the variable values to make it work.
Fps=30
SilenceUD=#Fps#
ActiveUD=(#SilenceUD# / #Fps#)
UpdateRate=(1000 / #Fps#)
GroupName=Wallpaper
; ----------------
FreqMin=20
FreqMax=80
; ----------------
QualitySteps=6
OverlapBoost=2
; ----------------
SDAttack=0
SDDecay=900
; ----------------
WpAttack=40
WpDecay=80
; ----------------
MinDB=-5
MaxDB=-27
Child measures if needed:
[AudioValue]
Measure=plugin
Plugin=AudioAnalyzer_1_1
Type=Child
Parent=MeasureAudio
Index=0
Channel=auto
ValueId=AVFinalOutput
Group=#GroupName#Measures
; ------------------------------------
[SilenceDetector]
Measure=plugin
Plugin=AudioAnalyzer_1_1
Type=Child
Parent=MeasureAudio
Index=0
Channel=auto
ValueId=SDFinalOutput
; ------------------------------------
IfAboveValue=0.00001
IfAboveAction=[!SetOptionGroup #GroupName#Measures UpdateDivider [#ActiveUD]][!SetOptionGroup #GroupName#Meters UpdateDivider [#ActiveUD]][!UpdateMeasureGroup #GroupName#Measures][!UpdateMeterGroup #GroupName#Meters][!Redraw]
; -------------------
ifBelowValue=0.00001
ifBelowAction=[!SetOptionGroup #GroupName#Measures UpdateDivider [#SilenceUD]][!SetOptionGroup #GroupName#Meters UpdateDivider [#SilenceUD]]
; ============================
I got the following messages in the log and nothing else:
DBUG (10:23:42.242) : can't parse '((1000 / 30)+)' as a number: Unexpected closing grouping operator, at position: ')'
ERRO (10:23:01.953) test suite\_test\test.ini - [MeasureAudio]: Proc 'AV': error: memory exceeded limit. Are your computer too slow for current settings?
ERRO (10:23:01.961) test suite\_test\test.ini - [MeasureAudio]: Proc 'AV': processing stopped
The version in the link above has a hard limit on the amount of memory that a single handler can use. It shouldn't be able to allocate more than a few megabytes for the whole plugin. Are you sure that you didn't make a mistake, for example, in the plugin name? Plugin in the archive above has name "AudioAnalyzer" instead of "AudioAnalyzer_1_1", if you didn't rename it.
Are you sure that you didn't make a mistake, for example, in the plugin name? Plugin in the archive above has name "AudioAnalyzer" instead of "AudioAnalyzer_1_1", if you didn't rename it.
Actually i wanted to ask, how to update the plugin?
What i did is i went to E:\Users\Documents\Rainmeter\Skins\@Vault\Plugins\AudioAnalyzer_1_1 then removed all old versions then created the following structure
Plugins → AudioAnalyzer_1_1 → 1.1.5.1 → 64bit → AudioAnalyzer_1_1.dll (i renamed the zipped plugin)
But now when i checked the plugins tab in About window, still it shows 1.1.5 as a version.
P.S i renamed the plugin name to AudioAnalyzerx (just to check) and replaced Plugin
option with Plugin=AudioAnalyzerx
.
Even though i did restarted rainmeter and refreshed it many times.
You have to replace .dll file in the c:\Users\<username>\AppData\Roaming\Rainmeter\Plugins\
or some corresponding path on your PC, if you don't use default rainmeter settings.
I believe that @Vault
folder is only used for archiving, and for ease of .rmskin creation.
Sorry, I should have explained this in my first post.
Sorry me, actually i thought about doing that then i said it may not be the correct way.
So i redid everything (renaming the measures to just AudioAnalyzer) and pasting the plugin in that folder, now... the skin makes rainmeter exit instantly once i load it. I used the safe mode to load it because normally it just exists, i didn't know even which skin causes that.
Interesting. Could you spend some time and locate the exact skin that does this? This is clearly not an acceptable behaviuor, but I can't fix it without knowing what went wrong.
Could you spend some time and locate the exact skin that does this?
The skin that uses the exact measures i sent earlier. Btw i'm using Rainmeter v4.4.0.3404 if that helps.
Attach the whole skin in a .zip archive to a post here, please.
The skin that has the issue is called wallpaper, other skins may need Chameleon plugin to work. Update: all the skins has the same issue, but it's easier to deal with in wallpaper skin.
The file is located here: @Resources\Measures\Audio\Wallpaper\MeasureAudio.inc
For me this skin loads without any issues or messages in the log, but it shows nothing. It showed something blurred for a split second, and then it became invisible, and refreshes doesn't do anything. And no crashes.
For me this skin loads without any issues or messages in the log, but it shows nothing. It showed something blurred for a split second, and then it became invisible, and refreshes doesn't do anything. And no crashes.
Set it to be "on desktop", the way it works, first it copies your current wallpaper, blurs it, then display it using bitmap meter. And if you played any music, the wallpaper brightness gonna interact with it using ColorMatrix.
It's weird that it doesn't work\shows errors. What is your rainmeter version?
In the Skins tab in the About window I can see that it correctly determined my wallpapers, but then currentwp
and finalwp
point onto non-existent files.
Though, the reason why this don't work should probably be discussed not in this issue.
The main thing is: it doesn't crash, and I can see that measures in the skin seems to correctly detect sound of different frequencies.
My rainmeter version was 4.4-r3338-beta. I updated to 4.4.0.3433-beta, and rainmeter started to show error messages in the logs: BitmapImage: Unable to open: C:\Users\user\Documents\Rainmeter\Skins\RainVibe\@Resources\Images/Wallpaper/Wallpaper.jpg (RainVibe\Wallpaper\Wallpaper.ini)
.
The main thing is: it doesn't crash, and I can see that measures in the skin seems to correctly detect sound of different frequencies.
I will try a fresh rainmeter install later on, and see if that will solve it or not. Huge thanks for your help!
I installed latest version of rainmeter but still same problem.
otherwise dlls won't work at all.
Hmm.. if possible, can you provide 32-bit version? Even though my windows clearly says it's 64-bit, i doubt that the plugin structure might be the issue.
P.S Never mind, here is what i did to make sure which plugin rainmeter will load: I placed both the last working version and the one your provided today in the plugins folder, renamed the first to AudioAnalyzer1151_32(i copied the 32-bit on purpose, 64 works just fine) and the second one to AudioAnalyzer1152_64, then restarted rainmeter and found it loading the AudioAnalyzer1152_64 version.
I really had no idea what is going on, i mean, if this bug is causing it, then it should just stop the process, not quit rainmeter. Btw, this happens even when using your examples skin, it's not just my suit.
Since I can't replicate this, ideally I would ask you to make a debug builds of both rainmeter and my plugin, and run it in debug mode, to see what's really happening. Although, it's more likely related to some part of your setup, it shouldn't really happen with any setup provided my plugin doesn't have any errors.
But that's kinda advanced stuff, and since you haven't done it yourself already, I suppose you don't have the required skills and/or software.
But that's kinda advanced stuff, and since you haven't done it yourself already, I suppose you don't have the required skills and/or software.
Visual studio takes forever to load and i haven't touch this kinda stuff yet.
Also i checked Debug Mode
option in rainmeter settings but nothing shows an error in the file.
My last hope, could you create a simple skin with the plugin version your provided above? i'll remove all the traces of the old plugin here to make sure it's a problem in my skin.
I believe I have found the issue: when Granularity in TimeResampler is too low, it floods the plugin with gigabytes of data, and it inflates the memory usage of the plugin.
Btw, how is this even possible to happen? from where all this data is coming?
My last hope, could you create a simple skin with the plugin version your provided above?
Here you go. AudioAnalyzer Test_1.1.5.1.zip I have also renamed plugin to AudioAnalyzer-test in this package to make sure it doesn't interfere with other versions of the plugin.
By the way, you can install a second instance of rainmeter using portable mode, to isolate it from all of your current skins and plugins.
Btw, how is this even possible to happen? from where all this data is coming?
That's the purpose of TimeResampler: changes the amount of data, to ensure stable data flow.
Simplified principle of TimeResampler:
TimeResampler receives data every X
milliseconds (controlled by its input), and produces data every Granularity
milliseconds.
When it has received S
blocks, such that S × X > Granularity
, it produces S × X / Granularity
number of blocks, to make sure that next handler in the chain gets a new data block at least every Granularity milliseconds.
When granularity is near zero, S × X / Granularity
is very big. Let say that one block is 1024 values, or 4 kilobytes. Granularity has a hard limit of 0.01 ms. So if your data updates every 16 ms, then overall there will be 16/0.01 == 1600 blocks each update cycle, or 6 MB per update per handler per cascade (if you have cascades and TimeResampler is before BandCascadeTransformer).
But then several things happen:
By the way, you can install a second instance of rainmeter using portable mode, to isolate it from all of your current skins and plugins.
Sadly, still same issue. :( Even with a fresh portable install.
That's the purpose of TimeResampler: changes the amount of data, ... when TimeResampler goes crazy. The version in the link above has a hard limit on the amount of memory that a single handler can use. It shouldn't be able to allocate more than a few megabytes for the whole plugin.
Now i understand how it works, but what is the max memory size the whole plugin can use? and what if you increased it? like let it use more than 20-30Mb.
Also (even though i wouldn't get it) can i see the code that solved the issue?
Sadly, still same issue. :( Even with a fresh portable install.
If this works that way for a fresh installation, then I would say that the issue is in your system. As silly as it might sound, have you tried restarting the windows and running some windows diagnostics? And can you reproduce this on other computers?
Though, running plugin and/or Rainmeter through Visual Studio debugger seems to be the fastest method to learn the truth to me.
Now i understand how it works, but what is the max memory size the whole plugin can use? and what if you increased it? like let it use more than 20-30Mb.
It's 4 MB per handler (applied to data only, but all the other stuff hardly consumes few kilobytes). More than anyone could possibly need in the context of this plugin, in my opinion. Since when there is too much data memory consumption rises exponentially, so it won't work anyways, I don't see any reason to increase it.
Also (even though i wouldn't get it) can i see the code that solved the issue?
There is not much to see.
There is this: if (totalDataCount > 1'000'000) { throw TooManyValuesException{ handlerName }; }
and in another place I write log messages and stop updating the processing when TooManyValuesException happens.
And can you reproduce this on other computers?
Nope, i only have this one, but i do have windows 8 installed beside windows 10, also i'll check if that happens in safe mode as well.
Though, running plugin and/or Rainmeter through Visual Studio debugger seems to be the fastest method to learn the truth to me.
Right now i can't open it because it lags a lot (browser + vscode ate all the Ram). But can you tell me the steps to do it? When i go offline i'll restart the system and do the checks.
There are two possibilities: plugin does something wrong and the app crashes or the Rainmeter itself does something wrong (well, or windows does something wrong, but this happens as a respond to either plugin or Rainmeter itself). Either way, you should download sources, compile it in debug mode (so that debugger can understand what is happening) and run debugger. You can do this for one component at a time, if you like, or both at the same time.
I haven't built Rainmeter for a long time, but IIRC the easiest way to test it is to build .exe in debug mode are copy it into Rainmeter installation folder, replacing original exe, and then connect to it.
Incase of plugin, you should build it, make sure that your skin sees the right plugin, then with unloaded skin (because when it loads Rainmeter crashes) connect debugger to Rainmeter and load skin.
To connect debugger to Rainmeter you should do this: in visual studio click the top menu: Debug
→ Attach to process...
and find Rainmeter in the list of currently running processes.
When the app crashes while debugger is connected to it, Visual Studio will show you the place where something happened, and you will be able to see what the context is, including the whole function call stack.
From there you could try to figure out what's happening by yourself, but the more productive alternative would be to to make a dump (Windows Task Manager → Right click on application → Create dump file) and send this dump to me, so I can see what's happened. Though, that doesn't stop you from browsing the call stack afterwards.
There is a possibility that you will always see that something happened in so called external code. This means that you don't have debug version of the app or library. If something happened inside some unknown code, then it is still important to understand what caused it, and call stack provides you with this opportunity.
Though, if you are seeing that the whole call stack is unknown code, then this is bad.
If when you run it several times and each time get something completely different, then it's likely that process memory gets corrupted. Test it several times and tell me if this happens. This is also very bad.
Previously windows had cool ability to just take a snapshot of the app without connecting the debugger, by showing the window that app crashed, but apparently microsoft decided that this is not needed and disabled it in some windows update, and I spent few hours trying to turn it back on but I didn't manage to.
Earlier i tried to follow your steps but compiling rainmeter or any project in visual studio will fail because i need windows sdk. It takes time to install it and it's kinda big to download, so i left it for another time.
Luckily, i rebooted into safe mode to check, i found the issue still present, but i went to task manager, right-click on rainmeter and clicked debug, i found visual studio JIT debugger so i blindly chosen it and redid the steps for that issue, here is what i got:
Exception thrown at 0x00007FFD3C77E11E (AudioAnalyzer-test.dll) in Rainmeter.exe: 0xC0000005: Access violation reading location 0x0000000000000000. occurred
In output tab:
'Rainmeter.exe' (Win32): Loaded 'C:\Windows\System32\devobj.dll'. Exception thrown at 0x00007FFD3C77E11E (AudioAnalyzer-test.dll) in Rainmeter.exe: 0xC0000005: Access violation reading location 0x0000000000000000.
Note that this is the portable version of rainmeter. Is there anything else i can provide?
I'm afraid this info doesn't tell me much. However, since you are able to stop the process when this occurs, you should be able to make a dump of the process. AudioAnalyzer-debug-3172978.zip Here is a debug build. It's painfully slow but for the most basic skins like the test one above it should work fine. Make sure to edit the skin file to use this dll, though. Make a dump through task manager when the app crashes, and send it to me somehow.
AudioAnalyzer-debug-3172978.zip
Plugin: Unable to load "AudioAnalyzer-debug-3172978" (error 126) Even though it's recognized in plugins tab. I changed names, used the portable version, different skins, nothing worked.
Here you go. AudioAnalyzer Test_1.1.5.1.zip
So i used this one to make the tests.
However, since you are able to stop the process when this occurs, you should be able to make a dump of the process. Make a dump through task manager when the app crashes, and send it to me somehow.
Without attaching the debugger, rainmeter exists instantly without being able to make a dump file. So i did the same as yesterday and when the error occurred, rainmeter still was available in task manager. So i made the dump file. But that file is over 200Mb (60Mb as .zip ) and that's kinda hard to upload. When i opened it with visual studio i got the following, i hope it helps:
Btw, is there something specific included in the dump file about the error?
Plugin: Unable to load "AudioAnalyzer-debug-3172978" (error 126)
Oh, I didn't realize until now that debug builds also use debug dependencies, which are (very unfortunately) not a part of any public redistributable, and can only be found as a part of visual studio, and you, apparently, have an older version of visual studio than mine, so you don't have some of them.
EDIT: removed part about adding debug libraries to your PC because of the better solution below.
But that file is over 200Mb (60Mb as .zip ) and that's kinda hard to upload
Yeah. Mine are not as big (at least when I used a fresh installation of Rainmeter) but either way they would probably require to use some file sharing service, like google drive or MEGA.
Btw, is there something specific included in the dump file about the error?
They contain the whole state of the application memory.
When debug builds are used, they allow debugger to match this state with the source code. But when release builds are used, dump files are kinda useless. At least I don't know how to get something from them in this case.
Well "Exception thrown at 0x00007FFD3C77E11E (AudioAnalyzer-test.dll) in Rainmeter.exe: 0xC0000005: Access violation reading location 0x0000000000000000. occurred
" told me that something wrong happened in my dll, and there is probably some place where system returned null pointer to me and I didn't expect it.
But not much more.
Earlier i tried to follow your steps but compiling rainmeter or any project in visual studio will fail because i need windows sdk. It takes time to install it and it's kinda big to download, so i left it for another time.
By the way, don't you have any windows SDK installed? Both my project(s) and Rainmeter use certain version, but I believe that there should be nothing specific about these version, so if you change them in project settings to something you have installed then if should build without any issues.
Hmm, on the other hand, I can make the compiler use release dependencies while still allowing debug. This build should run on your system just fine without any additional dlls. AudioAnalyzer-test-3172978.zip
Yeah. Mine are not as big (at least when I used a fresh installation of Rainmeter) but either way they would probably require to use some file sharing service, like google drive or MEGA.
By the way, don't you have any windows SDK installed?
I didn't know they are needed for c++ development on windows, so i didn't install them. I thought all you need is a compiler and you are good to go. Anyway i'll try to install it tomorrow.
AudioAnalyzer-test-3172978.zip
This one makes the error occurs, as expected. But here in visual studio it says:
AudioAnalyzer.pdb not loaded. AudioAnalyzer.pdb contains the debug information required to find the source for the module AudioAnalyzer-debug.dll
Any idea what this is? Sorry for the trouble i caused for you. #w#
Rainmeter.7z
Thank you! Now that I understand what happened I feel very stupid. Though the global issue was that I didn't check for null pointer, in your case the issue was that you don't have a microphone or any other input device, which have to be a really common case so I certainly had to check it.
Any idea what this is?
Well, this is the expected behavior. Debuggable dll has the call stack info but it doesn't have meta-info about source code or something. And since you didn't build it and just used the .dll from me, you don't have it.
Sorry for the trouble i caused for you. #w#
Oh, regardless of what the issue could turn out to be, your help is priceless, because it could happen to anyone. Even if were a bug in windows, there could probably be some workaround. But now that I know that it's a mine fault alone I can't thank you enough for you help!
I will post here a new test build later, to check that I correctly identified the issue. I'll be waiting for your feedback, if you don't mind.
Can you check if this build works? AudioAnalyzer-test.zip
But now that I know that it's a mine fault alone I can't thank you enough for you help!
Thanks for your kindness, i really appreciate it.
Can you check if this build works? AudioAnalyzer-test.zip
Great new!! it works perfectly. Even when i tried to reproduce the issue. I received an error log as expected.
But, umm.. it acts weird.😅 I mean it lags and some handlers work other doesn't. Is it because it's a debug build?
But, umm.. it acts weird.😅 I mean it lags and some handlers work other doesn't. Is it because it's a debug build?
Yeah. Optimization kills debug features, so last 2 test buils are made with all possible performance optimizations turned off. Handlers that don't work are probably that way because of timeout feature I mentioned earlier.
Steps to reproduce: When using Type TimeResampler, set Granularity to some invalid value, like a variable that is not declared, or incorrect math formula.
Update: Same thing happened when i accidentally added a space in
TargetRate
option:... | TargetRat e 244 | Filter none