mock-server/mockserver-node

Error when developing with nodemon

ma7moudat opened this issue · 1 comments

Not sure whether this is really a mockserver or a nodemon issue. Please comment and close if this shouldn't have been reported here!

Environment:

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?

closing due to inactivity