Fork me on GitHub
#clojure-uk
<
2020-01-15
>
dharrigan08:01:28

Very windy last night

Samuel09:01:40

top of the morn

Olical10:01:33

It's probably been mentioned already but just a friendly reminder that ClojureBridge London is coming up next month hosted here at Signal: https://clojurebridgelondon.github.io/ We've got a few coaches but more are always appreciated, please do share a link to it on your social media to help spread the word far and wide. We want to make sure people who could benefit from this have a chance of seeing it (they're probably not in the Slack with us if they haven't heard of Clojure yet!) You can also give this a retweet https://twitter.com/ClojureBridgeLN/status/1209083854486720512 😄 please be sure to share it with anyone you think might be interested, we have to spread the word to make sure everyone gets a fair chance of being aware of it.

zyxmn11:01:21

I wanted to but am away at the time . Hopefully I can register for the next one !

dharrigan11:01:09

So it's scarey

dharrigan11:01:08

I'm now changing code in production using a remote repl. The code isn't live-live yet, it's me kicking the tyres. But the ability to do this, and have immediate effect and change the operation of a running system is truly amazing, but oh-so scarey too!

12
dharrigan11:01:38

Can't help but think of Spiderman

mccraigmccraig11:01:20

i dunno, the ability to use a repl to change code is obvs great for development, but how is it better than a rolling deploy of a new docker container in production ? you'd have to pull from git on each process, hit the repl on each process - and there are so many things to go wrong, there's a good reason it's scary!

dharrigan11:01:02

Oh, I don't plan to use this in production (unless really really required)

dharrigan11:01:33

This is me discovering how to do it, and trying something out before I put the code into production mode (and remove jvm switch to startup the repl)

dharrigan11:01:56

I don't plan to use it - but knowing how to do it is very useful

Olical12:01:37

I've used it in staging and production to debug and hotfix where the turnaround would've been SO much longer without it. I love prod / stg repls dearly. Adding a (doto ... tap>) and then getting the front-end engineer to try the thing that failed again is amazing. You can see exactly what's flowing through the system without adding any extra logging. You can be in and out with a solution in a couple of minutes. I think it's something we should embrace and build more tooling / learnings around so we can get the value without the dangers.

Olical12:01:15

It's just fun seeing my colleague hit refresh which results in my Neovim displaying pretty printed data from deep within the function we care about within basically seconds of them asking about the problem.

dharrigan12:01:01

One thing I'm nervous off - and this could be my just learning how to do it

dharrigan12:01:22

but if something blows up, like a OOM or some bit of data stops something from working, I don't see anything

dharrigan12:01:46

Isn't there some issues around clojure and runtime reporting?

mccraigmccraig12:01:38

we have a java default exception handler which logs to http://sentry.io

dharrigan12:01:37

sentry we have

dharrigan12:01:10

I have this in my core clj

dharrigan12:01:12

(Thread/setDefaultUncaughtExceptionHandler
 (reify Thread$UncaughtExceptionHandler
   (uncaughtException [_ thread ex]
     (log/errorf "Uncaught exception on [%s]." (.getName thread))
     (log/errorf ex))))

dharrigan12:01:21

so I guess I can log out to sentry there

dharrigan12:01:20

(that was shamelessly taken from Stuart Sierra's website)

seancorfield13:01:53

We use production REPLs quite a lot for debugging -- and occasionally hot fixes when we have something critical on a few processes.

seancorfield13:01:53

But we can also do a rolling deploy to production in just a few minutes so that's our normal process.

👍 8
flefik14:01:38

ANZ had an interesting outage in the 80s or 90s. I obviously don’t remember the exact details but they were running Algol on some outdated hardware like CDC orS-360. Anyway, they used to patch the code live using the Algol ALTER statement directly in prod, and many changes never made it into the source files. They did this for years, and then one day there was a power cut. All ATMs in the country (South Africa) were inaccessible for months as developers scrambled to try to rewrite all the code that had just been lost.

😱 4
Olical15:01:36

This is like a campfire horror story for programmers.

🔥 4
Jcaw15:01:07

Anyone know any other Programmer Campfire Horror Stories?

thomas15:01:20

I just wasted quite a bit of time before I figured out that if you double = int / int; in Java you don't get what you expect. :face_with_symbols_on_mouth::face_with_symbols_on_mouth::face_with_symbols_on_mouth::face_with_symbols_on_mouth::face_with_symbols_on_mouth::face_with_symbols_on_mouth::face_with_symbols_on_mouth::face_with_symbols_on_mouth:

folcon15:01:31

Just curious, who here pays for profiling tools?

Conor15:01:57

A certain organisation which will remain nameless kept hundreds of terabytes of backups (incurring costs) which turned out to be totally useless

mccraigmccraig15:01:59

@folcon i've paid for yourkit

folcon15:01:27

So primarily dev focused?

folcon15:01:16

Nothing really used in production?

mccraigmccraig15:01:32

we have the yourkit agent active on all our production containers

folcon15:01:43

Ok cool =)…

folcon15:01:01

How’s the name mangling? Or is this not clojure code?

mccraigmccraig15:01:47

it's clojure - the mangling is pretty much the same as with stack traces - it's always been usable

folcon15:01:30

Do you feel it’s been able to help?

mccraigmccraig15:01:06

yes - it's helped us diagnose a couple of memory leaks and an async cpu consumption problem

folcon15:01:11

Cool 😃, thanks!

dharrigan16:01:28

We have our first code in production working

mario-star 16
dharrigan16:01:40

(actually two applications)

dharrigan16:01:20

Obviously, I've quite nervous as I wish this to be seen as a success

dharrigan16:01:41

so monitoring the logs like a hawk atm.

Jcaw16:01:43

Good luck!

dharrigan16:01:04

so far so good

dharrigan16:01:09

I'm off home now

Olical17:01:58

Congratulations, @dharrigan!!! 🎉

maleghast17:01:12

Does anyone in here have any experience of http 503 killing an app? (client app using Aleph)

maleghast17:01:38

I seem to have an un-handled http 503 that is killing my app stone dead.

maleghast17:01:57

(at the Alpeh level / layer, outside my code)

mccraigmccraig17:01:45

@maleghast first question: what is returning the 503 ? is that from aleph, or a proxy in front of aleph ?

mccraigmccraig17:01:18

oh, hold on... you are using the aleph client, doh!

maleghast17:01:03

Yeah. I am getting a 503 from an API outside my sphere of control, intermittently, and when I do it kills the app, as the 503 appears to throw an un-handled exception

mccraigmccraig17:01:40

are you using a deferred/catch on the response from the aleph client ?

maleghast17:01:54

synchronous request

mccraigmccraig17:01:14

so you are derefing the aleph response promise ?

mccraigmccraig17:01:03

the deref will throw an exception for an error... are you catching that ?

maleghast17:01:21

I am not, but it appears I might have to... Seeing as 503 is an HTTP Error, but not an error per se, I was hoping to handle it in-logic. It would appear that the aleph code throws and un-handled exception and kills my app, which is very annoying.

maleghast17:01:30

(on a 503 I want to re-add the job to the queue and I'll try it again later, but I want the app to simply continue, rather than fail)

mccraigmccraig17:01:36

yes, the aleph client throws exceptions for non-200 responses. the good news is that the ex-data in the thrown exception is the response map, so you can trivially handle errors in logic

maleghast17:01:17

I don't get unhandled exceptions for 300 responses or 400 responses and I have logic to handle them

mccraigmccraig17:01:05

oh, ok, maybe i'm misremembering... maybe it's only 500 series responses that throw

Sam H17:01:35

https://github.com/ztellman/aleph/blob/master/src/aleph/http/client_middleware.clj#L204

;; Statuses for which clj-http will not throw an exception
(def unexceptional-status?
  #{200 201 202 203 204 205 206 207 300 301 302 303 304 307})

maleghast17:01:02

Even so, it would appear that the upshot is that any request needs to be wrapped in a (try ...) because a 50x response will throw an unhandled exception..?

maleghast17:01:23

(and based on @shan’s point ^^ 40x would be the same too)

maleghast17:01:58

That's interesting...

Sam H17:01:29

the docs don’t seem to have much info so had to look at the actual code!

mccraigmccraig18:01:21

here's our aleph-based http client @maleghast, with some sample usage at the bottom - it works nicely for your type of use-case : https://gist.github.com/ba43c83792c1be5d565aff0a8cb37d5e

gunar22:01:18

hi all, Gunar here. I have 5 years of experience writing full stack JavaScript applications. Looking to transitioning into a full-time Clojure role in 2020. Moving to London on Jan 29. Nice meeting you all!

👋 44