This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-04
Channels
- # announcements (13)
- # asami (68)
- # babashka (19)
- # beginners (51)
- # calva (4)
- # cider (3)
- # clj-kondo (13)
- # clojure (161)
- # clojure-australia (3)
- # clojure-europe (21)
- # clojure-nl (4)
- # clojure-spec (9)
- # clojure-sweden (13)
- # clojure-uk (9)
- # clojured (14)
- # clojurescript (7)
- # conjure (4)
- # cursive (16)
- # data-science (2)
- # datalog (1)
- # figwheel-main (7)
- # graalvm (18)
- # helix (14)
- # introduce-yourself (1)
- # jackdaw (9)
- # jobs (1)
- # kaocha (1)
- # malli (8)
- # meander (8)
- # off-topic (7)
- # pathom (11)
- # proletarian (3)
- # shadow-cljs (29)
- # tools-deps (106)
- # xtdb (8)
I am having the most bizarre issue on my machine. I am on a Mac with the clojure cli installed via homebrew. If I launch an app or repl from cli, all network calls fail immediately with a socket error “Operation Not Permitted” and “Connection Refused”. Doing the exact same thing using leiningen works fine. Everything else is exactly the same. I’m not able to connect to databases or make http requests. I have the same issue when launching a server from figwheel (both legacy and figwheel-main). Occasionally I can get it to work for a single connection usually after uninstalling and re-installing Clojure in homebrew. I suspect this could be due to security software as my company has forced a few new scanners on our computers lately, but I’m just wondering what could possibly be different about the calls being made when launching via cli vs lein. Here is the simplest example of what fails for me. The equivalent with a project.clj and using lein repl works just fine. Any ideas what could possibly be different?
well if you want to get clj out of the debugging, you could clj -Spath
and then java -cp <that-path> clojure.main
I'd wonder about Java version, and whether you have granted that Java version access to do network things
it will pop up a prompt for that - possible that's getting buried somehow through clj. just guessing
well i have tried multiple java versions. currently on adoptopenjdk 1.8. and using same version whether cli or lein
I'd rather get clj completely out of the way first and see if it still fails
does clj / clojure differ?
the clojure bash script ultimately basically does java -cp cp clojure.main
what if you just wrap the call to java in a simple bash script?
#!/usr/bin/env bash
exec java -cp ... clojure.main
the plot thickens :)
lein is also bash that is
maybe look at perms for the clojure and lein scripts and their ownership / group?
ok. so yeah tried each method a few times and consistently calling java -cp … directly works and running the bash script with the same thing doesn’t
what if you remove the exec in the script?
that's a difference between lein script and clj script although seems hard to believe that's the difference
interesting
maybe bash is replaced by recent security tools update?
as we say at Nubank... fascinating
i am using zsh but have also tried running it via bash w/ same result. wouldn’t think that would make a difference. course i wouldn’t think exec and no exec would make a difference
bash is used by clj/clojure scripts
mac os X is no longer shipped with system bash )
ah. true. not sure if it helps at all but i’m on Catalina just upgraded last week from Mojave in an attempt to fix this issue
I don't mean to derail but i had a colleague that would get different jvms when using lein and clj. Quite subtle and due to homebrew bringing in jdk15 for lein. You mentioned you were using the same 1.8 jvm but how sure are you on this? How did you check it at runtime. (sorry if this is irrelevant but just something i saw recently)
yeah i’ve been wondering about that too. is it possible to get the jvm from repl? i do have JAVA_HOME set and the clojure script seems to use that if set rather than the openjdk installed by homebrew
clj -M -e '(System/getProperty "java.version")'
I don't think the java is relevant here
smells to me like there is some kind of prohibition re fork
I can imagine something like that from a security pov
I don't know what it is or how to check for it
what’s really baffling to me is when it will work 1 time. yesterday i uninstalled clojure, did brew cleanup, brew doctor, re-installed and it worked for several attempts. but then by the end of the day, it stopped working
also when i do have a working repl or application instance, it seems to work endlessly until that is broken. so definitely seems to be some sort of permissions thing on when it starts
do higher ports work? ports < 1024 require root privileges to open I believe
does it work with curl when it become broken with clj?
> I suspect this could be due to security software as my company has forced a few new scanners on our computers lately what's that about?
have Carbon Black and Microsoft Defender. wouldn’t shock me if there is other than I haven’t noticed
the works for a while and then stops seems like it would match that theory
works very briefly then stops. almost like the first attempt gets through but then it gets blocked. but what could possibly be different about these network requests?
will say they fail immediately. don’t think they are actually making it to the network
exec is going to replace the process so I can imagine a virus scanner seeing a process, replaced with another process space, then making network calls, as a possible virus
lein doesn't do the exec and works
well they both exec at the end
presumably a virus scanner would have some way to see and make this ok
Well, if that theory holds, then @dwhite44 could try https://github.com/borkdude/deps.clj and see if that works, since it doesn't exec
@dwhite44 you could try this binary: https://github.com/borkdude/deps.clj/releases/download/v0.0.15/deps.clj-0.0.15-macos-amd64.zip
Instead of clojure
you invoke deps
. deps -Spath
or whatever
i can give it a try. i think the sh file that works w/ no exec and fails with it is pretty good proof
is anybody familiar with how figwheel works? assume it also creates a new process and is likely why that’s not working? ultimately, I can get around the clojure cli not working by using leiningen but I can’t really do what i need to do if I can’t get around the figwheel problem
you could also try the uberjar if that is the case: https://github.com/borkdude/deps.clj/releases/download/v0.0.15/deps.clj-0.0.15-standalone.jar
java -jar <uberjar>.jar -Spath
right. just wanted to add the fighwheel as an additional hint. seems like that probably confirms the issue is the extra process created by exec
I mean, you can hack your clojure to remove the exec :)
yeah. i’ll give my project a try using that. i suspect though that figwheel will make it fail for the same reason
but at least knowing that difference is causing the problem gives me something to tell the IT people so they can look at the anti-virus software settings or something. I really appreciate everybody’s help on this!
@dwhite44 @alexmiller possibly this also works as a workaround:
alias exec=''
I would write a wrapper script called clojure2
/ clj2
where I would apply this only locally and then invoke the normal tool (to not mess with other calls of exec
in your system)
that's a built-in - can you really subvert it like that?
seems terrible :)
that you can do that :)
This seems to work: clojure2:
#!/usr/bin/env bash
exec() {
echo "exec replacement"
eval $@
}
source clojure $@
hmm. using that script actually doesn’t work for me even though i do see the “exec replacement” being output
@dwhite44 to be 100% certain it's exec triggering your error, make a copy of clojure
and remove "exec" from it
or maybe even easier: change echo "exec replacement"
into echo "exec replacement" $@
just copying the script and playing around with, inserting echo bla
etc will probably help you most to discover what triggers it