Sonarqube scanner - Java HotSpot(TM) 64-Bit Server VM warning The paging file is too small - sonarqube

I am trying to run the sonar scanner on a docker virtual machine as part of my private Azure DevOps build server and am getting an error with the pagefile not having enough memory to complete the analysis. My docker image is running windows server core 2019 base image with JDK 11.0.13 installed and Sonarqube scanner 5.0.0. The server also has the following environment variables set to try and increase the Java VM size:
JAVA_OPTS="-Xms1024m -Xmx4608m"
SONAR_SCANNER_OPTS="-Xmx4608m"
My image is running with 5GB RAM and monitoring the container is showing that there is plenty of memory still available to use. I have noticed that the first time I run the scan after starting the container it runs fine but each attempt afterwards gets the error:
##[error]Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000789c00000, 703594496, 0) failed; error='The paging file is too small for this operation to complete' (DOS error/errno=1455)
Can someone please help me with why it is failing to allocate around 700MB when there is more than 2GB RAM available.
The versions of everything are:
Azure DevOps agents: 2.194.0
JDK: 11.0.13
Sonarqube scanner extension: 5.0.0
Docker: 20.10.7
Docker base image: dotnet/framework/sdk:4.8-gbt-windowsservercore-ltsc2019

The issue turned out to be related to the JavaXmlSensor detecting some very large xml test files in the test project, it was trying to load them into memory and analyse them causing the out of memory error.
To fix it I added **/*.xml to the sonar.exclusions and also added the same list of exclusions to the sonar.test.exclusions setting.

Related

Jmeter perfmon :EXCEPTION_ACCESS_VIOLATION

I am trying to run a performance test of my server using jmeter perfmon plugin. But I am getting an error as in the following image. I have searched a lot for a solution but couldn't find an answer. I tried setting JVM arguments but it didn't work. Link to error image.How can I get it worked?
INFO 2019-12-30 14:11:25.114 [kg.apc.p] (): Binding UDP to 4444
INFO 2019-12-30 14:11:25.155 [kg.apc.p] (): Binding TCP to 4444
INFO 2019-12-30 14:11:25.161 [kg.apc.p] (): JP#GC Agent v2.2.3 started
INFO 2019-12-30 14:11:37.974 [kg.apc.p] (): Accepting new TCP connection
INFO 2019-12-30 14:11:37.978 [kg.apc.p] (): Yep, we received the 'test' command
INFO 2019-12-30 14:11:37.979 [kg.apc.p] (): Starting measures: memory: cpu:
A fatal error has been detected by the Java Runtime Environment:
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000010014ed4, pid=12236, tid=6844
JRE version: Java(TM) SE Runtime Environment (11.0.4+10) (build 11.0.4+10-LTS)
Java VM: Java HotSpot(TM) 64-Bit Server VM (11.0.4+10-LTS, mixed mode, tiered, compressed oops, g1
gc, windows-amd64)
Problematic frame:
C [sigar-amd64-winnt.dll+0x14ed4]
No core dump will be written. Minidumps are not enabled by default on client versions of Windows
An error report file with more information is saved as:
E:\\hs_err_pid12236.log
If you would like to submit a bug report, please visit:
http://bugreport.java.com/bugreport/crash.jsp
The crash happened outside the Java Virtual Machine in native code.
See problematic frame for where to report the bug.
I downloaded another sigar 1.6.4 jar (1.6.4.129 (17.1.2016) release) from below link and replaced sigar jar with this in specific tool lib path (ServerAgent-2.2.3\lib).., then it worked for me.
https://javalibs.com/artifact/org.hyperic/sigar
Looking into JVM crashes occassionally with access violation when using Sigar.getProcMem with disabled Windows performance counters #77 issue it might be the case that Windows don't have performance counters enabled hence Sigar fails to query the CPU status from Windows PerfMon
Check if CPU (and other stats) are exposed in PerfMon
Try running Powershell and Server Agent as Administrator
Try using cmd.exe interpreter instead of powershell
Try running ServerAgent.bat --sysinfo to see if there are any errors there
Inspect e:\hs_err_pid12236.log file for any clues
If nothing helps be aware that you can use SSHMon plugin for server monitoring, it doesn't require server-side software installation
I faced the same issue. Error code as follows:
"JRE version: OpenJDK Runtime Environment (11.0+28) (build 11+28)
Java VM: OpenJDK 64-Bit Server VM (11+28, mixed mode, tiered, compressed oops, g1 gc, windows-amd64)
Problematic frame:
C [sigar-amd64-winnt.dll+0x14ed4]"
I downgraded the JDK and JRE to the version : 8u241
Go to the Oracle download page here and search for the below JRE & JDK and install it in the Windows server and then start the serverAgent.bat
jdk-8u241-windows-x64.exe
jre-8u241-windows-x64.exe
This should fix the issue 100% sure. It worked for me.
Follow the below step.
Disable firewall setting
if still having same issue
Download the below .dll file and replace it(lib folder)
https://github.com/cnstar9988/sigar/raw/master/sigar-amd64-winnt.dll
It was solved at my end using the below steps:
Download ‘jre 1.8’ from this link https://java.com/en/download/win10.jsp
Once the jre is installed, copy the folder named ‘jre1.8.0_261’.
Image
Visit the ServerAgent folder that was downloaded >> Paste the ‘jre1.8.0_261’ folder inside the ‘ServerAgent-2.2.1’ folder.
Open ‘startAgent.bat’ file in Notepad ++ >>Initially it would look like this
Image
Replace text ‘java’ with the path of java.exe that is within the jre folder placed inside the ServerAgent-2.2.1 folder
Open command prompt in the ServerAgent-2.2.1 folder path and enter ‘startAgent.bat’ file to run the file
Execute JMeter script and now error should not happen.

JVM running out of memory in Bamboo

I'm facing an issue.
Currently running a build, in On-Demand Bamboo server in AWS, I'm getting an error and the log says:
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory.......failed; error='Cannot allocate memory' (errno=12)
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map XXXXX bytes for committing reserved memory."
Does anyone know how can I allocate memory to Bamboo, since is hosted in AWS? (I do not have much experience with both)
Thank you.
Did you ever solve this? I would start by checking the memory usage (free -m) and then try running the build outside of Bamboo, to see if that work as expected.
You can also update the setenv.sh file in the bamboo bin directory to add memory options. Update the JAVA_OPTS with some reasonable values, e.g. -Xmx768m -Xms512m, that makes sense for your build projects.

import neo4j database from windows to ubuntu

I have created a neo4j database on my windows machine.
I have transferred the content of the database directory to my linux machine. This is because I have the community edition which does not support the backup functions.
mtt#mttPC:/var/lib/neo4j/data/log$ sudo service neo4j-service start
WARNING: Max 1024 open files allowed, minimum of 40 000 recommended. See the Neo4j manual.
WARNING! You are using an unsupported Java runtime.
* Please use Oracle(R) Java(TM) 7 to run Neo4j Server. Download "Java Platform (JDK) 7" from:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
* Please see http://docs.neo4j.org/ for Neo4j Server installation instructions.
Using additional JVM arguments: -server -XX:+DisableExplicitGC -Dorg.neo4j.server.properties=conf/neo4j-server.properties -Djava.util.logging.config.file=conf/logging.properties -Dlog4j.configuration=file:conf/log4j.properties -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled
Starting Neo4j Server...WARNING: not changing user
process [21498]... waiting for server to be ready..... Failed to start within 120 seconds.
Neo4j Server may have failed to start, please check the logs.
The file messages.log in the database directory says nothing.
Any idea? Are the windows and linux neo4js compatible? Thank you.
Edit
I have made a fresh install of neo4j on my ubuntu machine.
Now I finally get some logs:
2014-05-16 20:01:10.958+0000 ERROR [o.n.k.EmbeddedGraphDatabase]: Startup failed: Component 'org.neo4j.kernel.impl.transaction.XaDataSourceManager#25984c63' was successfully initialized, but failed to start. Please see attached cause exception.: Component 'org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource#3d34dcb' was successfully initialized, but failed to start. Please see attached cause exception.: 'neostore' has a store version number that we cannot upgrade from. Expected 'NeoStore v0.A.0' but file is version 'NeoStore v0.A.2'.
2014-05-16 20:01:10.958+0000 INFO [o.n.k.EmbeddedGraphDatabase]: Shutdown started
I should be related to this but I am not sure how to proceed. Is the issue related to the fact that when I copied the database, I just stopped neo4j on my windows machine from the neo4j window?
There is no reason why a Neo4j database should not be transferable between operating systems. Can you please provide the output of data/log/console.log? First thought is that you may have permission issues. The files should be read/write for the user the Neo4j process will run as.

Running a play framework app in Amazon EC2 micro instance

I have a really basic play! app which simply handles a couple of normal GET and POST requests and talks to a MySQL database, nothing fancy.
I ran play dist and transferred the zip file to my EC2 instance. After unzipping it, going to the bin folder and running ./myapp, I get a message:
Java HotSpot(TM) 64-Bit Server VM warning: Info: os::commit_memory ... error='Cannot allocate memory' (errorno=12)
There is insufficient memory for the Java Runtime Environment to continue.
I'm running Play version 2.2.1 and this instance has about 512MB of ram, with the 64-bit version of the Oracle JDK. Is this not enough to run a play! app or am I missing something?
Thanks.
Play Framework 2.3 now has a nifty little feature.
$ /path/to/bin/<project-name> -mem 512 -J-server
Shoule get the job done.
Read http://www.playframework.com/documentation/2.3-SNAPSHOT/ProductionConfiguration
Specifying additional JVM arguments
You can specify any JVM arguments to the start script. Otherwise the default JVM settings will be used:
$ /path/to/bin/ -J-Xms128M -J-Xmx512m -J-server
As a convenience you can also set memory min, max, permgen and the reserved code cache size in one go; a formula is used to
determine these values given the supplied parameter (which represents maximum memory):
$ /path/to/bin/ -mem 512 -J-server
Using play 2.2.1 I had to run play dist to generate the zip file. Then I copied that to the aws instance.
Once there, I extracted the zip and changed the executable file:
from:
local mem=${1:-1024}
to:
local mem=${1:-512}
That did it for me. I got the idea from here but I didn't want to just delete the logic they had there, so I just reduced the default value.
Also please note that on aws ec2 micro:
$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.14) (amazon-65.1.11.14.57.amzn1-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
So you have to use the same Java JDK when runnin play dist.
EDIT:
I updated java to openjdk 7 and was able to run the sample play applications without any errors.

java.lang.OutOfMemoryError: PermGen space with tomcat7 windows service

i am running tomcat 7.0.33 on windows server 2008 R2
(i installed tomcat as windows service)
JDK version: jdk1.6.0_25 64-bit
Tomcat options:
Java Virtual Machine: C:\Program Files\Java\jre6\bin\server\jvm.dll
(BTW, i don't have client folder inside jre)
Initial memory pool: 1000 MB
Maximum memory pool: 2000 MB
when i check the server status, i can see that the server is using
the memory i configured.
Environment Variables (SYSTEM VARIABLES) Configuration:
JAVA_HOME: C:\Program Files\Java\jdk1.6.0_25
Path: ...;%JAVA_HOME%\bin;....
do i need to add CATALINA_HOME and JAVA_OPTS system variables too ?
ISSUE: i have two web applications APP1,*APP2*
when i deploy each one separately, i can find that memory use for
APP1= 198 MB
APP2= 104 MB
Information about the applications:
APP1,APP2: Spring Maven applications that includes in the libraries other small maven spring applications.
APP1: contains webservices, that APP2 uses them.
if i tried to deploy both of them on same tomcat instance, i always get
java.lang.OutOfMemoryError: PermGen space
please advise what might be causing this issue.
the solution was beside setting initial & maximum memory pool, is to add -XX:MaxPermSize=1000m to the java options in the java tab.
You probably need to set/increase the MaxPermSize setting for your Tomcat instance. Note that the MAVEN_OPTS have nothing to do with Tomcat, those are options for the Maven command-line process (mvn). The fact that your application is a "maven" application means nothing at run-time as Maven is not involved in the running of your application, only the building of it.
In the \bin folder in your tomcat installation, there should be an application called "tomcat7.exe". You can use this to update the settings for your tomcat service.
Try something like
tomcat7.exe //US//[name of your tomcat service] --JvmOptions=-Xmx2g
-Xms1g -XX:MaxPermSize=512m
Edit: above statement should be on one line, not two...
I had a similar problem as our app run on Tomcat without problems when Tomcat run standalone and we kept getting permgen out of memory exceptions when running Tomcat as a service.
I found a solution simillar to the one of Pap. You need to access the Tomcat service configuration GUI by running bin/tomcat7w.exe //ES//name_of_service. There you go to the Java tab and set respective java properties directly - e.g.
-XX:MaxPermSize=1000m
Here is a blog post which helped me a lot explaining what all Tomcat settings are ignored by Tomcat when running as a service.
http://www.12robots.com/index.cfm/2010/10/8/Giving-more-memory-to-the-Tomcat-Service-in-Windows
You need to increase PermGen space. Add something like -XX:MaxPermSize=128m to your parameters (you can reserve more perm gen space if you want to). The -Xmx and -Xms settings are for heap whereas here you're running out of PermGen space which is administered separately.

Resources