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

Add debugging instructions to developer documentation [DOCS] #530

Merged
merged 4 commits into from
Jun 10, 2018

Conversation

tues
Copy link
Contributor

@tues tues commented Jun 9, 2018

It's not that obvious how to run Bloop server directly from sbt and how to enable debugging for forked processes. Hopefully these instructions will save people some time figuring things out.

@tues tues added docs workflow Anything that has to do with the developer workflow. labels Jun 9, 2018
Copy link
Contributor

@jvican jvican left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @tues 💯

> frontend/runMain bloop.Server
```

If you want to be able to stop the server with <kbd>Ctrl</kbd><kbd>C</kbd>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about we add it to the build directly and just tell people they can do CTRL-C to kill it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was actually thinking about that, I guess we might. Usually I add it to my global ~/.sbt/ because I want to be able to cancel any sbt task in any project. Will do.

@jvican
Copy link
Contributor

jvican commented Jun 9, 2018

Did you eventually find out whether our nailgun script supports this? Would be even better to allow JDWP via the installed bloop server.

@tues
Copy link
Contributor Author

tues commented Jun 9, 2018

Did you eventually find out whether our nailgun script supports this?

No, unfortunately it doesn't seem to work. ng.py calls JVM in the following way:

            check_call(["java", "-jar", server_location] + cmd_args)

so it doesn't support adding any options between java and -jar.

Would be even better to allow JDWP via the installed bloop server.

IMO it doesn't make much sense because we want to have the sources in sync with what's running in JVM. I was using it only temporarily because I had some issues running the server from sbt which I solved later. If you do see any value in this though, I can add support for additional JVM options to the Nailgun client 🙂

@jvican
Copy link
Contributor

jvican commented Jun 9, 2018

IMO it doesn't make much sense because we want to have the sources in sync with what's running in JVM.

Do you mean that you don't wanna nuke the server in the background? The way i would do it is that i would spawn another bloop server in another port, and then connect to it from the bloop client so that it doesn't interrrup the other, active and hot bloop server.

If you do see any value in this though, I can add support for additional JVM options to the Nailgun client 🙂

I'm thinking more about normal users trying to debug what's happening. Asking them to clone the repo and do it from the sbt build (which may require importing from intellij or updating the whole build) may be too demanding.

I think it would be great if we make the nailgun script work 😄. We need it anyway to control things like -Xmx and -Xms etc

@tues
Copy link
Contributor Author

tues commented Jun 9, 2018

Do you mean that you don't wanna nuke the server in the background?

I mean I think it's better to have source code available when debugging, and obviously this source code needs to be the same as the one used to build the server being debugged. But sure, we can also make it possible to debug without cloning the repo. I'll open a new issue to improve Nailgun and update the docs when it's done. WDYT?

@jvican
Copy link
Contributor

jvican commented Jun 9, 2018

Ah, I see! Alright, fair point. But I agree that having a ticket for this would be great. I wanna be able to change the jvm options of the bloop server so that I can shove my favorite -XX:MaxInlineLevel=20 into the server 😄

Are you going to update this to include the cancelable setup? Let me know when you want another review!

@jvican
Copy link
Contributor

jvican commented Jun 10, 2018

I added some commits here to add some improvements to the docs and modify the nailgun script, what do you think @tues?

Copy link
Contributor Author

@tues tues left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I wanted to add docs for debugging with Bloop and also debugging only bloop.Cli instead of whole server but I have a lot of other things to do today so would probably do that tomorrow. I have some minor comments but otherwise it looks good 🙂

Edit: Oops, seems I commented on a specific commit instead of whole PR, sorry.


```sh
$ sbt
> frontend/ensimeRunDebug bloop.Server
> set javaOptions in (frontend, run) += "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
> frontend/runMain bloop.Server --config-dir /foo/bar
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is config dir needed for bloop.Server? It is for bloop.Cli, but the server seems to run fine without it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True! Forgot that we were doing server here.

@@ -131,49 +131,82 @@ get stable results.

## Debugging

When analysing a bug, it is often infeasible to rely only on tests. It might be
more convenient to run Bloop and attach a debugger instead.
If you're trying to catch a bug, it might ben convenient to attach a debugger
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/ben/be/

@jvican jvican force-pushed the topic/docs-debugging branch from c3d2975 to f193da5 Compare June 10, 2018 19:16
@jvican jvican merged commit 822267f into scalacenter:master Jun 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs workflow Anything that has to do with the developer workflow.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants