tobybatch / kimai2

Docker containers for the kimai2 web application including docker-compose and kubernetes/helm deployment.
MIT License
183 stars 97 forks source link

[BUG] Invalid default memory limit value #503

Closed tomiwagner closed 1 year ago

tomiwagner commented 1 year ago

Describe the bug I think an M character at the end is missing in this line: https://github.com/tobybatch/kimai2/blob/v2.0.4/Dockerfile#L292 I would also suggest to raise the default limit to 256Mb, I used the Apache2 version of the docker image and had to raise it manually. It would be also nice to make that option visible in the docker-compose templates too.

To Reproduce Steps to reproduce the behaviour:

  1. Start the container '...'
  2. During cache cleanup I saw this on the console

kimai-rbtx | PHP Warning: Failed to set memory limit to 128 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0

...

Rebuilding your cache, please be patient ...

// Clearing the cache for the prod environment with debug false

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32768 bytes) in /opt/kimai/var/cache/pro_/twig/80/80b1a970d52620b001fa7d3df0e64a53.php on line 1 PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /opt/kimai/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php on line 61

...

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32768 bytes) in /opt/kimai/var/cache/pro_/twig/19/1966ee3864ef99a9ddc83df588ff2bca.php on line 224 PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32768 bytes) in /opt/kimai/vendor/symfony/var-dumper/Dumper/CliDumper.php on line 1

By the way let me say thank you for this project, I really love it!

tobybatch commented 1 year ago

Which image are you using

tomiwagner commented 1 year ago

I just did a bunch of upgrades, the memory error started with v2 (as far as I remember) Now I'm using kimai/kimai2:apache-2.0.14-prod

tobybatch commented 1 year ago

the 2.x images aren't supported yet. have you tried passing 256M as the memory limit value and seeing if that woks.

tomiwagner commented 1 year ago

Yes, works like a charm :)

I just added this to the docker-compose.yml:

    environment:
    ...
      - memory_limit=256M
Fratt commented 1 year ago

Yes, works like a charm :)

I just added this to the docker-compose.yml:

    environment:
    ...
      - memory_limit=256M

Thank you very much!

shrippen commented 1 year ago

That fix isn't working for me sadly. Still get the same error message. When switching back to 2.0.14 I also get the memory size error but website is coming up... Weird!

shrippen commented 1 year ago

I still get this error PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /opt/kimai/vendor/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php on line 62 14:33:53 CRITICAL [php] Fatal Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) ["exception" => Symfony\Component\ErrorHandler\Error\OutOfMemoryError { …}]

Using the kimai/kimai2:apache docker image.

I have tried adding memory_limit 500M to the env variables, but it didn't help. Has anybody an idea?

shrippen commented 1 year ago

Switched to the fpm image with the provided nginx proxy. Works now. So it is related to the apache image. But that works for me.