Starting tomcat with SSL causes SIGSEGV, without SSL works - spring-boot

I have a rest API created in Springboot, running on a Ubuntu server, which crashes only when launched with SSL enabled.
I created the keystore using the following command:
keytool -genkey -alias tomcat-localhost -keyalg RSA -keysize 2048 -validity 3650 -keystore keystore.jks
I also set the following configuration:
server.ssl.enabled=true
server.ssl.key-store=[path]/keystore.jks
server.ssl.key-store-password=[password]
server.ssl.key-store-provider=SUN
server.ssl.key-store-type=p12
server.ssl.keyAlias=tomcat-localhost
server.ssl.key-password=[password]
If I comment all the ssl lines, the API launches and I can request via http, but not https (as expected).
When running it in the above mentioned config I get the following error:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f35e2dec9ca, pid=4663, tid=4673
#
# JRE version: OpenJDK Runtime Environment (17.0.5+8) (build 17.0.5+8-Ubuntu-2ubuntu118.04)
# Java VM: OpenJDK 64-Bit Server VM (17.0.5+8-Ubuntu-2ubuntu118.04, mixed mode, emulated-client, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# C [libtcnative-1.so.0.2.21+0x1c9ca] Java_org_apache_tomcat_jni_SSLContext_free+0xa
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E" (or dumping to /var/www/vhosts/jqlifice.
de/barstool/backend/core.4663)
#
# An error report file with more information is saved as:
# [path]/hs_err_pid4663.log
[thread 4664 also had an error]
#
# If you would like to submit a bug report, please visit:
# Unknown
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
This warning is thrown before the crash
WARN 4961 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.sp
ringframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start em
bedded Tomcat server

Related

A fatal error has been detected by the Java Runtime Environment in JMETER

I'm trying to run a test from jmeter using "webdriver sampler" with 1500 users with a ramp-up 60 sec in one hour...
everything is going well, but at one point, for example, 15 minutes later... I get this error
ChromeDriver was started successfully.
Java HotSpot(TM) 64-Bit Server VM warning: Attempt to allocate stack guard pages failed.
Java HotSpot(TM) 64-Bit Server VM warning: Attempt to unguard stack red zone failed.
An unrecoverable stack overflow has occurred.
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_STACK_OVERFLOW (0xc00000fd) at pc=0x000000006671bbfb, pid=12248, tid=0x0000000000000358
#
# JRE version: Java(TM) SE Runtime Environment (8.0_341-b10) (build 1.8.0_341-b10)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.341-b10 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# V [jvm.dll+0x20bbfb]
#
# Failed to write core dump. Call to MiniDumpWriteDump() failed (Error 0x800705af: The paging file is too small for this operation to complete.
)
#
# An error report file with more information is saved as:
# D:\workspace\test\hs_err_pid12248.log
errorlevel=-1073741819
Press any key to continue . . .
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
I use chromedriver headless
This is the command line that I use in jenkins
apache-jmeter-5.5/bin/jmeter.bat -n -t "test.jmx"
jmeter version 5.5
what is the problem and possible cause
also i get this message sometimes in the output
WARNING: Unable to find version of CDP to use for . You may need to include a dependency on a specific version of the CDP using something similar to `org.seleniumhq.selenium:selenium-devtools-v86:4.5.0` where the version ("v86") matches the version of the chromium-based browser you're using and the version number of the artifact is the same as Selenium's.
An unrecoverable stack overflow has occurred
it means that either you have an endless loop somewhere or create a large object which exceeds the thread stack size
The solutions are in:
inspect your code for any loop instances (for, foreach, while) which may fail to exit
increase stack size by passing the relevant -Xss argument
allocate another machine and switch to distributed testing mode with 750 users per machine
In general using Selenium for performance testing is not recommended, it might be a better idea to conduct the main load using JMeter's HTTP Request samplers and use 1-2 threads in another Thread Group running WebDriver Samplers to measure frontend performance, rendering speed, scripts execution time, collecting web vitals metrics and so on.

Spring Boot not loading keystore specified in application.yml

I am attempting to run and test a Spring Boot application that I have packaged into a zip file and unpacked on a Linux VM. The zip contains everything the application needs (at least to my knowledge). When I attempt to execute the application, it starts but quickly fails because it cannot load a keystore needed for SSH/TLS secure communications.
I have the following in my application.yml:
server:
port: 8091
ssl:
enabled: true
protocol: TLS
trust-store-type: JKS
trust-store: classpath:keystore/server.keystore
trust-store-password: <hidden>
key-store-type: JKS
key-store: classpath:keystore/ra/server.keystore
key-store-password: <hidden>
The directory structure on the test system is as follows:
[centos#route-assessor route-assessor]$ ls -R
.:
config elastic-apm-agent-1.10.0.jar lib run-route-assessor.sh services-0.0.1-SNAPSHOT.jar
./config:
application.yml keystore log4j2.xml
./config/keystore:
mp ra rg server.keystore
./config/keystore/mp:
server.keystore
./config/keystore/ra:
server.keystore
./config/keystore/rg:
server.keystore
./lib
<dependency jars>
Here is the exception thrown:
[2019-10-23 13:21:31.419] main WARN : context.AnnotationConfigServletWebServerApplicationContext:557 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Could not load key store 'classpath:keystore/server.keystore'
The Spring Boot "runtime" obviously sees and accesses the config directory, but doesn't seem to see the keystore directory contained within. Do I need to specify the paths differently in application.yml or do I need to put the keystore files somewhere else?
Note: I can run this application with the application.yml configured as shown from eclipse without any problem. Granted, all resources are located in src/main/resources for that situation.
UPDATE:
As per #borban's suggestion, I modified the application.yml as follows:
key-store: file:config/keystore/ra/server.keystore
trust-store: file:config/keystore/server.keystore
That seems to have solved one problem, but I'm not out of the woods yet:
[2019-10-23 15:07:17.671] main ERROR: boot.SpringApplication:821 - Application run failed
org.springframework.boot.web.server.WebServerException: Unable to start embedded Jetty server
...
Caused by: java.lang.IllegalStateException: no valid keystore
...
As far as I know, my keystore files are valid and correct (I've been using them on my Windows development box for months). They are copied over as part of the zip distribution. Is there something maybe I'm missing?
I'm also a little concerned with a few other messages in the log. I'm not sure if they're related, but it seems that they could be:
[2019-10-23 15:07:10.153] main WARN : resource.Resource:126 - java.lang.IllegalArgumentException: URI is not hierarchical
[2019-10-23 15:07:10.155] main WARN : resource.Resource:126 - java.lang.IllegalArgumentException: URI is not hierarchical
I don't recall seeing them before.
Are you are trying to access this keystore outside of the classpath and from the filesystem itself? From the folder structure you are giving, that seems to be the case. If you remove the "classpath" prefix and then update your path appropriately, it should work.
From this post, it looks like you have to prefix with "file"
https://maven.apache.org/plugins/maven-resources-plugin/examples/resource-directory.html
You can use maven resource plugin to add the folders you need to the plugin:
https://maven.apache.org/plugins/maven-resources-plugin/examples/resource-directory.html
then use without classpath??

Staging Error while Pushing a Spring Application to Cloud Foundry

I am getting the following Error while pushing the Sample Hello World spring application on CloudFoundry.
Using manifest file C:\Users\I321571\Desktop\helo\Hello\manifest.yml
Updating app Hello in org trial / space I321571 as I321571...
OK
Uploading Hello...
Uploading app files from: C:\Users\I321571\Desktop\helo\Hello
Uploading 20.1K, 46 files
Done uploading
OK
Stopping app Hello in org trial / space I321571 as I321571...
OK
Starting app Hello in org trial / space I321571 as I321571...
-----> Downloaded app package (12K)
Cloning into '/tmp/buildpacks/java-buildpack'...
-----> Java Buildpack Version: b050954 | https://github.com/cloudfoundry/java-buildpack.git#b050954
[Buildpack] ERROR Compile failed with exception #<RuntimeError: No container can run this application. Please ensure that you've pushed a valid JVM artifact or artifacts using the
-p command line argument or path manifest entry. Information about valid JVM artifacts can be found at https://github.com/cloudfoundry/java-buildpack#additional-documentation. >
No container can run this application. Please ensure that you've pushed a valid JVM artifact or artifacts using the -p command line argument or path manifest entry. Information about valid JVM artifac
ts can be found at https://github.com/cloudfoundry/java-buildpack#additional-documentation.
Staging failed: Buildpack compilation step failed
FAILED
Error restarting application: BuildpackCompileFailed
TIP: use 'cf logs Hello --recent' for more information
this is my manifest.yml
applications:
- name: Hello
memory: 512M
instances: 1
Please help me in resolving the issue.
I encountered this error too!
Make sure the command given is valid
cf push {your-app-name} -p {path to your executable jar}

Sonar - Fail to request server version | HTTP Status 404 /

With each run done by console or by Jenkins throws me the following error:
SonarQube Runner 2.4
Java 1.8.0_51 Oracle Corporation (32-bit)
Linux 2.6.32-504.30.3.el6.i686 i386
INFO: Runner configuration file: /usr/local/sonar-runner/conf/sonar-runner.properties
INFO: Project configuration file: /opt/apps/php-sonar-runner/sonar-project.properties
INFO: Default locale: "es_ES", source code encoding: "UTF-8"
INFO: Work directory: /opt/apps/php-sonar-runner/./.sonar
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 0.042s
Final Memory: 0M/28M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Fail to request server version
ERROR: Caused by: Status returned by url : 'http://xxx.xxx.xx.xxx:9000/api/server/version' is invalid : 404
ERROR:
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Open the URL 'http://xxx.xxx.xx.xxx:9000/api/server/version' in a browser, see if it gives you a 404 error. If so, you need to find the right path to Sonar root on the remote server, maybe 'http://xxx.xxx.xx.xxx:9000/sonar/'?
When you have the full URL of Sonar, update the sonar.host.url property in your pom accordingly. See full documentation for more details.
Check the value of sonar.web.context = /myPath maybe you have some path and you configure other path in your url at your jenkis, tfs, etc. That is the reason you get an 404 error.
In your example you should not have that value configurated or without a value.
'http://xxx.xxx.xx.xxx:9000/myPath/api/server/version
In your sonar-runner.properties file
define #--- Default SonarQube sever as give below
sonar.host.url=http://localhost:9000/sonar
Also cross check in sonar.properties file i.e
sonar.web.port=9000
sonar.web.host=127.0.0.1
sonar.web.context=/sonar

sonarqube OutOfMemoryError (PermGen space)

I use Sonarqube 4.5.1 (new install) with jdk7u55.
Installed on Windows server 2012 (4 GB internal memory)
I get this message in the sonar.log on the server where sonarqube-webserver is installed.
Error occured while clicking in the pages of the webserver of sonarqube
I tried to raise the value wrapper.java.maxmemory= from 32 to 512 to 2048 but OutOfMemoryError keep occuring.
complete error message:
Exception in thread "http-bio-10.2.31.127-80-exec-3" Exception in thread "http-bio-10.2.31.127-80-exec-1" 2014.11.04 14:19:02 ERROR web[rails]
Java::JavaLang::OutOfMemoryError (PermGen space):
Exception in thread "http-bio-10.2.31.127-80-exec-2" 2014.11.04 14:19:06 ERROR web[o.s.s.ui.JRubyFacade] Fail to render: localhost/sonar/drilldown/issues/10000?severity=MAJOR
PermGen space
In app/views/layouts/_breadcrumb.html.erb
As you can read in the "Tuning the Web server" part of the install documentation, the correct place to specify JVM parameters for the Web server is the <install_directory>/conf/sonar.properties file and more specifically the sonar.web.javaOpts property.
Since SonarQube 4.5, the wrapper configuration file is used only to force the path to the Java command.

Resources