SystemMemoryOutofException-Elasticsearch IndexMany - c#

Im getting this error while indexing documents as an attachment. What can be the reason for this type of error. And why is it behaving differently when I run on server and when I run from visual studio.
More details about the problem is mentioned here.
Please have a look at the below link.
https://discuss.elastic.co/t/systemmemoryoutofexception-thrown-while-indexing-files-as-an-attachment/50916
TIA

I am not confident on where the actual error is ocurring. You need to determine if the error is in .net (on the client side) or in elastic? Both Visual Studio and elasticsearch will get to a point where they break without enough memory (or allocated memory) on the host machine.
If it is in elastic (check the logs - or run in console mode) - increase the heap space.
If it is on the client, try forcing your application in to 64 bit mode.

Related

WinForms app - Unable to read local memory

I'm retrieving the following error in a Windows Forms App (.NET Framework) by debugging execution:
And this different type of error (but in the same method) if I run the compiled exe:
Could the problem be linked to the inability to read the memory? (see the "Locals" panel on the bottom of the first picture) Why is impossible to read it?
I think the problem is memory because in the prevoius 32-bit version the application works fine, so the problem is not writing code. I'm now working at this new 64-bit version because of the 64-bit update of St7API.dll, which is called by the St7 class. I attach a few lines from this class for a better understanding.
Thank you in advance for any answers
Edit:
For other previous lines in the code there are no errors using St7API.dll. The app works fine and the error occur only when is run a specific process, maybe the the heaviest for the memory.
For the using of this API is provided a C# class (image 3) and a "closed" DLL. I add an image to the API guide for a function:

Write variables of TwinCAT 2 PLC via ADS remotely

The reason why I am asking a question is because I am having issues writing variable values of a TwinCAT 2 system remotely (but reading variables works fine).
The setup what I am trying to make working is the following: There is an avreage PC where the I would like run my .NET 6 based application TwinCAT.Ads 6.0.129 included, and the 3.1 4024.29 build of TwinCAT 3 runtime is installed. The remote system an industrial assambly station based on (PC-165552) TwinCAT 2 runtime version 2.11 build 2126. The way why I trying to get acces to the variables of the TwinCAT 2 system is CreateVariableHandle, then use the ReadAny, and WriteAny methods. I tried other ways as well but this looks the easiest for me.
I have tested my code to running a test TwinCAT runtime PLC on my localhost, and get acces to the variables of test runtime. The whole data exchange worked fine I could read and write variables, but somehow if I change to remote and I try to acces to the remote PLC variables I can only read thier values, but not write them.
I tried several ways to indentify the problem. I installed the TwinCAT engineering and tried to analyse the ADS communication via the integrated ADS Monitor tool. I sent a Write Request with the ADS Command test tool to the certain variable but even taught the transfer was succesfull the variable did not changed. I also monitored the process with ADS monitor so I had a possibility to check the conctent of the Request and Response messages and they looked absolutely fine with no error. I studied all the available documentation, but I couldent find anything what could cause the mentioned issue.
Since the C# code works fine on local host, and I cant even write those variables remotely on the given target station even with the built in Beckhoff tools. My conclusion is some sort of settings must be wrong on the TwinCAT 2 target station (maybe firewall or something).
Could you please give me some hints where and what settigns I suppose to look around.
The issue was the certain variable was overwriten cyclically on the remote (PLC) side. Unfortunatelly I did't have acces to the source code of the PLC, therefore I did't have a possibility to verifly it myself.
I was expecting something like that because the I didn't received any error during the write request. So it was succesfull but right after the variable was overwriten.
I just swithed the PLC to stop to stop the porgram execution, and after I tried to write the variable.

Unity WebGL build throws "TypeError: dbg is undefined"

