Re: [Haskell-cafe] ANN: Salvia-1.0.0

2010-03-24 Thread Bernie Pope
On 25 March 2010 14:23, Ivan Miljenovic  wrote:
> On 25 March 2010 12:21, Bernie Pope  wrote:
>>
>> Yes, I tried that, but unfortunately it falls over with:
>>
>> Language/Haskell/TH/Quote.hs:31:12:
>>    Not in scope: data constructor `CharConstr'
>> cabal: Error: some packages failed to install:
>> template-haskell-2.4.0.0 failed during the building phase. The exception was:
>> exit: ExitFailure 1
>
> TH-2.4 comes with/needs GHC 6.12.  The problem here appears to by with
> syb-with-class: using a lower version of that should work, as 0.6.1
> appears to be a compatability release just to get it working on 6.12
> (whereas 0.6 works with 6.10).

Thanks Ivan.

cabal install syb-with-class-0.6 fixed the problem.

I note that you did mention this before, and sorry I missed it the first time.

Cheers,
Bernie.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Salvia-1.0.0

2010-03-24 Thread Ivan Miljenovic
On 25 March 2010 12:21, Bernie Pope  wrote:
>
> Yes, I tried that, but unfortunately it falls over with:
>
> Language/Haskell/TH/Quote.hs:31:12:
>    Not in scope: data constructor `CharConstr'
> cabal: Error: some packages failed to install:
> template-haskell-2.4.0.0 failed during the building phase. The exception was:
> exit: ExitFailure 1

TH-2.4 comes with/needs GHC 6.12.  The problem here appears to by with
syb-with-class: using a lower version of that should work, as 0.6.1
appears to be a compatability release just to get it working on 6.12
(whereas 0.6 works with 6.10).

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Salvia-1.0.0

2010-03-24 Thread Bernie Pope
On 22 March 2010 11:05, Carter Schonwald  wrote:
> apparently sometimes even though cabal can figure out the dependencies for a
> package you want, it gets confused (or something) when it needs to figure
> out the "transitive" dependencies (that which needs to be installed for the
> direct dependencies to also install). So  try doing a cabal install of that
> version of template  haskell with the explicit version
> cabal install template-haskell-2.4.0.0
> that should solve it

Yes, I tried that, but unfortunately it falls over with:

Language/Haskell/TH/Quote.hs:31:12:
Not in scope: data constructor `CharConstr'
cabal: Error: some packages failed to install:
template-haskell-2.4.0.0 failed during the building phase. The exception was:
exit: ExitFailure 1

In the version of Data.Data on my machine there does not appear to be
a CharConstr.

It looks to me like there is an incorrect dependency in Template Haskell.

I can see from the hackage build logs that I'm not the only one who
has this problem. I will report a bug.

Cheers,
Bernie.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Salvia-1.0.0

2010-03-23 Thread Bas van Dijk
On Tue, Mar 23, 2010 at 2:30 PM, Gwern Branwen  wrote:
> I use ' git format-patch origin'.

Thanks!

In case you have trouble pulling from my webserver I attached the same
two patches using Gwern's method to this email.

On Tue, Mar 23, 2010 at 2:34 PM, Chris Eidhof  wrote:
> The way I like to work is forking the repository on github (you need an 
> account for that, though). Then you can push the changes to your forked 
> repository and the original author will see it.

Mmm interesting, I will check it out when I have time. However I do
like the simplicity of just emailing patches.

regards,

Bas


0001-Fixed-major-space-leak-in-Network.Salvia.Impl.Server.patch
Description: Binary data


0002-Block-asynchronous-exceptions-before-installing-exce.patch
Description: Binary data
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Salvia-1.0.0

2010-03-23 Thread Chris Eidhof
On 23 mrt 2010, at 14:27, Bas van Dijk wrote:

> On Tue, Mar 23, 2010 at 2:13 PM, Sebastiaan Visser  wrote:
>> Nice! This is certainly worth it.
> 
> BTW What's the git equivalent of 'darcs send -o ' which
> saves the patches to ? I would rather send my patches as
> email attachements instead of copying my repository to my webserver.
> (Note this is the first time I used git)

The way I like to work is forking the repository on github (you need an account 
for that, though). Then you can push the changes to your forked repository and 
the original author will see it.

Have a look at http://book.git-scm.com/5_git_and_email.html to see how you can 
send changes by email.

-chris___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Salvia-1.0.0

2010-03-23 Thread Gwern Branwen
On Tue, Mar 23, 2010 at 9:27 AM, Bas van Dijk  wrote:
> On Tue, Mar 23, 2010 at 2:13 PM, Sebastiaan Visser  wrote:
>> Nice! This is certainly worth it.
>
> I'm glad you like it.
>
> Sebastiaan, I made the same mistake as threadmanager does: I forgot to
> block before installing the deleteMyPid exception handler in the
> forked thread. I added a new patch that adds the necessary block and
> unblock: http://bifunctor.homelinux.net/~bas/salvia/
>
> BTW What's the git equivalent of 'darcs send -o ' which
> saves the patches to ? I would rather send my patches as
> email attachements instead of copying my repository to my webserver.
> (Note this is the first time I used git)

I use ' git format-patch origin'.

-- 
gwern
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Salvia-1.0.0

2010-03-23 Thread Bas van Dijk
On Tue, Mar 23, 2010 at 2:13 PM, Sebastiaan Visser  wrote:
> Nice! This is certainly worth it.

I'm glad you like it.

Sebastiaan, I made the same mistake as threadmanager does: I forgot to
block before installing the deleteMyPid exception handler in the
forked thread. I added a new patch that adds the necessary block and
unblock: http://bifunctor.homelinux.net/~bas/salvia/

BTW What's the git equivalent of 'darcs send -o ' which
saves the patches to ? I would rather send my patches as
email attachements instead of copying my repository to my webserver.
(Note this is the first time I used git)

> I really liked the simplicity of the threadmanager package, it certainly was 
> better than managing threads manually. But your concurrent-extra package 
> seems to do a way better job, I'm certainly going to apply this patch.

Thanks. Note I'm thinking of adding a utility module to
concurrent-extra named something like:
"Control.Concurrent.Thread.Group" that offers some of the same
functionality as threadmanager. Namely waiting for a group of threads
to terminate. It should also offer the automatic garbage collection
that we are now doing manually in salvia (deleteMyPid).

When I have that finished I will make a new patch to salvia that will
use that new module. Then your server will look a lot cleaner again.

regards,

Bas
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Salvia-1.0.0

2010-03-23 Thread Sebastiaan Visser
Nice! This is certainly worth it. 

I really liked the simplicity of the threadmanager package, it certainly was 
better than managing threads manually. But your concurrent-extra package seems 
to do a way better job, I'm certainly going to apply this patch.

Thanks a lot guys!

Groet,
Sebastiaan

On Mar 23, 2010, at 12:36 PM, Bas van Dijk wrote:
> On Sun, Mar 21, 2010 at 5:05 PM, Sebastiaan Visser  wrote:
>> Straight from Zurihac: I'm very pleased to announce the 1.0.0 release of the 
>> Salvia web server.
> 
> Hoi Sebastiaan,
> 
> (switching to English) I discovered a major space-leak in
> Network.Salvia.Impl.Server.start due to the use of threadmanager:
> 
> When a request handler is forked the threadmanager internally maps the
> threadId to a status MVar. However when the request handler terminates
> this association is not deleted from the internal Map. This results in
> a major O(n) space-leak where n = the number of requests accepted.
> 
> This space-leak can be visualized when you heap-profile the
> salvia-helloworld demo:
> 
> salvia-helloworld +RTS -hy
> 
> and perform some requests:
> 
> $ for ((a=0; a<1; a++)); do curl -s -o /dev/null localhost:8080; done
> 
> You will then get the following heap profile which will clearly
> highlight the linear space-leak:
> 
> http://bifunctor.homelinux.net/~bas/salvia-helloworld_ORIGINAL_1_requests.ps
> 
> I fixed it by replacing threadmanager by Control.Concurrent.Thread[1]
> from Roel's and mines concurrent-extra. This module has the following
> advantages over threadmanager:
> 
> * Simpler: We don't have the concept of a ThreadManager. So you don't
> need to make one and pass it to fork and wait.
> 
> * More efficient: We don't keep an internal mapping from ThreadIds to
> status MVars.
> 
> * Correct: threadmanager has a bug where it can potentially miss the
> termination of a thread. It doesn't block asynchronous exceptions
> before it forks the computation that will install the necessary
> exception handler before executing the given action. We correctly
> block asynchronous exceptions.
> 
> Besides these advantages we have the ability to get the return value
> of the forked thread so you don't need a mutable variable.
> 
> Besides replacing threadmanager I now manually delete the threadId of
> the request handler when it terminates.
> 
> When I repeat the heap-profile you will now see a nice constant heap-usage:
> 
> http://bifunctor.homelinux.net/~bas/salvia-helloworld_NEW_1_requests.ps
> 
> I don't know how to attach my git patch to this email so I just copied
> my git repository to:
> 
> http://bifunctor.homelinux.net/~bas/salvia/
> 
> I think you can just pull from there.
> 
> Groeten,
> 
> Bas
> 
> [1] 
> http://hackage.haskell.org/packages/archive/concurrent-extra/0.4/doc/html/Control-Concurrent-Thread.html

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Salvia-1.0.0

2010-03-23 Thread Bas van Dijk
On Sun, Mar 21, 2010 at 5:05 PM, Sebastiaan Visser  wrote:
> Straight from Zurihac: I'm very pleased to announce the 1.0.0 release of the 
> Salvia web server.

Hoi Sebastiaan,

(switching to English) I discovered a major space-leak in
Network.Salvia.Impl.Server.start due to the use of threadmanager:

When a request handler is forked the threadmanager internally maps the
threadId to a status MVar. However when the request handler terminates
this association is not deleted from the internal Map. This results in
a major O(n) space-leak where n = the number of requests accepted.

This space-leak can be visualized when you heap-profile the
salvia-helloworld demo:

salvia-helloworld +RTS -hy

and perform some requests:

$ for ((a=0; a<1; a++)); do curl -s -o /dev/null localhost:8080; done

You will then get the following heap profile which will clearly
highlight the linear space-leak:

http://bifunctor.homelinux.net/~bas/salvia-helloworld_ORIGINAL_1_requests.ps

I fixed it by replacing threadmanager by Control.Concurrent.Thread[1]
from Roel's and mines concurrent-extra. This module has the following
advantages over threadmanager:

* Simpler: We don't have the concept of a ThreadManager. So you don't
need to make one and pass it to fork and wait.

* More efficient: We don't keep an internal mapping from ThreadIds to
status MVars.

* Correct: threadmanager has a bug where it can potentially miss the
termination of a thread. It doesn't block asynchronous exceptions
before it forks the computation that will install the necessary
exception handler before executing the given action. We correctly
block asynchronous exceptions.

Besides these advantages we have the ability to get the return value
of the forked thread so you don't need a mutable variable.

Besides replacing threadmanager I now manually delete the threadId of
the request handler when it terminates.

When I repeat the heap-profile you will now see a nice constant heap-usage:

http://bifunctor.homelinux.net/~bas/salvia-helloworld_NEW_1_requests.ps

I don't know how to attach my git patch to this email so I just copied
my git repository to:

http://bifunctor.homelinux.net/~bas/salvia/

I think you can just pull from there.

Groeten,

Bas

[1] 
http://hackage.haskell.org/packages/archive/concurrent-extra/0.4/doc/html/Control-Concurrent-Thread.html
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Salvia-1.0.0

2010-03-21 Thread Carter Schonwald
apparently sometimes even though cabal can figure out the dependencies for a
package you want, it gets confused (or something) when it needs to figure
out the "transitive" dependencies (that which needs to be installed for the
direct dependencies to also install). So  try doing a cabal install of that
version of template  haskell with the explicit version
cabal install template-haskell-2.4.0.0
that should solve it

On Sun, Mar 21, 2010 at 7:57 PM, Bernie Pope  wrote:

> On 22 March 2010 03:05, Sebastiaan Visser  wrote:
>
> > Straight from Zurihac: I'm very pleased to announce the 1.0.0 release of
> the Salvia web server.
> >
> > Salvia is a feature rich web server and web application framework that
> can be used to write dynamic websites in Haskell. From the lower level
> protocol code up to the high level application code, everything is written
> as a Salvia handler. This approach makes the framework extremely modular and
> extensible.
> >
> > To do a full install first run `cabal update' followed by `cabal install
> salvia-demo'. Now you can run the salvia-demo command and point your browser
> to http://localhost:8080/ .
>
> Hi Sebastiaan,
>
> I was looking forward to a new version of Salvia.
>
> Do you have minumum requirements for GHC? I tried to 'cabal install
> salvia-demo', but with no luck:
>
> cabal install salvia-demo
> Resolving dependencies...
> cabal: cannot configure syb-with-class-0.6.1. It requires template-haskell
> ==2.4.*
> For the dependency on template-haskell ==2.4.* there are these packages:
> template-haskell-2.4.0.0. However none of them are available.
> template-haskell-2.4.0.0 was excluded because template-haskell-2.3.0.1 was
> selected instead
> template-haskell-2.4.0.0 was excluded because ghc-6.10.4 requires
> template-haskell ==2.3.0.1
>
> Cheers,
> Bernie.
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Salvia-1.0.0

2010-03-21 Thread Ivan Miljenovic
On 22 March 2010 10:57, Bernie Pope  wrote:
> Do you have minumum requirements for GHC? I tried to 'cabal install
> salvia-demo', but with no luck:

Looking at the dependencies listed, they claim that GHC should work
with >= 6.10.1.

> cabal install salvia-demo
> Resolving dependencies...
> cabal: cannot configure syb-with-class-0.6.1. It requires template-haskell
> ==2.4.*
> For the dependency on template-haskell ==2.4.* there are these packages:
> template-haskell-2.4.0.0. However none of them are available.
> template-haskell-2.4.0.0 was excluded because template-haskell-2.3.0.1 was
> selected instead
> template-haskell-2.4.0.0 was excluded because ghc-6.10.4 requires
> template-haskell ==2.3.0.1

Hmmm a quick look through the dependencies couldn't reveal what
was pulling in syb-with-class; maybe if you just install
syb-with-class-0.6 first and it will use that instead?

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Salvia-1.0.0

2010-03-21 Thread Bernie Pope
On 22 March 2010 03:05, Sebastiaan Visser  wrote:

> Straight from Zurihac: I'm very pleased to announce the 1.0.0 release of the 
> Salvia web server.
>
> Salvia is a feature rich web server and web application framework that can be 
> used to write dynamic websites in Haskell. From the lower level protocol code 
> up to the high level application code, everything is written as a Salvia 
> handler. This approach makes the framework extremely modular and extensible.
>
> To do a full install first run `cabal update' followed by `cabal install 
> salvia-demo'. Now you can run the salvia-demo command and point your browser 
> to http://localhost:8080/ .

