Fork me on GitHub
#biff
<
2024-02-22
>
nuriaion15:02:26

I have some problem with reload/refresh with Biff 1.8.1 on mac os. When i change something (e.g. the Text on the Sign Up Button) i only get the new html after i have killed the clj -M:dev dev

nuriaion15:02:47

After storing the new file i get in the console: Rebuilding... Done in 17ms.

nuriaion15:02:33

I also tried a main/refresh then i get in the console:

[nREPL-session-53c1780e-adf9-43f1-82fc-d32cd0f9fc2a] INFO ch.fabianpage - stopping: com.biffweb.impl.misc$use_beholder$fn__28640@345f491a
[nREPL-session-53c1780e-adf9-43f1-82fc-d32cd0f9fc2a] INFO ch.fabianpage - stopping: com.biffweb.impl.misc$use_chime$fn__28697$fn__28701@207cd8cc
[nREPL-session-53c1780e-adf9-43f1-82fc-d32cd0f9fc2a] INFO ch.fabianpage - stopping: com.biffweb.impl.misc$use_jetty$fn__28673@7817afb0
[nREPL-session-53c1780e-adf9-43f1-82fc-d32cd0f9fc2a] INFO org.eclipse.jetty.server.Server - Stopped Server@12c33c39{STOPPING}[10.0.7,sto=0]
[nREPL-session-53c1780e-adf9-43f1-82fc-d32cd0f9fc2a] INFO org.eclipse.jetty.server.AbstractConnector - Stopped ServerConnector@1ffd3bbc{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
[nREPL-session-53c1780e-adf9-43f1-82fc-d32cd0f9fc2a] INFO org.eclipse.jetty.server.handler.ContextHandler - Stopped o.e.j.s.ServletContextHandler@54775f19{/,null,STOPPED}
[nREPL-session-53c1780e-adf9-43f1-82fc-d32cd0f9fc2a] INFO ch.fabianpage - stopping: com.biffweb.impl.xtdb$use_tx_listener$fn__25878@69f182d0
[nREPL-session-53c1780e-adf9-43f1-82fc-d32cd0f9fc2a] INFO ch.fabianpage - stopping: com.biffweb.impl.queues$use_queues$fn__32212@3eda75f1
[nREPL-session-53c1780e-adf9-43f1-82fc-d32cd0f9fc2a] INFO ch.fabianpage - stopping: com.biffweb.impl.xtdb$use_xt$fn__25843@386eaa96
[nREPL-session-53c1780e-adf9-43f1-82fc-d32cd0f9fc2a] INFO xtdb.tx - Shut down tx-ingester

nuriaion15:02:32

after that the nrepl doesn't work anymore and also the web request doesn't return anymore

nuriaion15:02:13

In the nrepl i get:

; eval (root-form): (main/refresh)
; (out) :reloading (clojure.tools.build.util.log clojure.tools.deps.alpha.specs clojure.tools.deps.alpha.util.concurrent  clojure.tools.deps.alpha.util.session clojure.tools.deps.alpha.extensions clojure.tools.deps.alpha.util.dir clojure.tools.deps.alpha clojure.tools.deps.alpha.script.print-tree clojure.tools.deps.alpha.extensions.git clojure.tools.build.util.file clojure.tools.build.util.zip clojure.tools.build.api.specs clojure.tools.build.api clojure.tools.build.tasks.jar clojure.tools.build.tasks.copy clojure.tools.deps.alpha.tool clojure.tools.deps.alpha.script.parse clojure.tools.deps.alpha.util.s3-transporter clojure.tools.deps.alpha.util.maven clojure.tools.deps.alpha.gen.pom clojure.tools.deps.alpha.tree clojure.tools.deps.alpha.script.make-classpath2 clojure.tools.deps.alpha.script.generate-manifest2 com.biffweb.task-runner.lazy com.biffweb.tasks.lazy.clojure.string com.biffweb.tasks.lazy.clojure.java.shell com.biffweb.tasks.lazy.babashka.process com.biffweb.tasks.lazy.nextjournal.beholder com.biffweb.tasks.lazy.babashka.fs com.biffweb.tasks.lazy.com.biffweb.config com.biffweb.task-runner.lazy.clojure.string com.biffweb.task-runner com.biffweb.tasks.lazy.nrepl.cmdline com.biffweb.tasks.lazy.clojure.tools.build.api  com.biffweb.tasks.lazy.clojure.stacktrace com.biffweb.tasks.lazy.hato.client com.biffweb.tasks com.biffweb.impl.time clojure.tools.deps.alpha.extensions.deps clojure.tools.deps.alpha.repl com.biffweb.impl.util com.biffweb.impl.util.ns com.biffweb.impl.xtdb com.biffweb.impl.queues com.biffweb.impl.misc com.biffweb.impl.middleware com.biffweb.impl.util.s3 com.biffweb.config com.biffweb.impl.rum com.biffweb.impl.auth com.biffweb.impl.util.reload com.biffweb.impl.htmx-refresh com.biffweb ch.fabianpage.settings ch.fabianpage.ui ch.fabianpage.middleware ch.fabianpage.home ch.fabianpage.worker ch.fabianpage.schema ch.fabianpage.email  ch.fabianpage repl clojure.tools.build.tasks.javac clojure.tools.build.tasks.install ch.fabianpage-test clojure.tools.build.tasks.process clojure.tools.build.tasks.compile-clj tasks clojure.tools.build.tasks.create-basis clojure.tools.deps.alpha.extensions.pom clojure.tools.deps.alpha.extensions.local clojure.tools.deps.alpha.util.s3-aws-client clojure.tools.build.tasks.uber clojure.tools.deps.alpha.extensions.maven clojure.tools.build.tasks.zip  clojure.tools.deps.alpha.script.resolve-tags clojure.tools.build.tasks.write-pom clojure.tools.cli.api)
; (out) :error-while-loading ch.fabianpage
:done

Jacob O'Bryant15:02:24

at the end of the nrepl output I see there's a :error-while-loading ch.fabianpage message. if you eval that namespace via the repl do you see any errors?

Jacob O'Bryant15:02:39

if there is a compilation error, ideally you'd be getting a stack trace somewhere + a notification in the browser window, so that might need to investigate that

nuriaion17:02:19

I will try that out later.

nuriaion17:02:53

But i reproduced the error with a new tutorial project. Will try it out also with an not tutorial project.

Jacob O'Bryant17:02:02

hmm, interesting. I just tried starting a new tutorial project (at the moment it should be the same as a non-tutorial project anyway) as a sanity check and I didn't get the error myself. So if you: 1. create a new project 2. run clj -M:dev dev 3. open the signup page at 4. open src/com/example/settings.clj and change "My Application" to something else, then save the file Does the signup page auto-refresh and display the new string? or at least display the new string if you manually refresh the web page?

Jacob O'Bryant17:02:58

I wonder if there could be some problem on Mac? (I'm on Windows + WSL, so those two platforms are easy for me to test on, but Mac is a little less convenient.) Could someone else with a Mac try creating a new project (`clj -M -e '(load-string (slurp "https://biffweb.com/new.clj"))'`) and change some files and verify that the changes take effect without errors?

Ash20:02:30

Hi Jacob, …I did just that on my M1 Mac and it worked fine. I ran your command to create an app; then clj -M:dev dev to start it; browsed to it using Safari; edited the home-pageand saw the expected result in Safari; no errors in terminal/console. Let me know if you want any other detail.

Jacob O'Bryant20:02:17

awesome, thanks for checking that.

nuriaion20:02:25

Thanks, then i know it's my setup

Jacob O'Bryant20:02:52

Happy to help debug--hopefully shouldn't be too hard to figure out.

Ash20:02:15

Just to add, my M1 has… $ clj --version Clojure CLI version 1.11.1.1386 $ uname -a Darwin zinc.lan 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:34 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T8103 arm64

nuriaion07:02:02

❯ java --version
openjdk 19.0.2 2023-01-17
OpenJDK Runtime Environment Zulu19.32+13-CA (build 19.0.2+7)
OpenJDK 64-Bit Server VM Zulu19.32+13-CA (build 19.0.2+7, mixed mode, sharing)

nuriaion07:02:13

❯ clojure --version
Clojure CLI version 1.11.1.1435

nuriaion07:02:34

❯ uname -a
Darwin MacBook-Pro-von-Fabian.local 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:31:00 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6020 arm64

nuriaion08:02:06

I changed the logging level by adding

"-Dorg.slf4j.simpleLogger.defaultLogLevel=debug"

nuriaion08:02:57

When saving a file i get:

Rebuilding...

Done in 18ms.
[ForkJoinPool.commonPool-worker-1] DEBUG io.methvin.watcher.DirectoryWatcher - ENTRY_MODIFY [/Users/fabian/tmp/asdf/src/ch/asdf/home.clj]
[ForkJoinPool.commonPool-worker-1] DEBUG io.methvin.watcher.DirectoryWatcher - -> MODIFY [/Users/fabian/tmp/asdf/src/ch/asdf/home.clj] (isDirectory: false)
[ForkJoinPool.commonPool-worker-1] DEBUG io.methvin.watcher.DirectoryWatcher - DirectoryWatcher got an exception while watching!
java.lang.IllegalArgumentException: No implementation of method: :inst-ms* of protocol: #'clojure.core/Inst found for class: clojure.lang.Symbol
        at clojure.core$_cache_protocol_fn.invokeStatic(core_deftype.clj:584)
        at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:576)
        at clojure.core$eval20850$fn__20851$G__20841__20856.invoke(core.clj:6831)
        at clojure.core$inst_ms.invokeStatic(core.clj:6842)
        at clojure.core$inst_ms.invoke(core.clj:6838)
        at com.biffweb.impl.time$seconds_between.invokeStatic(time.clj:25)
        at com.biffweb.impl.time$seconds_between.invoke(time.clj:24)
        at com.biffweb.impl.time$elapsed_QMARK_.invokeStatic(time.clj:37)
        at com.biffweb.impl.time$elapsed_QMARK_.invoke(time.clj:35)
        at com.biffweb.impl.misc$use_beholder$fn__28631.invoke(misc.clj:29)
        at nextjournal.beholder$fn$reify__26181.onEvent(beholder.clj:13)
        at io.methvin.watcher.DirectoryWatcher.onEvent(DirectoryWatcher.java:402)
        at io.methvin.watcher.DirectoryWatcher.runEventLoop(DirectoryWatcher.java:349)
        at io.methvin.watcher.DirectoryWatcher.lambda$watchAsync$1(DirectoryWatcher.java:232)
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
[ForkJoinPool.commonPool-worker-1] DEBUG io.methvin.watcher.DirectoryWatcher - ENTRY_MODIFY [/Users/fabian/tmp/asdf/src/ch/asdf/home.clj]
[qtp672232333-43] DEBUG org.eclipse.jetty.util.thread.ReservedThreadExecutor - ReservedThread@4147b149{RESERVED,thread=Thread[#43,qtp672232333-43,5,main]} task=null ReservedThreadExecutor@28abd6d7{reserved=1/5,pending=0}
[qtp672232333-43] DEBUG org.eclipse.jetty.util.thread.ReservedThreadExecutor - ReservedThread@4147b149{IDLE,thread=Thread[#43,qtp672232333-43,5,main]} exited ReservedThreadExecutor@28abd6d7{reserved=0/5,pending=0}
[qtp672232333-43] DEBUG org.eclipse.jetty.util.thread.QueuedThreadPool - ran ReservedThread@4147b149{IDLE,thread=null} in QueuedThreadPool[qtp672232333]@2811738d{STARTED,8<=8<=50,i=3,r=-1,q=0}[ReservedThreadExecutor@28abd6d7{reserved=0/5,pending=0}]

Jacob O'Bryant14:02:41

that is bizarre... this is the line that breaks: https://github.com/jacobobryant/biff/blob/93baa98ff714d2bc29715ab746f6aa7ce5751ec0/src/com/biffweb/impl/misc.clj#L29 the :now gets converted to (java.util.Date.). it appears that either that or #inst "1970" is ending up as a symbol instead of an inst. can you eval (inst-ms #inst "1970") in the repl?

Jacob O'Bryant14:02:09

I wonder if you have something funky going on with data readers.

Jacob O'Bryant14:02:04

it also might not hurt to try another jdk version just in case? technically 19 is unsupported by clojure I believe since it's not an LTS release; you could try 17 or 21 instead... though ideally we can at least reproduce the symbol-instead-of-inst behavior without switching jdks.

Ash14:02:10

( …My M1 Mac is using 17 )

👍 1
nuriaion14:02:43

; eval (root-form): (inst-ms #inst "1970")
; (err) Execution error (IllegalArgumentException) at repl/eval53833 (REPL:87).
; (err) No implementation of method: :inst-ms* of protocol: #'clojure.core/Inst found for class: clojure.lang.Symbol

nuriaion14:02:21

That only hapens in the nrepl connected from nvim.

nuriaion14:02:39

if i just start clj then i get back 0.

nuriaion14:02:46

So i have a problem with my nrepl config

Jacob O'Bryant18:02:16

the plot thickens! does switching jdks make a difference? what do you get from evaling (identity #inst "1970")? as a workaround it wouldn't hurt to use a modified version of use-beholder that initializes last-called to (java.util.Date.) instead of #inst "1970". I'll make that change in the next release, and in the mean time you can copy-paste use-beholder into your project and make the changes there. I'm interested to see if any other errors come up. also you could try creating a miniminal example of the bug--E.g. create a new project with only nrepl as a dependency, start an nrepl server, see if you get the error. etc.

nuriaion10:02:58

Interestingly removing (:gen-class) fixed this problem.

1
nuriaion10:02:13

I will try to investigate furter on monday to find the root problem

Jacob O'Bryant11:02:55

very interesting. I'll try to do some fiddling sometime too.

grav20:04:41

Same experience here, fresh starter project, - Arch Linux

$ clj --version
Clojure CLI version 1.11.2.1446
$ java --version
openjdk 22 2024-03-19
OpenJDK Runtime Environment (build 22+36)
OpenJDK 64-Bit Server VM (build 22+36, mixed mode, sharing)
Once I deleted ~/.m2 and restarted, reloading started working again.

grav20:04:01

Nothing in ~/.clojure/deps.edn except for a few aliases that I wasn't using. Just did clj -M:dev dev

Jacob O'Bryant22:04:19

are you able to reproduce the error after deleting .m2?

Jacob O'Bryant22:04:33

maybe there's some set of libraries that conflict and cause the error some how... like two libraries with the same namespace or something?

grav05:04:03

Everything is well after removing ~/.m2. Should probably have saved the bad state somewhere.

grav05:04:21

If it happens again, I'll make sure to back it up 👍

nuriaion15:02:56

Some Idea what i'm doing wrong?

Jacob O'Bryant17:02:58
replied to a thread:In the nrepl i get: ; eval (root-form): (main/refresh) ; (out) :reloading (clojure.tools.build.util.log clojure.tools.deps.alpha.specs clojure.tools.deps.alpha.util.concurrent <http://clojure.tools.deps.alpha.util.io|clojure.tools.deps.alpha.util.io> clojure.tools.deps.alpha.util.session clojure.tools.deps.alpha.extensions clojure.tools.deps.alpha.util.dir clojure.tools.deps.alpha clojure.tools.deps.alpha.script.print-tree clojure.tools.deps.alpha.extensions.git clojure.tools.build.util.file clojure.tools.build.util.zip clojure.tools.build.api.specs clojure.tools.build.api clojure.tools.build.tasks.jar clojure.tools.build.tasks.copy clojure.tools.deps.alpha.tool clojure.tools.deps.alpha.script.parse clojure.tools.deps.alpha.util.s3-transporter clojure.tools.deps.alpha.util.maven clojure.tools.deps.alpha.gen.pom clojure.tools.deps.alpha.tree clojure.tools.deps.alpha.script.make-classpath2 clojure.tools.deps.alpha.script.generate-manifest2 com.biffweb.task-runner.lazy com.biffweb.tasks.lazy.clojure.string com.biffweb.tasks.lazy.clojure.java.shell com.biffweb.tasks.lazy.babashka.process com.biffweb.tasks.lazy.nextjournal.beholder com.biffweb.tasks.lazy.babashka.fs com.biffweb.tasks.lazy.com.biffweb.config com.biffweb.task-runner.lazy.clojure.string com.biffweb.task-runner com.biffweb.tasks.lazy.nrepl.cmdline com.biffweb.tasks.lazy.clojure.tools.build.api <http://com.biffweb.tasks.lazy.clojure.java.io|com.biffweb.tasks.lazy.clojure.java.io> com.biffweb.tasks.lazy.clojure.stacktrace com.biffweb.tasks.lazy.hato.client com.biffweb.tasks com.biffweb.impl.time clojure.tools.deps.alpha.extensions.deps clojure.tools.deps.alpha.repl com.biffweb.impl.util com.biffweb.impl.util.ns com.biffweb.impl.xtdb com.biffweb.impl.queues com.biffweb.impl.misc com.biffweb.impl.middleware com.biffweb.impl.util.s3 com.biffweb.config com.biffweb.impl.rum com.biffweb.impl.auth com.biffweb.impl.util.reload com.biffweb.impl.htmx-refresh com.biffweb ch.fabianpage.settings ch.fabianpage.ui ch.fabianpage.middleware ch.fabianpage.home ch.fabianpage.worker ch.fabianpage.schema ch.fabianpage.email <http://ch.fabianpage.app|ch.fabianpage.app> ch.fabianpage repl clojure.tools.build.tasks.javac clojure.tools.build.tasks.install ch.fabianpage-test clojure.tools.build.tasks.process clojure.tools.build.tasks.compile-clj tasks clojure.tools.build.tasks.create-basis clojure.tools.deps.alpha.extensions.pom clojure.tools.deps.alpha.extensions.local clojure.tools.deps.alpha.util.s3-aws-client clojure.tools.build.tasks.uber clojure.tools.deps.alpha.extensions.maven clojure.tools.build.tasks.zip <http://clojure.tools.cli.help|clojure.tools.cli.help> clojure.tools.deps.alpha.script.resolve-tags clojure.tools.build.tasks.write-pom clojure.tools.cli.api) ; (out) :error-while-loading ch.fabianpage :done

I wonder if there could be some problem on Mac? (I'm on Windows + WSL, so those two platforms are easy for me to test on, but Mac is a little less convenient.) Could someone else with a Mac try creating a new project (`clj -M -e '(load-string (slurp "https://biffweb.com/new.clj"))'`) and change some files and verify that the changes take effect without errors?