I was messing around trying to save data for a Unity application built for the web in the Application.persistentDataPath. It was appearing to save, but failing to load.
That is, my application would attempt to save and not throw any errors (which I was catching and displaying internally). Although it was not confirming a success either (other notifications display, but neither the confirmed-failure or confirmed-success for saving). Then when loading it would throw a notification for being unable to load the saved data, but have no message/error reason.
Inserting some additional attempts to isolate what was going wrong, suddenly it was failing to start, throwing a TypeError: dbg is undefined which appears to be originating in Unity's export code (i.e. nothing I have control over).
In trying to clear out an leftover data from partial saves, etc. (by using the Firefox developer tools to inspect and modify the indexDB local storage) I have appeared to inadvertently deleted some value that Unity uses and now when I try to run my application (ANY AND ALL Unity webgl applications run from any website or directory are failing for me!) Unity tells me that it was unable to allocate enough memory (and no matter what I do in the publish settings, I cannot make this error go away).
After restarting my machine the errors went away for a few builds, then returned.

GhostScript PS to PDF with images only work during debug mode in Visual Studio

I'm trying to convert a ps file (word file with image) to pdf using Ghostscript.
Everything works fine when I'm debugging my code and just stepping thru it, It generates the pdf with the text,images and whatnot. But when I deploy the app using Visual Studio Setup Project, It does not work and gives me this error "An error occured when call to 'gsapi_new_instance' is made: -100."
Here's my command line arguments
var args = string.Format("-q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=\"{1}\" -c save pop -f \"{0}\"", inputFile, #"C:\MedirefPrinter\converted\out.pdf");
Any idea why this isn't working? Thanks
Actual Code :
File Changed Handler
ShellCommand
Please excuse my noobness :)
Moved to an answer to allow more text.
There are three possible reasons for the error:
1) The 'instance' pointer is NULL. I can't see how this is ever possible with our executable as its a globally defined variable and the executable passes its address. This is a sanity check for people writing code against the Ghostscript API.
2) The application was unable to allocate sufficient memory for some internal structures. Again this seems unlikely as your system would have to be unreasonably short on memory.
3) The DLL instance count is already 1 or greater. This can happen if the DLL is shared between multiple processes. Unless you build the library with GS_THREADSAFE it isn't thread safe, and so you can't have multiple processes using the same instance of the DLL. I'd guess that this is your problem but obviously you haven't supplied a full set of code, so I don't know. If you are trying to run more than one copy of Ghostscript simultaneously, from the same directory, then you will get this error.
error -100 means 'something really bad happened so early on that I can't even tell you what it is'.
I very much doubt that the presence of images in the PostScript has any real impact, except that possibly it may slow the interpretation down enough to cause you to attempt to launch two processes.

Mono/Linux and wininet.dll

I've got a commandline C# program that compiles and runs fine using Visual C# 2010 and Windows 7. It also compiles and starts fine on Linux/Mono (2.10), but then sits there. (The program is using a 3rd party DLL to fetch data from a remote server.)
Running it in the debugger, I saw it seemed to be waiting for a DNS lookup. So I did the DNS lookup for it, pasted in the IP address. But it still hangs, and breaking into the debugger shows three threads all sitting there waiting:
System.Threading.Monitor.Wait (timeout set to -1)
System.Threading.Thread.Sleep
System.Threading.WaitHandle.WaitOne
I used MoMA to analyze the DLL. I'm not sure how accurate that is, because it matches against Mono 2.8, and I'm using 2.10.8.1, but it says Socket.Dispose() is a missing method. Then 32 [MonoTodo] items, 30 of which are Type.op_Equality or Type.op_Inequality. The other two are CredentialCache.get_DefaultCredentials() and MemoryMappedFile.CreateOrOpen().
But what got my attention was, at the bottom of the report, there are two entries for GetWindowsSocksProxy, which turns into SingleServerConnection.InternetQueryOption, and the P/Invoke library is wininet.dll. Could this be related?
So, is there anything I can do? E.g. can I copy that DLL from a windows machine to my linux machine? If so, where do I put it?
P.S. I wondered about connectivity issues. So I made a quick test Mono using WebClient, which worked fine. But one interesting difference is the non-working script loads "/usr/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/Mono.Posix.dll [External]" at the point where it first needs to connect to something. But my WebClient never did that.

Categories