Fork me on GitHub
#boot
<
2017-04-25
>
pandeiro00:04:02

@ag Yeah that should be fixed in 0.8.0 - if you try it, please report back

ag00:04:46

yeah, I’m trying but I can find how it supposed to work ;(

pandeiro00:04:06

@ag It shouldn't require anything -- once the task exits, the server should be shut down gracefully now, freeing up the port

ag00:04:41

but how do I force “exit” the task like this:

(deftask dev
  "Main build task for the local development"
  []
  (comp
   (dev-env)
   (npm-install)
   (sassc)
   (watch)
   (serve :reload true)
   (notify :audible true :theme "woodblock"
           :visual true :title "finops-admin")
   (reload :on-jsload 'finops-admin.app/init)
   (cljs-repl)
   (cljs)))

pandeiro00:04:30

How are you calling that task?

pandeiro00:04:59

Doesn't that block your REPL?

ag00:04:26

it doesn’t… so if I run it in terminal, like $> boot repl and then (boot (dev)) - I think then it would

pandeiro00:04:54

I'm not sure how cider is running that -- have you ever been able to stop that task?

pandeiro00:04:22

ie, it seems like the question is more about how to stop a task autostarted by cider, rather than specific to boot-http?

ag00:04:28

if I have a non blocking task e.g. (future (boot (dev)) then restarting it shouldn’t be a problem, no?

ag00:04:56

If I run it again, it should work, right? but serve has to restart jetty, how do I force it?

ag00:04:37

it seems even when it’s blocking: I press C-c - it says Stopping jetty, I would start the task again (blocking fashion (boot (dev)) - it’s blocking because watch is blocking. It still would complain: Java.net.BindException: Address already in use

pandeiro00:04:34

Yeah, I think there was a bug that was keeping Jetty from actually being stopped. Like I said, try 0.8.0 -- should be fixed.

ag00:04:29

I’m talking about [pandeiro/boot-http “0.8.0”]

ag00:04:49

would it be possible to expose stop-server, so it could be explicitly stoped?

pandeiro00:04:19

@ag I just tried exiting with C-c C-c and I'm able to re-run the serve task again from the REPL

pandeiro00:04:36

I do see a java.lang.InterruptedException thrown from Jetty though, not sure what's up with that

pandeiro00:04:50

So it exits properly (ie, jetty exits, port is released) if I do (boot (serve))... But if serve is part of a pipeline, such as (boot (comp (serve) (wait))), there is that exception and the boot process seems to go into some kind of loop, pegging multiple cores 😕

bhagany00:04:41

Hrm. That's interesting.

bhagany00:04:32

I'm going to poke around at that a bit

ag01:04:40

My attempts of stopping and restarting the task I posted previously aren’t sucessfull

ag01:04:13

although it does say “stopping Jetty”

bhagany01:04:44

@ag if I do two C-cs, it stops. It throws the exception each time, but hey, it stops

bhagany01:04:18

@pandeiro regarding the exception, it looks like jetty thinks it's in the middle of serving requests for some reason. still working on that

bhagany01:04:19

@ag C-c doesn't work?

bhagany01:04:38

I don't see anything wrong with your task

ag01:04:29

it says “stopping Jetty”, I start the task again, it says: Address already in use

bhagany01:04:30

if it gets to the point of printing that output, I don't see how it wouldn't be calling the stop fn

bhagany01:04:44

the exception also seems to be cider-related. boot serve wait on the command line exits cleanly when interrupted

bhagany01:04:09

maybe it always did, though

ag01:04:53

I’m not trying in cider, trying in terminal

ag01:04:54

I’ve tried (boot (comp (serve)(wait))) - it worked. But how do I stop it when it starts “non-blocking”, e.g. $> boot serve wait repl?

bhagany01:04:57

In that case, I don't think you can stop it without also stopping the repl

ag01:04:41

That’s my point - that’s what I’ve been asking for quite sometime: Is it possible to somehow stop the jetty server? or expose the jetty server (so it can be explicitly stopped) that serve runs?

bhagany01:04:39

okay, I haven't followed you until now, I thought you were restarting the whole task. I'm not sure what you want to do fits with the boot model

bhagany01:04:17

I don't really see how boot-http could expose the jetty server in the way that you'd need

bhagany01:04:27

granted, I've thought about it for all of a minute

pandeiro01:04:43

I'm not sure I see a good way, either -- but I also don't understand why you'd want to restart Jetty -- is it just to pick up on changes?

pandeiro01:04:03

@bhagany interesting yeah that exception only happens at the REPL

ag01:04:11

serve task technically is the only reason right now preventing me from staying in the repl all the time - repl still needs to be restarted from time to time

pandeiro01:04:43

@ag what does restarting the server accomplish?

ag01:04:47

If I add a dependency I have to restart my main build task: dev, I can’t restart it because of serve

pandeiro01:04:51

hmm, a clojure dependency?

pandeiro01:04:36

if it's a a clojure or clojurescript dep, you should be able to call (merge-env! :dependencies '[[my/new-dep "0.1.0"]]) and further iterations of the task loop should see it

pandeiro01:04:05

@bhagany it seems repl-related, but not cider-related (i was able to produce exception at a vanilla boot repl)

bhagany01:04:47

same, I had just tried that. Still references nrepl though... I'm trying to figure out a way to start a repl without involving nrepl, if that's possible...

bhagany01:04:18

I think that's going to take a lot of ceremony, might not be worth it

ag01:04:25

oh shit… I think I was able to completely restart it…

bhagany01:04:32

well that's interesting

ag01:04:36

I’m not sure about (boot (cleanup))

ag01:04:50

but it’s stopping it

ag01:04:56

¯\(ツ)

ag01:04:01

well… cleanup is not doing anything here. Turn out calling (boot) by itself stops Jetty

ag01:04:11

could this be a completely new problem now?

bhagany01:04:41

no... wait, nevermind

bhagany01:04:05

backing up a step, my hypothesis is that that finally never gets called

bhagany01:04:33

calling (boot) again does call the finally, which stops the server

ag01:04:06

so that’s normal?

bhagany01:04:44

I'd say it's pretty odd for a finally not to get called

bhagany02:04:41

I would like to explore what the command line entry point is doing differently from the boot fn, but I'm having trouble finding where that's implemented

bhagany02:04:14

I am wrong about this... do-cleanup! is in fact called

bhagany02:04:17

new hypothesis: the SIGINT is killing Jetty via a path that's not the finally clause in the boot fn. That path is faster than finally, and so when the finally triggers, it finds that it can't connect to Jetty in order to stop it, and throws

bhagany02:04:39

however, if that's correct, I have no idea how to track down that faster path

bhagany02:04:12

tl;dr - await throws InterruptedException if the thread has already been interrupted

bhagany02:04:55

if anyone has any idea what to do about that, I'm all ears

richiardiandrea02:04:26

haven't followed the discussion, but InterruptedException is the Java way to give a chance to a thread to stop cleanly, so it can be thrown at any point in time: a relevant blog post here: http://www.yegor256.com/2015/10/20/interrupted-exception.html

richiardiandrea02:04:34

dunno if it is helpful actually

bhagany02:04:21

can't hurt 🙂

bhagany02:04:31

I'll read it after I'm done trying the dumbest thing possible

bhagany03:04:00

alas, neither the article nor the dumbest thing possible has given me any insight

pjullah08:04:31

@jjmojojjmojo thanks I'll take a look.

samestep11:04:34

@pjullah If you run into any problems with boot-refresh, let me know

pjullah11:04:50

@samestep will do, thanks. I've got it working the way I want - almost.

dave12:04:35

@richiardiandrea thanks for posting that. i finally understand Thread.interrupt() and InterruptedException. i feel enlightened!

looveh12:04:29

Is there any way to exclude dependencies of dependencies when building an uberjar with boot?

looveh12:04:17

An example I have is where a dependency of my project is basically a Java library wrapper that imports many dependencies that I’m not using, which takes unnecessary resources

martinklepsch12:04:53

@looveh you can specify :exclusions per dependency which will remove them

martinklepsch12:04:26

[org.clojure/clojurescript "0.0.0" :exclusions [org.clojure/clojure]]

looveh13:04:12

@martinklepsch Great, thanks!

jjmojojjmojo14:04:23

is there some specific nrepl middleware (or a setting maybe) that will give me full stack traces when there’s an unhandled exception in boot repl?

micha14:04:41

the -v option to boot might help there

dave16:04:06

@jjmojojjmojo running (pst) after an exception happens will print the stacktrace, if that helps

grounded_sage21:04:36

Does anyone know their way around Docker here?

souenzzo22:04:27

grounded_sage: cache m2 dir

grounded_sage23:04:00

I'm asking because the guys at Netlify couldn't get Boot working and it's not a priority for them.

grounded_sage23:04:26

Wondering how hard it is and whether me with no knowledge of docker could help get it added

dominicm09:04:38

boot works in docker…

dominicm09:04:47

I think there's even an imagine with docker pre-setup

grounded_sage12:04:13

The guys at Netlify weren't able to get it working. I might bang my head on it for a few weeks (no experience with Docker + Still new to programming) and see if I can get it working