babashka-sci-dev

mauricio.szabo 2023-08-01T17:33:58.007949Z

Hi, @borkdude - I think I found some extreme edge-cases on nbb nREPL. Basically, if I connect to nREPL, evaluate something, and immediately disconnect (without waiting for the REPL to send the responses) it crashes with:

node:events:505
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
Emitted 'error' event on Socket instance at:
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'read'
}
Not really a problem because I fixed on my end (it was actually a somewhat annoying behavior that was causing some undesired logs on my tests) but I decided to inform anyway, if it's something you want to fix 🙂

borkdude 2023-08-01T17:41:18.629689Z

nice, feel free to make a github issue with nbb

mauricio.szabo 2023-08-01T17:48:27.245479Z

Ok, done 🙂

mauricio.szabo 2023-08-01T22:31:53.297019Z

Another question: does bb or nbb support the :line option for nRepl eval? I am seeing some weird behavior, still not sure if it's on my end or not (basically, the line is being ignored)

borkdude 2023-08-02T08:03:00.512089Z

Clojure itself does this via metadata: https://github.com/clojure/clojure/blob/2a058814e5fa3e8fb630ae507c3fa7dc865138c6/src/clj/clojure/main.clj#L143C40-L143C40 At least the eval-file thing is supported by SCI

borkdude 2023-08-02T08:03:09.910629Z

Feel free to post issues about the nREPL line thing

mauricio.szabo 2023-08-02T15:04:25.671569Z

Metadata? It seems that's explicit on line 150, right? Where it says (.setLineNumber (if (and line (or eval-file (not= pre-line line))) line line-number))

mauricio.szabo 2023-08-02T15:04:45.482009Z

I'll post issues, thanks! Just wanted to be sure it was nothing on my end 🙂

borkdude 2023-08-02T04:56:19.728079Z

What does it do?

mauricio.szabo 2023-08-02T05:01:56.689449Z

:line sets the current line. So if I evaluate (defn something []) and say that :line 3, the metadata for #'something will say that it was defined on line 3