-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using os module functions causes root fiber to panic #17
Comments
this is the code of the application for reference. (import circlet)
(defn getls
"gets ls from bin dir" []
(def procc (os/spawn ["ls"] :p {:in :pipe :out :pipe :err :pipe}))
(pp :waiting_for_proc)
(pp (:wait procc))
[(:read (procc :out) :all)
(:read (procc :err) :all)])
(defn app
[req]
(try
(do
(def channel (ev/thread-chan 1))
(ev/thread (fiber/new (fn [] (ev/give channel (getls)))) :t)
(def result (ev/take channel))
{:status 200
:headers {"Content-Type" "text/html"}
:body result})
([err]
(print :WE_GOT_AN_ERROR)
(print err)
{:status 500
:headers {"Content-Type" "text/html"}
:body :OOPS})))
(defn main "entry point" [& args]
(circlet/server app 8087))
|
on further debugging, i've found that the problem occurs when I read the streams |
looks like whenever I try to sync threads, read from other processes something errors out or gets stuck... |
it must be something with the way circlet handles threads/fibers, doing the same in the joy framework works well, anyhow I would really want to use circlet and understand why this happens. |
@eko234 I'm running into similar issues, I think. Have you managed to find a workaround? |
Hi fren, you should enter the chat at gitter, backpakin answered me there about it (If I remember correctly), Circlet indeed has some issues with the way it handles threads and thus using fibers or threads directly may lead to these kind of issues, I think in a future this will be fixed (and if I remember well, it has to do with the development of libuv bindings for janet) and I really hope so, but on the other hand there are other libraries you can use for now, I have used both spork for implementing a barebones rpc task manager and the joy framework which says in it description to be "maximalist", but that works pretty well and doesn't even get in my way for it has indeed a very simple and composable api, I use it in production btw. |
I am facing something similar when I try to use |
I would say circlet is not updated for latest Janet. Please do use spork. |
Hi, I'm trying to write a little web app on circlet and I'm trying to spawn some processes like this one when I receive a request to certain endpoint.
the first time I get the request nothing happens, but when I try to request again I got an error that says:
current fiber is already waiting for event
could you explain me why this happens? is this a bug or maybe I'm not familiar enough with how things work in Janet or with Circlet
The text was updated successfully, but these errors were encountered: