JMeter scripts stop working, leaking memory, OutOfSpace Java - java

After last Thursday (can be linked to Windows OS (10 v 1803, OS Build 17134.165) updates) all my JMeter scripts stopped work. I first noticed when all scripts that run in Non GUI mode failed with
Uncaught Exception java.lang.OutOfMemoryError: Java heap space. See log file for details.
I started to test with GUI mode and the log shows these:
WARN c.h.c.r.e.LoggingCSSParseErrorHandler: Browser compliant mode skipped CSS from [1:24125] starting at token 'data' until [1:24143] to token ';' (based on com.helger.css.parser.ParseException: Encountered unexpected token: ":" ":"
at line 1, column 24129.
Was expecting one of:
")" "+" "-" "/" "=" "[" "and" "expression(" "from" "inherit" "not" "only" "or" "to" <ANGLE_DEG> <ANGLE_GRAD> <ANGLE_RAD> <ANGLE_TURN> <CH> <COMMA> <DPCM> <DPI> <DPPX> <EM> <EX> <FR> <FREQ_HZ> <FREQ_KHZ> <FUNCTION> <FUNCTION_CALC> <HASH> <IDENT> <LENGTH_CM> <LENGTH_IN>
<LENGTH_MM> <LENGTH_PC> <LENGTH_PT> <LENGTH_Q> <NUMBER>
<PERCENTAGE>
<PX> <REM> <S> <STRING1> <STRING2> <TIME_MS> <TIME_S> <URANGE> <URL> <VH> <VMAX> <VMIN> <VW>)
I see it on three machines: my local desktop, automation VM on perimeter, and at AWS.
I have:
set HEAP=-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m
I also set:
css.parser.ignore_all_css_errors=true
I also tested that it happens with JMter 4.0 and 3.3. Java 1.8.0_152

First check:
You're not running in GUI mode
You're following best-practices:
https://www.ubik-ingenierie.com/blog/jmeter_performance_tuning_tips/
http://jmeter.apache.org/usermanual/best-practices.html
But if issue persists, add to command line:
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=
Then share using some sharing solution the generated hprof, and if possible your test plan.

I found the problem. It looks as there are several. In my jmx plan I was loading html pages. (We have a Single Web App architecture). Now after dev changed index.html I needed to disable html pages otherwise it blows.
My Test Plans (jmx) started to fail after dev changed index.html. It works correctly from UI perspective and from Selenium scripts. The change looks minor. They moved base tag from outside to inside script tag.
Before:
<base href="/ui/">
<script>
//var HOST = 'http://localhost/';
//var HOST = 'https://ooo.credifi.com/core/';
var HOST = 'https://oo2.credifi.com/core/';
var BASE = '/ui';
</script>
After:
<script>
var isLocalhost = document.location.hostname == 'localhost';
var BASE = isLocalhost ? '' : '/ui';
var HREF = isLocalhost ? '' : 'ui/';
document.write('<base href="/' + HREF + '" />');
</script>

Related

VS code unable to create new cell while using iJAVA that is build on jshell?

I am just a beginner :) Can any one help me out??
When I click the plus sign to create a new cell in a workbook I get an error. The new cell isn't created and I see this error message in a larger than usual font.
The error message survives a restart of the kernel.
The error is gone after I restart VSCode.
The error is also gone after I save / close the file and re-open it.
code
System.out.print("hello jshell");
and then i hit alt + enter
output
hello jshell
TypeError: Cannot read property 'charAt' of undefined at
in t
in div
in t
in div
in t
in div
in t
in div
in div
in div
in div
in div
in div
in t
in h
in t
in div
in div
in div
in t
in main
in div
in t
in h
in f
I am using
VS-code version : 1.51.1
jupyter core : 4.6.3
jupyter-notebook : 6.1.5
qtconsole : 4.7.7
ipython : 7.18.1
ipykernel : 5.3.4
jupyter client : 6.1.7
jshell : 15.0.1
out put screen shot
I've added the java to Jupyter Kernel and with many tests conducted, it's an issue in VS Code:
There're many similar issues posted in GitHub and now, this function is solved in VS Code Insiders but still not in VS Code:
You can install VS Code Insider, but it may not that stable, after all it's the beta-version of VS Code. In another way, you can turn to JupyterLab, try it in browser or install it.

Error:- Cannot index into a null array while installing java

I am trying to install java using powershell Invoke-WebRequest command on packer instance however, I am getting below error;
Cannot index into a null array.
At line:1 char:94
+ ... content | %{[regex]::matches($_, '(?:<a title="Download Java software ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Command;
[Net.ServicePointManager]::SecurityProtocol = "tls12"
$URL = (Invoke-WebRequest -UseBasicParsing https://www.java.com/en/download/manual.jsp).Content | %{[regex]::matches($_, '(?:<a title="Download Java software for Windows .64-bit." href=")(.*)(?:">)').Groups[1].Value}
Invoke-WebRequest -UseBasicParsing -OutFile jre8.exe $URL
Start-Process .\jre8.exe '/s REBOOT=0 SPONSORS=0 AUTO_UPDATE=0' -wait
Few weeks ago I was able to run it successfully but since yesterday getting the above error.
Any advise?
Thanks.
This happens, as there is no such as string as Download Java software for Windows on the web page. Since the regex doesn't match anything, Groups member doesn't exist and you'll get an error about trying to index into a non-existing member.
Either use a web browser's View Source command, or save the content on a text file and view it with Notepad like so,
$cc = (Invoke-WebRequest -UseBasicParsing https://www.java.com/en/download/manual.jsp).Content
Set-Content -Path c:\temp\javapage.txt -Value $cc
notepad c:\temp\javapage.txt
The page loads a bunch of Javascript that generates the actual page seen on a browser.

How to deploy an EAR file to wildfly-17.0.1 server with jboss-cli command using Java code

I want to deploy an ear file to wildfly-17.0.1 server using jboss-cli. I tried to execute the command using Java code but I'm always getting Error, here is my code:
Object instance = ReflectionUtil.getClass("org.jboss.as.cli.CommandContextFactory").getMethod("getInstance").invoke(null);
ctx = instance.getClass().getMethod("newCommandContext",String.class,String.class,char[].class).invoke(instance,"localhost:"+server.getProperty(SERVER_PORT), server.getProperty(SERVER_USER),server.getProperty(SERVER_PWD).toCharArray());
m = ctx.getClass().getMethod("connectController");
m.setAccessible(true);
m.invoke(ctx);
execute(ctx, "deploy " + earPath + projectName + ".ear");
I'm always getting this error :
"failure-description" => "WFLYCTL0158: Operation handler failed: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0"
There is a core utility as part of the wildfly-maven-plugin that can be used to programmatically deploy content. This would likely be a bit friendlier to use than reflection.

python stanford posttager, java command failed after running for some time

I am using stanford posttager toolkit to tag list of words from academic papers. Here is my codes of this part:
st = StanfordPOSTagger(stanford_tagger_path, stanford_jar_path, encoding = 'utf8', java_options = '-mx2048m')
word_tuples = st.tag(document)
document is a list of words derived from nltk.word_tokenize, they come from mormal academic papers so usually there are several thousand of words (mostly 3000 - 4000). I need to process over 10000 files so I keep calling these functions. My program words fine on a small test set with 270 files, but when the number of file gets bigger, the program gives out this error (Java heap space 2G):
raise OSError('Java command failed : ' + str(cmd))
OSError: Java command failed
Note that this error does not occur immediately after the execution, it happens after some time of running. I really don't know the reason. Is this because my 3000 - 4000 words are too much ? Thank you very much for help !(Sorry for the bad edition, the error information is too long)
Here is my solution to the code,after I too faced the error.Basically increasing JAVA heapsize solved it.
import os
java_path = "C:\\Program Files\\Java\\jdk1.8.0_102\\bin\\java.exe"
os.environ['JAVAHOME'] = java_path
from nltk.tag.stanford import StanfordPOSTagger
path_to_model = "stanford-postagger-2015-12-09/models/english-bidirectional-distsim.tagger"
path_to_jar = "stanford-postagger-2015-12-09/stanford-postagger.jar"
tagger=StanfordPOSTagger(path_to_model, path_to_jar)
tagger.java_options='-mx4096m' ### Setting higher memory limit for long sentences
sentence = 'This is testing'
print tagger.tag(sentence.split())
I assume you have tried increasing the Java stack via the Tagger settings like so
stanford.POSTagger([...], java_options="-mxSIZEm")
Cf the docs, default is 1000:
def __init__(self, [...], java_options='-mx1000m')
In order to test if it is a problem with the size of the dataset, you can tokenize your text into sentences, e.g. using the Punkt Tokenizer and output them right after tagging.

Code Signing JavaFX Executable with VBScript, the SignTool errors with Access Denied

Alright so I've finally figured out how to go about code-signing the executable created by the JavaFX Bundler BEFORE (I hope) it is placed by the INNO script into a setup file : There's just one problem :
I've broken myself into pieces trying to resolve this stupid problem but the Access Denied error keeps popping up. This is the VBScript I'm using to try and make this work.
Initially I thought it was a permission error but as I was able to successfully call the script elevated, and still got this error, I can only assume I am mistaken. So...
Can someone please tell me what it is I am doing wrong here?
<?xml version = "1.0" ?>
<package>
<job id="CodeSign">
<script language = "VBScript">
<![CDATA[
WScript.Echo "Setting bElevate to False. . ."
bElevate = false
If WScript.Arguments.Count > 0 Then
WScript.Echo "Arguments.Count > 0"
If WScript.Arguments(WScript.Arguments.Count-1) <> "|" Then
WScript.Echo "Arg N - 1 != ""|"" . . ."
bElevate = true
End If
End If
If bElevate Or WScript.Arguments.Count = 0 Then
WScript.Echo "Elevating . . ."
ElevateUAC
End If
Dim Shell
Set Shell = WScript.CreateObject("WScript.Shell")
Shell.Run "C:\Sign.bat ""Registration Test\Registration Test.exe""", 1, True
Set Shell = Nothing
Sub ElevateUAC
sParams = "|"
If WScript.Arguments.Count > 0 Then
For I = WScript.Arguments.Count - 1 to 0 Step -1
SParams = " " & WScript.Arugments(I) & sParams
Next
End If
Dim objShell
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "wscript.exe", """" & WScript.ScriptFullName & """ """ & sParams & """", "", "runas", 1
WScript.Echo "Elevated . . ."
WScript.Quit
End Sub
]]>
</script>
</job>
</package>
Okay so I found it. This is pretty painful because there's (if I'm using this term in the correct context) "race conditions" here in that if the code signing doesn't finish before you start running the process again, it fails because it can't do anything with the .exe because it's being used by another process.
Turns out as long as your IDE is running in Admin (for Windows anyway) there's no need to elevate your script either.
Anyay, my problem was that the file was being set as Read-Only. VERY annoying but fortunately VBScript allows for you to change a files attributes so it was just a matter of doing that before trying to code-sign it :
<?xml version = "1.0" ?>
<package>
<job id="CodeSign">
<script language = "VBScript">
<![CDATA[
'Set File as Normal. . .
Dim objFSO, objFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("<Relative Path>\<File.exe>")
objFile.Attributes = 0
Dim Shell
Set Shell = WScript.CreateObject("WScript.Shell")
Shell.Run "<Code Sign> ""<Relative Path>\<File.exe>""", 1, True
Set Shell = Nothing
Set objFSO = Nothing
Set objFile = Nothing
]]>
</script>
</job>
</package>
So now, finally, at LONG LAST we have a complete and viable answer to this, evidently very esoteric question that no one but myself has dealt with (or is a very closely guarded secret, I'm not sure which) : How do you code-sign the executable created by a JavaFX bundle before it gets stored?
Create a WSF file with either JavaScript or VBScript (your
preference)
Add the directory in which the file is being stored to the Class Path (for NetBeans you go to Tools -> Options -> Java Tab, select Add Directory next to Class Path, browse to the directory, and add it).
In your WSF file, in the Script section, get the file object and set its attributes to normal (0).
Then Shell.Run your preferred method of code signing applications. 1 is for showing the Code Sign window, True is to make the VBScript wait until it's finished to hopefully avoid a race condition.
The .exe will ALWAYS be stored one directory up from the WSF script file so the relative path is always going to be <FILENAME>\<FILENAME.exe>.
I really, REALLY hope this saves someone a LOT of grief some day...

Categories

Resources