librelist archives

« back to archive

Re: nREPL instance started by lein repl cannot be instrumented by jvisualvm

Re: nREPL instance started by lein repl cannot be instrumented by jvisualvm

From:
Keith Irwin
Date:
2013-02-14 @ 15:01
I'm able to do the following:

 $ lein repl
 $ jvisualvm &

and connect to the running JVM easily. 

When I run "lein repl" within an actual project, I see two VMs to connect to:

   -m leiningen.core.main repl

and

   -e (do (clojure.core/require (quote clojure.tools.nrepl.server) (quote 
complete.core)) (set! *warn-on-reflection* nil) (clojure.core/let 
[server__4127__auto.....

I'm using:

java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)

on OS X. (Hm. I think I need to update.)

I'm not even sure if it matters, but might you have multiple JVMs in the 
mix somehow?

Keith

On Feb 14, 2013, at 2:46 AM, Marko Topolnik <marko.topolnik@gmail.com> wrote:

> The thing is, jvisualvm doesn't normally require any JVM arguments to 
work. lein run works for me with no configuration, for example. 
> 
> On Thursday, February 14, 2013 3:00:40 AM UTC+1, Sean Corfield wrote:
> I don't know what jvisualvm needs, but I would have expected you could 
> set :jvm-opts in project.clj to provide whatever settings needed for 
> the JVM instance started by Leiningen... 
> 
> -- 
>  
> --- 
> You received this message because you are subscribed to the Google 
Groups "leiningen" group.
> To unsubscribe from this group and stop receiving emails from it, send 
an email to leiningen+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

Re: nREPL instance started by lein repl cannot be instrumented by jvisualvm

From:
Keith Irwin
Date:
2013-02-15 @ 05:12
On Feb 14, 2013, at 12:58 PM, Marko Topolnik <marko.topolnik@gmail.com> wrote:

> Yes, this matches my case. I can connect to both, but the relevant one 
(it's the second one you mention) is severely crippled in what you can get
out of it (I think it's only those functions that don't require JMX). For 
example, you can't run the Sampler, can't see a list of running threads, 
etc.

I gave it another shot. Got this little app I'm working on based on 
compojure. Was just going to try to get away with only using the lein ring
server stuff, but broke down and added in the jetty-ring-adapter.

I can attach to the VM via jvisualvm and see a few of those tell-tale qtp 
threads, a bunch of clojure-agent-send-off-pool threads.

Tried the profiler. Got the stdout dump:

Profiler Agent: JNI OnLoad Initializing...
Profiler Agent: JNI OnLoad Initialized successfully
Profiler Agent: Waiting for connection on port 5140 (Protocol version: 12)
Profiler Agent: Established connection with the tool
Profiler Agent: Local accelerated session
Profiler Agent: 250 classes cached.
Profiler Agent: 250 classes cached.

Eventually, my methods were "instrumented". The :jvm-opts ["-Xdebug"] in 
project.clj seemed to balloon up the number, but that setting was not 
necessary. (I'm no expert with these sorts of tools.)

Sampler worked, too.

Seems in good working order over here.

I don't think I'm using Open JDK, rather, the JDK downloaded from Oracle. 
Is there any real difference between the two? I can take a screencast if 
you think that'll help.

Keith


> 
> On Thursday, February 14, 2013 4:01:59 PM UTC+1, Keith Irwin wrote:
> I'm able to do the following:
> 
>  $ lein repl
>  $ jvisualvm &
> 
> and connect to the running JVM easily. 
> 
> When I run "lein repl" within an actual project, I see two VMs to connect to:
> 
>    -m leiningen.core.main repl
> 
> and
> 
>    -e (do (clojure.core/require (quote clojure.tools.nrepl.server) 
(quote complete.core)) (set! *warn-on-reflection* nil) (clojure.core/let 
[server__4127__auto.....
> 
> I'm using:
> 
> java version "1.7.0_07"
> Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
> Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)
> 
> on OS X. (Hm. I think I need to update.)
> 
> I'm not even sure if it matters, but might you have multiple JVMs in the
mix somehow?
> 
> Keith
> 
> -- 
>  
> --- 
> You received this message because you are subscribed to the Google 
Groups "leiningen" group.
> To unsubscribe from this group and stop receiving emails from it, send 
an email to leiningen+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>