Strange behavior of "-with-rtsopts=-T

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Strange behavior of "-with-rtsopts=-T

Vlatko Basic
Hello ghc-devs,

I wrote about this issue to haskell-cafe, but received no reply as of today, so
I'm hoping I could get some answer(s) here.

I wrote a small Servant server that communicates with the same other server(s).


When compiled without "-with-rtsopts=-T", I see in 'gnome-system-monitor' that
memory used by each server constantly growing.

I was investigating the issue, and found that it is (probably) not in my code,
but in one http call (Servant client call to the same server).


When I compile it with "-with-rtsopts=-T", the memory is constant and steady.

Tested on Arch Linux with Stack LTS 13.14.


If any one wants to test this, here are the steps: (server is standalone and
does not require any external services (like DB, Redis, etc) and uses just a few
MBs of RAM.)

$ hg clone https://bitbucket.org/vlatkoB/poomas && cd poomas && stack build

## open your system monitor


## open two terminals in 'poomas' dir and in one run

$ srvb.sh 5

## and in the other #

$ srvb.sh 6

## (5 and 6 represent port number added to 3000, i.e. 3005 and 3006)

## Notice that memory is steady, around 6 MB on my machine.


## In 'server/package.yaml' comment out the line 139 (#-with-rtsopts=-T)

$ stack build --force-dirty

## start those two servers again and see memory usage growing.


Can anyone shed some light what could be happening here?


Best regards,

vlatko

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Strange behavior of "-with-rtsopts=-T

Ömer Sinan Ağacan
Hi Vlatko,

Unless this is a side effect of calling getrusage() (perhaps it causes the OS to
update stats) I don't see how this is possible.

Your reproducer seems to require postgres so I'm unable to run it. If you can
provide a version that doesn't need postgres I can take a look.

Ömer

Vlatko Basic <[hidden email]>, 5 Haz 2019 Çar, 12:53 tarihinde
şunu yazdı:

>
> Hello ghc-devs,
>
> I wrote about this issue to haskell-cafe, but received no reply as of today, so
> I'm hoping I could get some answer(s) here.
>
> I wrote a small Servant server that communicates with the same other server(s).
>
>
> When compiled without "-with-rtsopts=-T", I see in 'gnome-system-monitor' that
> memory used by each server constantly growing.
>
> I was investigating the issue, and found that it is (probably) not in my code,
> but in one http call (Servant client call to the same server).
>
>
> When I compile it with "-with-rtsopts=-T", the memory is constant and steady.
>
> Tested on Arch Linux with Stack LTS 13.14.
>
>
> If any one wants to test this, here are the steps: (server is standalone and
> does not require any external services (like DB, Redis, etc) and uses just a few
> MBs of RAM.)
>
> $ hg clone https://bitbucket.org/vlatkoB/poomas && cd poomas && stack build
>
> ## open your system monitor
>
>
> ## open two terminals in 'poomas' dir and in one run
>
> $ srvb.sh 5
>
> ## and in the other #
>
> $ srvb.sh 6
>
> ## (5 and 6 represent port number added to 3000, i.e. 3005 and 3006)
>
> ## Notice that memory is steady, around 6 MB on my machine.
>
>
> ## In 'server/package.yaml' comment out the line 139 (#-with-rtsopts=-T)
>
> $ stack build --force-dirty
>
> ## start those two servers again and see memory usage growing.
>
>
> Can anyone shed some light what could be happening here?
>
>
> Best regards,
>
> vlatko
>
> _______________________________________________
> ghc-devs mailing list
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Strange behavior of "-with-rtsopts=-T

Vlatko Basic
Hi Ömer,

It doesn't require Postgres, I just haven't cleaned up the dependencies. My bad. :-(

I pushed the cleaned version.


However, noticed strange thing during testing of the cleaned package. There is
no leak any more. And the problem is that I can't reproduce it, not even with
previous commits.

Without "-T", it does use double+ the memory (12-14 MB) than with "-T" (<5 MB),
which is strange, but the memory doesn't grow any more.

Will do more testing in the next few days. The only thing I can think of now is
that I updated something in the environment.


So, unless you're curious, there's no need to waste your time. Thanks for the
offer, though. :-)


br,

vlatko


On 06/06/2019 12:22, Ömer Sinan Ağacan wrote:

> Hi Vlatko,
>
> Unless this is a side effect of calling getrusage() (perhaps it causes the OS to
> update stats) I don't see how this is possible.
>
> Your reproducer seems to require postgres so I'm unable to run it. If you can
> provide a version that doesn't need postgres I can take a look.
>
> Ömer
>
> Vlatko Basic<[hidden email]>, 5 Haz 2019 Çar, 12:53 tarihinde
> şunu yazdı:
>> Hello ghc-devs,
>>
>> I wrote about this issue to haskell-cafe, but received no reply as of today, so
>> I'm hoping I could get some answer(s) here.
>>
>> I wrote a small Servant server that communicates with the same other server(s).
>>
>>
>> When compiled without "-with-rtsopts=-T", I see in 'gnome-system-monitor' that
>> memory used by each server constantly growing.
>>
>> I was investigating the issue, and found that it is (probably) not in my code,
>> but in one http call (Servant client call to the same server).
>>
>>
>> When I compile it with "-with-rtsopts=-T", the memory is constant and steady.
>>
>> Tested on Arch Linux with Stack LTS 13.14.
>>
>>
>> If any one wants to test this, here are the steps: (server is standalone and
>> does not require any external services (like DB, Redis, etc) and uses just a few
>> MBs of RAM.)
>>
>> $ hg clonehttps://bitbucket.org/vlatkoB/poomas  && cd poomas && stack build
>>
>> ## open your system monitor
>>
>>
>> ## open two terminals in 'poomas' dir and in one run
>>
>> $ srvb.sh 5
>>
>> ## and in the other #
>>
>> $ srvb.sh 6
>>
>> ## (5 and 6 represent port number added to 3000, i.e. 3005 and 3006)
>>
>> ## Notice that memory is steady, around 6 MB on my machine.
>>
>>
>> ## In 'server/package.yaml' comment out the line 139 (#-with-rtsopts=-T)
>>
>> $ stack build --force-dirty
>>
>> ## start those two servers again and see memory usage growing.
>>
>>
>> Can anyone shed some light what could be happening here?
>>
>>
>> Best regards,
>>
>> vlatko
>>
>> _______________________________________________
>> ghc-devs mailing list
>> [hidden email]
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs