Fork me on GitHub
#cider
<
2019-08-20
>
quest19:08:40

In a really bizarre situation where giving a shadow-cljs project -Xmx4G in project.clj causes only M-x cider-jack-in-cljs to fail about half the time. Values of 1G or 2G are 100% stable, as is running via lein dev Is there a memory ceiling cider automatically sets & causes a self-kill? Part of the Emacs max memory setting? šŸ¤”

dpsutton19:08:03

CIDER is pretty transparent in just formatting a call to your existing tooling. Check *Messages* buffer for the exact command its running

quest19:08:39

I can find

[nREPL] Starting server via /usr/local/bin/npx shadow-cljs -d nrepl:0.6.0 -d cider/piggieback:0.4.0 -d cider/cider-nrepl:0.21.1 server...
But in the "self-kill" scenario (REPL suddenly closes with a shutting down.. message from shadow-cljs), I can't find any exception or errors to indicate why

thheller19:08:11

@dpsutton the question is whether emacs does anything else to monitor or limit the process in any way

thheller19:08:38

it is started just fine but for some reason the process is killed when reaching a certain memory limit (and that is not shadow-cljs killing itself)

thheller19:08:51

The shutting down ... message is produced by shadow-cljs when the JVM Runtiome.addShutdownHook thread is triggered

dpsutton19:08:58

No monitoring as far as Iā€™m aware

dpsutton19:08:20

You can toggle nrepl-toggle-message-logging to see all the messages going back and forth

thheller19:08:57

@quest on windows this was caused by someones anti-virus before. might also be something like that

dpsutton19:08:32

its a subprocess of emacs right? Possible the os is mad at emacs and refusing to allocate memory?

quest19:08:36

I'll play around with some OSX Java options & other features to see if it affects it. *Messages* output for a autokilled run:

[nREPL] Starting server via /usr/local/bin/npx shadow-cljs -d nrepl:0.6.0 -d cider/piggieback:0.4.0 -d cider/cider-nrepl:0.21.1 server...
[nREPL] server started on 8777
[nREPL] Establishing direct connection to localhost:8777 ...
[nREPL] Direct connection to localhost:8777 established
Visit ā€˜ā€™ in a browser? (y or n) n
[nREPL] Connection closed unexpectedly (connection broken by remote peer)
(for completeness, at the REPL)
[:app] Configuring build.
[:app] Compiling ...
shutting down ...
user> 
*** Closed on Tue Aug 20 12:44:25 2019 ***

dpsutton19:08:47

and running /usr/local/bin/npx shadow-cljs -d nrepl:0.6.0 -d cider/piggieback:0.4.0 -d cider/cider-nrepl:0.21.1 server from a command line behaves differently?

dpsutton19:08:14

and the messages i'm talking about look like

(<--
  id         "96"
  session    "4448d1f0-b245-4a5d-81bd-4e710146a672"
  time-stamp "2019-08-20 14:49:56.258862000"
  docstring  "Returns the sum of nums. (+) returns 0."
  eldoc      (nil
 ("x")
 ("x" "y")
 ("x" "y" "&" "more"))

  name       "+"
  ns         "cljs.core"
  status     ("done")
  type       "function"
)
(<--
  id         "97"
  session    "4448d1f0-b245-4a5d-81bd-4e710146a672"
  time-stamp "2019-08-20 14:49:56.259385000"
  docstring  "Returns the sum of nums. (+) returns 0."
  eldoc      (nil
 ("x")
 ("x" "y")
 ("x" "y" "&" "more"))

  name       "+"
  ns         "cljs.core"
  status     ("done")
  type       "function"
)

quest19:08:22

hmm, behaves the same -- ran it, then used M-x cider-connect-cljs & specified app as per usual. same REPL output (shutting down ...), though I get a java.net.SocketException: Socket closed at the console

quest19:08:54

found the buffers with the extra messages, will paste them in a sec

dpsutton19:08:24

well i think you've found its not CIDER related. just running from command line and viewing the app causes the shutdown?

quest19:08:56

for the M-x cider-connect-cljs command line run

dpsutton19:08:03

try running from command line and connect from browser. if it fails, remove cider/cider-nrepl and rerun. if it fails then its not CIDER's fault. not sure from your message if you've tried that or not

quest20:08:56

Running with /usr/local/bin/npx shadow-cljs watch app still produces a kill

> /usr/local/bin/npx shadow-cljs watch app
shadow-cljs - config: /Users/quest/repos/ns/browser/shadow-cljs.edn  cli version: 2.8.46  node: v12.8.0
shadow-cljs - running: lein run -m shadow.cljs.devtools.cli --npm watch app
shadow-cljs - HTTP server available at 
shadow-cljs - HTTP server available at 
shadow-cljs - server version: 2.8.45 running at 
shadow-cljs - nREPL server started on port 8777
shadow-cljs - watching build :app
[:app] Configuring build.
[:app] Compiling ...
[:app] Build completed. (608 files, 1 compiled, 0 warnings, 4.10s)
shutting down ...
Worker shutdown.
running lein dev reliably works with 4G, and it's configured as so under :aliases
"dev"  ["with-profile" "dev" "run" "-m" "shadow.cljs.devtools.cli" "watch" "app"]
still confused but leaning away from this being cider related -- thanks for the help @dpsutton

dpsutton20:08:24

ah, nothing in your npx call uses the lein dev profile

dpsutton20:08:33

so you are missing any way to set the jvm options

dpsutton20:08:00

> This is done by configuring :jvm-opts at the root of shadow-cljs.edn expecting a vector of strings. can you try here?

dpsutton20:08:22

@quest without lein there's no jvm setting if i'm following correctly

quest20:08:58

No effect on setting it to values of 4G or 1G -- process still reliably shutdown on init