Arc Forumnew | comments | leaders | submitlogin
wart on win32
2 points by joebo 5298 days ago | 8 comments
I'm trying to get started on wart on win32. I get the following error:

    Symbol "FORK" not found in the SB-POSIX package.
in 046fork.wart.

I can get past it if I rename 046fork.wart to something else (046fork.wart.skip) so that it doesn't load in the boot routine. I'm curious though, any tips on how I can resolve this?

I'm on SBCL 1.0.37

Thank you! Wart looks very interesting



2 points by akkartik 5298 days ago | link

The wart webserver should now spawn threads instead of forking processes if win32 supports them.

  wart> (http-serve)
  nil ; works!
  wart> (defurl "/foo"(req) (prn "hi"))
Now try pointing your browser at http://127.0.0.1:8080/foo

But tests that use fork still won't run.

https://github.com/akkartik/wart/commit/fc421629d5072fbb1b88...

-----

2 points by joebo 5297 days ago | link

Hi akkartik - Thank you! Your code helped me greatly. there's an issue though with it. The spawn actually needs to happen after the socket is connected. see this for an example:

https://gist.github.com/824730

I tried this on win32 and it works fine. You can see the effect of the thread if you put a (sleep 5) before the dispatch. Multiple requests can connect and then each completes 5 seconds later.

Note: To get threads working on win32, I used this build of SBCL http://www.siftsoft.com/inprogress/sbcl-1.0.44.211.msi from this thread: http://dmitry-vk.livejournal.com/35946.html

Note: I know there's some rookie stuff in the arc/sbcl code of mine. I could replace the lets with withs but am still learning.

-----

1 point by akkartik 5297 days ago | link

So the default windows build doesn't have fork or threads?

Yeah I added the per-request spawn a couple of hours after the initial naive version. Have you pulled recently?

https://github.com/akkartik/wart/commit/77c353a1a86c99761dd1... [1]

The spawn doesn't happen quite where it does in your version, so I think the master ends up doing a little more work per request. Let me know if that has implications; I think you know more about this.

[1] Buggy version, but next commit was good. Just do a git pull.

-----

2 points by akkartik 5298 days ago | link

Thanks for trying it, joebo! Yeah windows doesn't have the posix system calls that underly unix-like systems.

I don't have much experience with windows, and it's been a while since I used it, but I think fork() will work under cygwin. Running atop cygwin will probably also help with future incompatibilities.

http://www.cygwin.com/cygwin-ug-net/setup-net.html (it isn't as hard as the contents make it seem :)

Let me know if you have more questions.

-----

2 points by joebo 5298 days ago | link

Thanks for the super quick reply. I just came to the same conclusion and came back to reply.

I spent a few minutes in sb-posix\interface.lisp in SBCL and found that fork was defined under:

#-win32

Which apparently means it's not part of the win32 version. Bummer...

I'll post if I come up with a valid workaround.

Thanks again! (by the way, the wart's code is a joy to read and makes it simple to troubleshoot)

-----

1 point by akkartik 5298 days ago | link

That is awesome to hear. Arc is a readable language; making the implementation readable is my only goal.

Feel free to ping me by email as well (address in profile).

-----

3 points by evanrmurphy 5298 days ago | link

I'm using wart as a way to help ease me into Common Lisp. I've had difficulty before reading CL code because the names of common operators are so different from arc's (the lisp dialect I know best). wart helps by putting it in familiar terms.

-----

1 point by akkartik 5298 days ago | link

Thanks! https://github.com/akkartik/wart/commit/8b8bcdaa421057564a34... :)

-----