Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nREPL support, possibly via sockets #7

Open
timmc opened this issue Oct 18, 2014 · 11 comments
Open

nREPL support, possibly via sockets #7

timmc opened this issue Oct 18, 2014 · 11 comments

Comments

@timmc
Copy link

timmc commented Oct 18, 2014

On top of #6 I'm also considering adding nREPL support so that I can get a couple of benefits:

  1. attach an external client (lein repl, emacs, etc.)
  2. get line-editing superior to rlwrap
  3. have a persistent session (optional)

If I make a persistent session there's some trickiness; opening a port is dangerous since it allows users other than root and the one who launched the JVM to send commands to it, so I'll probably be using domain sockets or fifos or similar instead.

Would this be a feature you'd consider accepting a PR for?

@djpowell
Copy link
Owner

Great I'll take a look when I get the chance.
I have a branch (offline) that I started on ages ago, where I tried making it run under lein, and also got rid of the socket repl and made it inject nrepl server, and then use reply as the client.
So I'll try and work out where I got with that too.

@timmc
Copy link
Author

timmc commented Oct 24, 2014

We have a fork at work that uses lein for building. I'm planning on polishing that up and pushing it to a public place. What I'm thinking at this point is that there would be a total of three artifacts: The client/main jar (complete with options parsing), the agent jar, the server jar, and a tarball. The script would be eliminated, but a sample one would be provided that would pass the right options to the client jar for development mode.

I think people's needs vary quite a bit in terms of deployment; at work it's much easier to pull jar files from a Maven repository and have our own variant on the shell script anyhow. One change we made was the addition of a -F (force) flag that you have to pass; if you don't include it, you get a scary warning about using liverepl carefully and the script exits. (Liverepl causes a classloader to leak on each invocation under certain circumstances which we haven't yet figured out, but it might involve Hibernate. Whenever we use it for debugging, we bounce the server afterwards to avoid permgen exhaustion.) We could implement that as a wrapper around liverepl.sh, but at this point we don't, and that works fine.

@djpowell
Copy link
Owner

I'll push my v1.2 branch soonish, that sounds vaguely similar - it moves to having a lein plugin, and separate dependencies on the client, server, and agent.

In the meantime it is here: https://bitbucket.org/djpowell/liverepl/src/37778f65282e00436c1ff38ef199fd23c432b47d?at=1.2-alpha

@djpowell
Copy link
Owner

Btw, for tracking classloader leaks, jvisualvm has a button called Heap Dump on the Monitor tab.
This opens up an explorable UI that you might be able to use to find one of the liverepl classes, clojure classes, or classloader, and then you can follow the references to see where it is being hung on to from.

@timmc
Copy link
Author

timmc commented Oct 24, 2014

I don't think I have access to the bitbucket link.

I just pushed our changes to a public repo: https://github.com/brightcove/liverepl -- this incorporates the changes I was making on timmc/liverepl as well as some internal changes.

The group and artifact change to com.brightcove.___ but that was just because we had a private fork; if public development continues, it would make sense to switch back to your group and artifact IDs.

Here's the big change I pushed today: brightcove@c32d56e -- obviously, feel free to grab anything useful.

ETA: Oh, and my big plan: Add GNU getopt to the client so that it can take multiple paths to extra jars, incorporate nREPL client, etc.

@timmc
Copy link
Author

timmc commented Oct 27, 2014

Ah whoops, I had missed the bitbucket invite link. I'll take a look today.

@timmc
Copy link
Author

timmc commented Apr 27, 2015

Would you be able to go ahead and push the v1.2 branch to a public place? I may be able to work on my fork of liverepl some this week, and it would be nice to refer to those commits publicly.

@djpowell
Copy link
Owner

Hi, Thanks for looking at this - sounds great - I'll try to push them across to github as-is, so you can reference them from there...

@djpowell
Copy link
Owner

@djpowell
Copy link
Owner

lein sub install - to deploy the artifacts locally;
then add [lein-liverepl "1.2.0-SNAPSHOT"] to your plugins, and you should be able to run lein liverepl

@timmc
Copy link
Author

timmc commented May 4, 2015

Thanks! I ended up not getting a chance to work on liverepl this week, but this will be good for the next time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants