sci

haywood 2022-05-12T19:46:23.140919Z

are there any parallel/threading subtleties for a request handler on the server that creates a new context and executes some code using eval-string*?

haywood 2022-05-12T19:47:02.913409Z

I’m getting odd behavior calling test-vars downstream, where a test-results atom created in the closure is ending up in another thread

haywood 2022-05-12T19:47:21.393079Z

so if you run the same operation in two different browsers, you can see the test results in the other, they collide somehow but I’m not sure. the threads they start in are different.

haywood 2022-05-12T19:47:44.057449Z

asking here is a last resort 😂

borkdude 2022-05-12T19:55:37.577489Z

@haywood is eval-string* happening on the server side, JVM?

haywood 2022-05-12T19:55:47.143279Z

yea

haywood 2022-05-12T19:56:05.719709Z

I wasn’t forking the context from the ‘factory’ function, which I’m trying now

borkdude 2022-05-12T19:56:52.068019Z

Does your eval-string use :load-fn as well?

haywood 2022-05-12T19:57:00.205989Z

nop

borkdude 2022-05-12T19:57:32.691699Z

What is test-vars, something from Clojure test?

haywood 2022-05-12T19:57:39.928319Z

yea

haywood 2022-05-12T19:58:08.452199Z

which is an odd duck admittedly

borkdude 2022-05-12T19:58:08.720499Z

that may cause global side effects possibly

haywood 2022-05-12T19:58:28.545199Z

so you can provide a clojure.test/report function

haywood 2022-05-12T19:58:54.921289Z

which it will call with the results, and I’m resetting an atom that’s defined in the closure

haywood 2022-05-12T19:59:10.364729Z

and the function eventually returns it

haywood 2022-05-12T19:59:28.624899Z

it’s like the report call back when called is in the wrong thread

borkdude 2022-05-12T20:00:18.084899Z

SCI by default does not run on any other thread

haywood 2022-05-12T20:00:42.121139Z

yea it’s just local right?

borkdude 2022-05-12T20:01:18.720729Z

indeed.

haywood 2022-05-12T20:01:35.931299Z

gotcha

haywood 2022-05-12T20:01:39.436689Z

yea gotta be a clojure.test

borkdude 2022-05-12T20:06:12.708599Z

couldn't it be that your atom is being reset from different threads and that your function picks the wrong return value?

borkdude 2022-05-12T20:33:40.912869Z

> an atom that’s defined in the closure hm, that seems unlikely then

haywood 2022-05-12T20:46:35.325739Z

(sci/new-var 'run-tests! #'extensions/run-tests!)

haywood 2022-05-12T20:47:12.821819Z

that’s the function in question that creates the local atoms via let, and the new var is set on the namespaces map

haywood 2022-05-12T20:47:52.701769Z

I’m gonna take a break from the problem for a few though 😞 thanks for your help

👍 1