mock-server / mockserver-node Goto Github PK
View Code? Open in Web Editor NEWNode.js module and grunt plugin to start and stop MockServer and MockServer Proxy
License: Apache License 2.0
Node.js module and grunt plugin to start and stop MockServer and MockServer Proxy
License: Apache License 2.0
Full reduced test case: https://github.com/OliverJAsh/mockserver-test/tree/cors
package.json
:
{
"dependencies": {
"mockserver-node": "^5.13.2"
}
}
main.js
:
const ms = require("mockserver-node");
ms.start_mockserver({
serverPort: 3030,
jvmOptions: [
"-Dmockserver.enableCORSForAPI=true",
'-Dmockserver.corsAllowMethods="CONNECT, DELETE, GET, HEAD, OPTIONS, POST, PUT, PATCH, TRACE"',
].join(" "),
});
yarn
node main.js
The Node script prints this error:
Error: Could not find or load main class DELETE,
Caused by: java.lang.ClassNotFoundException: DELETE,
Describe the issue
When starting mock server from node getting the following warnings:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.mockserver.socket.tls.KeyAndCertificateFactoryFactory (file:/Users/uri.brodsky/Dev/ws/toolbox-server/node_modules/mockserver-node/mockserver-netty-5.12.0-jar-with-dependencies.jar) to constructor sun.security.util.DerValue(byte,java.lang.String)
WARNING: Please consider reporting this to the maintainers of org.mockserver.socket.tls.KeyAndCertificateFactoryFactory
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
What you are trying to do
Trying run mock server from nodejs (v16.13.2 ):
MockServer version
"mockserver-node": "^5.12.0",
Actual installed: "version": "5.12.0",
To Reproduce
Steps to reproduce the issue:
mock-server.js
const mockserver = require('mockserver-node'); mockserver.start_mockserver({ serverPort: config.PORT, })
executing the following command: node mock-server.js
Expected behaviour
No to have illegal access warnnings
MockServer Log
Default didn't change
On mockserver-node
v5.3.0 and mockserver-client
v5.3.0, the reverse proxy example under examples folder doesn't work. It dumps errors like this:
java.lang.IllegalArgumentException: 1 error:
- oneOf of the following must be specified "httpResponseTemplate" "httpForwardTemplate" "httpClassCallback" "httpError" "httpObjectCallback"
at org.mockserver.client.serialization.ExpectationSerializer.deserializeArray(ExpectationSerializer.java:110) ~[mockserver-netty-5.3.0-jar-with-dependencies.jar:na]
For the time being, is there any way to workaround that with httpForwardTemplate
property?
Running npm install && npm run test
on my system fails with the following error:
Fetching {"host":"oss.sonatype.org","path":"/content/repositories/releases/org/mock-server/mockserver-netty/5.5.1/mockserver-netty-5.5.1-jar-with-dependencies.jar","port":443,"followAllRedirects":true}
Fetching {"host":"oss.sonatype.org","path":"/content/repositories/releases/org/mock-server/mockserver-netty/5.5.1/mockserver-netty-5.5.1-jar-with-dependencies.jar","port":443,"followAllRedirects":true} failed with HTTP status code 302
Warning: Task "download_jar" failed. Use --force to continue.
Am I missing something here?
I'd like to pull in the latest mockserver version so I can get access to this commit mock-server/mockserver@fd01d18
Is there any simple way to add additional headers to each intercepted requests before forwarding?
Describe the issue
I'm not able to pass multiple values via jvmOptions.
What you are trying to do
I want to pass multiple CORS configuration values via jvmOptions, but as soon as two or more java environment properties are passed, none is correctly evaluated.
mockserver.start_mockserver({
serverPort: 1080,
jvmOptions: "-Dmockserver.enableCORSForAllResponses=true -Dmockserver.corsAllowCredentials=true"
});
I also tried to pass it as a array, but this doesn't work neither.
Possible fix
index.js
if (options.jvmOptions) {
if (Array.isArray(options.jvmOptions) {
commandLineOptions.push.apply(commandLineOptions, options.jvmOptions);
} else {
commandLineOptions.push(options.jvmOptions);
}
}
MockServer version
5.11.2
It doesn't add a callback (mockWithCallback) after a reset.
The server no longer gives any response (it gets stuck "loading" the response")
I'll try to provide more information, let me know what could be useful.
log
2018-07-12 15:05:38,949 INFO o.m.m.HttpStateHandler resetting all expectations and request logs
2018-07-12 15:05:38,994 INFO o.m.m.HttpStateHandler creating expectation:
{
"httpRequest" : {
"method" : "GET",
"path" : "/api/token"
},
"times" : {
"remainingTimes" : 0,
"unlimited" : true
},
"timeToLive" : {
"unlimited" : true
},
"httpObjectCallback" : {
"clientId" : "2f5efa32-65bd-4512-9f97-b041a0f2e701"
}
}
2018-07-12 15:07:05,809 INFO o.m.m.HttpStateHandler request:
{
"method" : "GET",
"path" : "/api/token",
"cookies" : {
"d5b5278d6ecca213a6cda3f6cfaa8cef" : "a396c9685fdd684091487953f02f498e"
},
"headers" : {
"Cookie" : [ "d5b5278d6ecca213a6cda3f6cfaa8cef=a396c9685fdd684091487953f02f498e" ],
"content-length" : [ "0" ],
"Accept" : [ "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" ],
"Upgrade-Insecure-Requests" : [ "1" ],
"Connection" : [ "keep-alive" ],
"User-Agent" : [ "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36" ],
"Host" : [ "localhost:1080" ],
"Accept-Encoding" : [ "gzip, deflate, br" ],
"Accept-Language" : [ "es-419,es;q=0.9,en;q=0.8" ]
},
"keepAlive" : true,
"secure" : false
}
matched expectation:
{
"method" : "GET",
"path" : "/api/token"
}
Extracted from #44 (comment)
Full reduced test case: https://github.com/OliverJAsh/mockserver-test/tree/sigterm
package.json
:
{
"dependencies": {
"concurrently": "^7.2.2",
"express": "^4.18.1",
"mockserver-node": "^5.13.2"
}
}
main.js
:
const ms = require("mockserver-node");
const express = require("express");
ms.start_mockserver({
serverPort: 3030,
verbose: true,
});
const app = express();
app.listen(8080);
yarn
concurrently --kill-others 'sleep 5' 'node main.js'
This command will never complete:
❯ concurrently --kill-others 'sleep 5' 'node main.js'
[1] Skipping {
[1] "host": "oss.sonatype.org",
[1] "path": "/content/repositories/releases/org/mock-server/mockserver-netty/5.13.2/mockserver-netty-5.13.2-jar-with-dependencies.jar",
[1] "port": 443
[1] } as file already downloaded
[1] Running 'java -Dfile.encoding=UTF-8 -jar node_modules/mockserver-node/mockserver-netty-5.13.2-jar-with-dependencies.jar -serverPort 3030 -logLevel DEBUG'
[1] waiting for MockServer to start retries remaining: 110
[1] 2022-06-25 19:51:10 5.13.2 INFO using environment variables:
[1]
[1] [
[1]
[1] ]
[1]
[1] and system properties:
[1]
[1] [
[1]
[1] ]
[1]
[1] and command line options:
[1]
[1] [
[1] logLevel=DEBUG,
[1] serverPort=3030
[1] ]
[1]
[1] waiting for MockServer to start retries remaining: 109
[1] waiting for MockServer to start retries remaining: 108
[1] 2022-06-25 19:51:10 5.13.2 FINE logger level is DEBUG, change using:
[1] - 'ConfigurationProperties.logLevel(String level)' in Java code,
[1] - '-logLevel' command line argument,
[1] - 'mockserver.logLevel' JVM system property or,
[1] - 'mockserver.logLevel' property value in 'mockserver.properties'
[1] 2022-06-25 19:51:10 5.13.2 INFO 3030 started on port: 3030
[1] waiting for MockServer to start retries remaining: 107
[1] 2022-06-25 19:51:11 5.13.2 INFO 3030 retrieved 0 active expectations in json that match:
[1]
[1] { }
[1]
[0] sleep 5 exited with code 0
--> Sending SIGTERM to other processes..
[1] Using port '3030' to stop MockServer and MockServer Proxy
This is due to this SIGTERM
event handler:
Lines 282 to 283 in 6a3200b
As I described in #44, as soon as we register a custom SIGTERM
handler, the default behaviour of killing the parent process no longer applies.
I believe we can remove the custom SIGTERM
handler (like we did for SIGINT
in #44) because by default spawned child processes are killed when the parent receives SIGTERM
. See https://stackoverflow.com/questions/44788013/node-child-processes-how-to-intercept-signals-like-sigint/44931266#44931266.
When I try to start server - I always catch an exception in promise catch block, but then server starts and becomes operational.
10 Seconds is not enough to start java server on MacOS (Sierra 10.12), it needs a little bit more. I have fixed that with setting startupRetries to 200
Please make in configurable
Command I use to start server:
mockServer.start_mockserver({
serverPort: config.port,
verbose: true
}).then(() => {
logger.info(`Mock server started on port [${config.port}]`);
const mockServerClient = mockServer.mockServerClient;
}).catch((err) => {
logger.info(`Unable to start mockServer [${JSON.stringify(err)}]`);
});
I have my gruntfile setup like this:
grunt.registerTask('default', [
'jshint',
'stop_mockserver',
'start_mockserver',
'run:kialimock',
'watch'
]);
and my watch
like this:
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint:gruntfile']
},
lib: {
files: '<%= jshint.lib.src %>',
tasks: [
'stop_mockserver',
'jshint:lib',
'start_mockserver',
'run:kialimock'
]
},
},
So i want that every time a lib is changed, stop and start the mockserver, but it seems to me that the stop_mockserver doesn't wait for the server to stop and i get the following error:
Running "watch" task
Waiting...
Running "start_mockserver" task
Skipping {"host":"oss.sonatype.org","path":"/content/repositories/releases/org/mock-server/mockserver-netty/5.3.0/mockserver-netty-5.3.0-jar-with-dependencies.jar","port":443} as file already downloaded
Exception in thread "MockServer thread for port: 1090" Exception in thread "main" java.lang.RuntimeException: Exception while binding MockServer to port 1090
at org.mockserver.lifecycle.LifeCycle$1.run(LifeCycle.java:102)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:128)
at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:558)
at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1283)
at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:501)
at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:486)
at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:989)
at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:254)
at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:364)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
... 1 more
java.lang.RuntimeException: Exception while binding MockServer to port 1090
at org.mockserver.lifecycle.LifeCycle.bindToPorts(LifeCycle.java:109)
at org.mockserver.proxy.http.HttpProxy.<init>(HttpProxy.java:48)
at org.mockserver.proxy.ProxyBuilder.build(ProxyBuilder.java:54)
at org.mockserver.cli.Main.main(Main.java:109)
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:128)
at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:558)
at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1283)
at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:501)
at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:486)
at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:989)
at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:254)
at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:364)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
at java.lang.Thread.run(Thread.java:748)
Running "run:kialimock" (run) task
Finished reconfiguration the mock server
Describe the feature request
Only print logs of downloadJar
module if verbose or trace options are enabled
What you are trying to do
When the server is statring, the following logs are printed:
Skipping {
"host": "oss.sonatype.org",
"path": "/content/repositories/releases/org/mock-server/mockserver-netty/5.7.0/mockserver-netty-5.7.0-jar-with-dependencies.jar",
"port": 443
} as file already downloaded
I would like that if I do not want any logs, this message will not be printed
The solution you'd like
In downloadJar.js
file, put all console.log into an if conditional where checks if trace or verbose are enabled
Hi,
all buildkite links for related mockserver-* project return a 404 even when I am logged in.
There is a beta feature to make the pipeline public under options -> general.
Could you activate that option please?
When I run my Node process which uses mockserver-node
, it is very slow to start. After some debugging I discovered this is because there are a number of synchronous glob
calls in the form of glob('**/abc
). The **
part was very expensive for us because it was checking every folder in node_modules
which is a huge folder.
To fix this I would suggest changing **
to node_modules/mockserver-node
.
With the 5.4.1 release you changed the name for the passed java system properties to mockerserver-*.jar from systemProperties to jvmOptions:
e2c0a86#diff-168726dbe96b3ce427e7fedce31bb0bcL166
This silently changes and breaks the "API" which led to some time consuming investigations on my side.
It even breaks the behaviour found in mockserver-client-node which depends on the old syntax:
https://github.com/jamesdbloom/mockserver-client-node/blob/11441202cd998a8f3486308973872491dcedc86c/Gruntfile.js#L33
A good fix IMO would be to stick with one solution and add at least a logging message for everyone who uses the wrong option, be it systemProperties or jvmOptions. I can even think of failing instantly if the wrong option is set as this is really bad to find after an update.
To avoid these errors in future releases a function to pass java system properties down to mockserver-*.jar would be very nice.
Cheers
Typescript for the the module mockserver-node, in order to launch mockserver server using TS in strict mode.
I just tried to compile and run mockserver-node with TS in strict mode ( Compiler options : strict : true), and it is not so easy , especially when using cucumber that doesn't take account of added customized types.
The better way should be to have the TS types embedded into module, as the mockserver-client has.
Alternative, should be to have @types mockserver-node available...
Another alternative, to have the mockserver-node included into mockserver- client ( as java version is made ) as this last is typescript ready.
I have a Node process which looks like this:
const mockserver = require("mockserver-node");
const express = require("express");
const app = express();
app.listen(8080);
mockserver.start_mockserver({ serverPort: 1080, verbose: true });
When I run the Node process and then I try to kill the process using ctrl-c
, it kills the mock server but not the Express server. The parent Node process continues to run and no matter how many times I run ctrl-c
it does not quit.
I believe this is because of this line:
Line 273 in ea97b8d
As soon as we register a custom SIGINT
handler, the default behaviour of killing the parent process no longer applies.
At first I thought we could fix this by calling process.exit
ourselves, but this would prevent other SIGINT
handlers from being called which could be significant.
I believe we can remove the custom SIGINT
handler because by default spawned child processes are killed when the parent receives SIGINT
. See https://stackoverflow.com/questions/44788013/node-child-processes-how-to-intercept-signals-like-sigint/44931266#44931266.
Describe the issue
The index.d.ts
that provides the typescript type declarations is missing from the package that is published on the npm registry. This is probably due to the fact that it is missing in the files
property in the package.json
. Adding it there should solve the issue.
What you are trying to do
use the type declarations for mockserver-node
MockServer version
5.15.0
To Reproduce
Try to use mockserver-node
in a typescript project.
Expected behaviour
Type declarations are available.
Describe the feature request
using mock-server node without exposing myself to men in the middle attacks.
I quote https://www.mock-server.com/mock_server/HTTPS_TLS.html
If the configuration setting dynamicallyCreateCertificateAuthorityCertificate is not enabled, and your OS trusts the MockServer CA X.509, then this would leave your machine open to man-in-the-middle attacks because the corresponding Private Key is in the MockServer github repository. This would allow hackers to compromise all sensitive communicates such as to your bank or other sensitive sites.
What you are trying to do
run mock-server-node in the command line using dinamic Certificate. My grunt file:
module.exports = function(grunt) {
grunt.initConfig({
start_mockserver: {
options: {
serverPort: 1080,
trace: true,
jvmOptions: "-Dmockserver.dynamicallyCreateCertificateAuthorityCertificate=true -Dmockserver.directoryToSaveDynamicSSLCertificate=/home/fabrizio/Desktop/mockserver"
}
},
stop_mockserver: {
options: {
serverPort: 1080
}
}
});
grunt.loadNpmTasks('mockserver-node');
};
The result is no private key generated in /home/fabrizio/Desktop/mockserver
and the mockserver uses the key from the github opensource repo https://github.com/mock-server/mockserver/blob/master/mockserver-core/src/main/resources/org/mockserver/socket/PKCS8CertificateAuthorityPrivateKey.pem
2020-11-30 17:44:10 5.11.2 FINEST loaded dynamic CA private key from path
org/mockserver/socket/PKCS8CertificateAuthorityPrivateKey.pem
PEM
-----BEGIN PRIVATE KEY-----
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDxjka3ZME2NR9X
b0D2GgPkaQ/qUm7Lx07VElOh+zUEtqrtabBOkxBtnxPlW9ECF5Hh/o4ys3H8xxgq
SFP9KkAruEVcnKyFuAgnV45fk9y+AtCN0ZiDHIk4oOanAL2PT+W0AHVg5FN+mBqw
oxml90JZ3RsQ/TPe+CXaVSuHKhcnOjeIADp8rN7kvDDJkh040xQIEf1hXiYnIkJ2
pfmcuGRdseugnYzfoT/HIdsh/wgcK0gXNGXh9n5W2BoJIdz8ChKgE6oVWvpn7eHQ
q76gcBoQU58xBliv6q5fcQeJk7OBkP2eRPK185b6Ss1SW3wx36lc4BcOH0BRldFz
C0ysrzl9AgMBAAECggEAAr70TNdnXt9huNO58FJBYxJSrP485jIg0klADCJX6vLM
pKBD8dC4KhbZ2gyeJqDv9pq3MRpbHF2DB9AErGcTjautliztxSNfbFsRckKzCrHr
fwE3852abbteg919SijFWrN6ohxWWqUOAJ4KB5n09iKOUTYfpdQ6Ue4P7Zxr4PVB
zvwLsDjZvco2q6DkKuoO5pLUaUxSeuATtnikOcfZxM+lefdemN0CpgbVZ4xtyefp
kENYaWL3NygSPL422+kdcD0ori/TZpKDua2c/AbsBSOPku5wYHIjYi6gKNwaT17D
M+E8tudk5j9cX6C1/tyOHHHVM20C0gtbAxHaiYGA3QKBgQD5g7GaE7ykaPJ2hSNG
++nMMzMWdxMe6bm2kcMWeVWkQiy8SbK530ul7o3dDb3vWCrfyFcTfq+ZCg7pDw8A
szwm9F7ay1Yr8FXKn4A557EFBolZpugajCA+BDvC39DslOgTD8+IOyRql41C6/32
aQ+2H9mu9HBXCr/o1UG00q/5YwKBgQD31Z/VlGS6x2abDUKUVDM5LqY1j6r5xUrK
7rrJkKHJ2F7xnsmkiDNoAf2uOhw2i7/9CXvYJlNnJducmFRJK5rxu/63ddQnVDrd
vZiQL1Qy6aIqkVRt8XHXrVTDoyRO1kygzNjc26yI8Zk/JmwVkPS6MmRWfJL+N//P
urK0l6nnnwKBgHog2bd+3aDjtXoJpMDD4SYQEXt3gSZqZHpWUlUXwrGJqnfm4tJT
16U6ZLnEVilm0GWEnApwweZ4o9+zfTZshI7UofEaAe2zz2pEM/Ej1OOO1X/KUGVe
HRH95Hp4Lrz+DbH21S/rMuHxmDUfaclIl2YfpN8byjjwjAqdB3JIhdXdAoGAHwz5
yJWeBTTEazq/E7x06n4ovt8wKbkJROGiL2zaiGJ+isE9PEsAPdC6CuEm9cKOnFJa
3Nr4ahz5JeaD8OLwt8a5BB1UJlVMRsnhWndDkllpQvIQZPHyNHZ3/0bqXqJE2YSw
ywMO292BOMNEmXMe5lE39woGlKlJeKpIh43U8LsCgYAKl7GlVA547z0975B2nv4a
YeWzt20plkSyENv2V65DVogY0lKNpMNgttH0+UkZkJ03jFQ8n7EaKzwKhVxhvcg0
tHXNTuAECG7uhT4aLjBUA4KTMNFjsDrSM5RnvM86U6noIrNl0UirJsrIzX/FiBd4
B00j3wnIg+Ix1l+X44GneQ==
-----END PRIVATE KEY-----
The solution you'd like
my impression is that the cli utility used by node does not support the dynamicallyCreateCertificateAuthorityCertificate
option
or it is not documented, additionally I could not identify errors in the log files.
Describe alternatives you've considered
I consider this a feature request, as by my understanding this functionality is not included in this library and their dependencies.
I tried to use the cli utility, but the option is not available or documented.
I am not expert in your project so it is hard for me to find a solution for this issue. I would be thankful if you could help me finding a solution. Thanks
While working with verbose: true
, a mockserver.log
file is created in the directory from which the server was started. Shouldn't there be an option to specify another path for the log file?
Not sure whether this is really a mockserver or a nodemon issue. Please comment and close if this shouldn't have been reported here!
macOS Mojave (10.14.6)
java v13.0.1
node v12.1.0
I'm trying to implement a mockserver and using nodemon to avoid having to restart the server on every change.
It seems to work; however, with every change I'm getting the following error and a hs_err_pidXXXXX.log
file is being created in the root directory.
[nodemon] restarting due to changes...
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x000000010b02858d, pid=13611, tid=775
#
# JRE version: Java(TM) SE Runtime Environment (13.0.1+9) (build 13.0.1+9)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (13.0.1+9, mixed mode, sharing, tiered, compressed oops, g1 gc, bsd-amd64)
# Problematic frame:
# ########SIGUSR2 Received: Shutting Down
V [libjvm.dylib+0x62858d] SR_handler(int, __siginfo*, __darwin_ucontext*)+0x2e
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /path/to/project/hs_err_pid13611.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
#
[nodemon] starting `node ./mockserver/server.js`
Skipping {"host":"oss.sonatype.org","path":"/content/repositories/releases/org/mock-server/mockserver-netty/5.6.1/mockserver-netty-5.6.1-jar-with-dependencies.jar","port":443} as file already downloaded
Running 'java -Dfile.encoding=UTF-8 -Dmockserver.logLevel=INFO -Dmockserver.enableCORSForAllResponses=true -jar node_modules/mockserver-node/mockserver-netty-5.6.1-jar-with-dependencies.jar -serverPort 7070'
I have tried gracefully shutting down the mockserver instance by intercepting SIGUSR2
, but that didn't do the trick:
process.once('SIGUSR2', (code) => {
console.log('########SIGUSR2 Received: Shutting Down');
mockserver
.stop_mockserver({serverPort})
.then(() => {
console.log('SIGUSR2 Received: MockServer Shut Down');
setTimeout(() => {
process.kill(process.pid, 'SIGUSR2');
}, 1000);
});
});
I also tried to at least avoid creating the error log files or placing them somewhere else by setting -XX:ErrorFile
in jvmOptions
, but that didn't have any effect either.
Am I missing something? Any workarounds?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.