Hi Sebastiaan,

I was looking forward to a new version of Salvia.

Do you have minumum requirements for GHC? I tried to 'cabal install
salvia-demo', but with no luck:

cabal install salvia-demo
Resolving dependencies...
cabal: cannot configure syb-with-class-0.6.1. It requires template-haskell
==2.4.*
For the dependency on template-haskell ==2.4.* there are these packages:
template-haskell-2.4.0.0. However none of them are available.
template-haskell-2.4.0.0 was excluded because template-haskell-2.3.0.1 was
selected instead
template-haskell-2.4.0.0 was excluded because ghc-6.10.4 requires
template-haskell ==2.3.0.1

Cheers,
Bernie.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: Salvia-1.0.0

2010-03-21 Thread Sebastiaan Visser
Hi all,

Straight from Zurihac: I'm very pleased to announce the 1.0.0 release of the 
Salvia web server.

Salvia is a feature rich web server and web application framework that can be 
used to write dynamic websites in Haskell. From the lower level protocol code 
up to the high level application code, everything is written as a Salvia 
handler. This approach makes the framework extremely modular and extensible.

This release include the following stack of packages:

  * salvia-protocol: Protocol stack containing URI, HTTP, Cookie and Mime.
  * salvia: Basic server interface and implementation.
  * salvia-extras: Additional server handlers and back end implementation.
  * salvia-sessions: Session and user management support.
  * salvia-websocket: Cutting edge HTML5 web socket support.
  * salvia-demo: Demo servers showing how to use Salvia.

All the code is on Hackage[1] and the source repositories can be found on 
GitHub[2].

Most of the basic ideas of the previous Salvia release are still in these 
package, but all the code has been cleaned up considerably. There is now a very 
strong separation between interface and implementation making it more easy to 
plug-in new back-ends for your web application.

To do a full install first run `cabal update' followed by `cabal install 
salvia-demo'. Now you can run the salvia-demo command and point your browser to 
http://localhost:8080/ .

Thanks to the people that helped me with coding, suggestions and bug-reports. 
Any comments/suggestions are welcome!

Have fun,

--

Sebatiaan Visser

[1] http://hackage.haskell.org/package/salvia (-protocol, -demo, etc)
[2] http://github.com/sebastiaanvisser/salvia (-protocol, -demo, etc)


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe