Skip to content
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

Infinite loading when entering settings or editing a customer #685

Closed
magiruuvelvet opened this issue Apr 8, 2019 · 24 comments · Fixed by #710
Closed

Infinite loading when entering settings or editing a customer #685

magiruuvelvet opened this issue Apr 8, 2019 · 24 comments · Fixed by #710

Comments

@magiruuvelvet
Copy link

Describe the bug
Entering the system configuration page or customer edit page results in infinite loading and eventually a timeout. The php-fpm generates high CPU usage in the meantime. The memory usage increases during this process.

To Reproduce
Steps to reproduce the behavior:

  1. Go to System Settings or Edit a Customer
  2. Infinite loading

Logfile

[2019-04-08 18:59:39] php.CRITICAL: Fatal Error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 268435464 bytes) {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\OutOfMemoryException(code: 0): Error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 268435464 bytes) at /caddy/kimai/app/vendor/symfony/intl/Data/Bundle/Reader/BundleEntryReader.php:134)"} []
[2019-04-08 18:59:39] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\OutOfMemoryException: "Error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 268435464 bytes)" at /caddy/kimai/app/vendor/symfony/intl/Data/Bundle/Reader/BundleEntryReader.php line 134 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\OutOfMemoryException(code: 0): Error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 268435464 bytes) at /caddy/kimai/app/vendor/symfony/intl/Data/Bundle/Reader/BundleEntryReader.php:134)"} []

Logfile (Server/php-fpm)

08/Apr/2019:20:56:59 +0200 [ERROR 504 /index.php] read unix @->/run/php-fpm/php-fpm.sock: i/o timeout

There doesn't seem to be a very helpful error message. I increased the memory limit to 2GB, but it just takes longer to get to the exception.

Additional context

  • Kimai version: 3a4aa5a
  • PHP version
PHP 7.3.4 (cli) (built: Apr  5 2019 12:40:33) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.4, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.4, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.7.0, Copyright (c) 2002-2019, by Derick Rethans
  • Web server: Caddy
http://kimai.local {
    bind 127.0.0.1
    bind ::1
    root /caddy/kimai/app/public
    timeouts none
    fastcgi / unix:/run/php-fpm/php-fpm.sock php {
        env APP_ENV prod
        env APP_SECRET kimai2
        env DATABASE_URL mysql://kimai:kimai@127.0.0.1:3306/kimai
        env MAILER_FROM bot@kimai.local
        env MAILER_URL smtp://127.0.0.1:25/
        env SQL_PROTOCOL mysql
        connect_timeout 120s
        read_timeout 180s
        send_timeout 180s
    }
    rewrite {
        to  {path} {path}/ /index.php?_url={uri}
    }
    errors /caddy/kimai/error.log
    header / -Server
    header / -X-Powered-By
}

I double checked file permissions to be absolutely sure its not a permission related problem.

I also tried an older version, but I have the same issue. Not sure what is going on there.

It works in the docker container, but I want to migrate kimai to the host system as I'm interested into contributing to the project.

@kevinpapst
Copy link
Member

kevinpapst commented Apr 8, 2019

Never seen that error. The usual out-of-memory, caused by wrong file permissions for the log file has a different exception root.

Your exception seems to be initiated/caused by the Symfony "intl" replacement drop-in bundle, which is ONLY used as fallback when the real php-into extension is not existing on the system.
This Symfony bundle does only support en and maybe I should get rid of it completely.

Either way, please install php-intl (package name depends on your PHP version and OS) and check if the error goes away.

@magiruuvelvet
Copy link
Author

magiruuvelvet commented Apr 9, 2019

I just checked that php-intl is already installed and enabled.

EDIT: I also tried Apache now, but the same result.

@kevinpapst
Copy link
Member

Then I can only help to poke around to find the reason, as I really have no clue whatsoever what this might be.

  • Does the latest stable version work?
  • Is that a problem of the last commit or some general problem on your system?
  • Try to do a composer remove symfony/intl symfony/polyfill-intl-icu and reload the critical pages.
  • Delete vendor and do a reinstall via composer install
  • Are only these two pages the problem or is it happening on all pages?
  • Did you change anything in the configs like the locales?

@magiruuvelvet
Copy link
Author

I removed those 2 dependencies and also did a composer reinstall. My guess is that it could be a issue with my PHP setup. I'm on Arch Linux.

I have added these lines to my local.yaml:

# --------------------------------------------------------------------------------
# Framework Settings
framework:
    default_locale: "ja"
    translator:
        fallbacks:
            - "en"
    session:
        save_path:   "/caddy/kimai/data/sessions/%kernel.environment%"

Enabled extensions:

extension=bcmath
extension=bz2
extension=calendar
extension=curl
extension=dba
extension=exif
extension=ftp
extension=gd
extension=gettext
extension=gmp
extension=iconv
extension=imap
extension=intl
extension=sodium
extension=mysqli
extension=odbc
zend_extension=opcache
extension=pdo_dblib
extension=pdo_mysql
extension=pdo_odbc
extension=pdo_pgsql
extension=pdo_sqlite
extension=pgsql
extension=sockets
extension=sqlite3
extension=tidy
extension=xmlrpc
extension=xsl
extension=zip
extension=apc
extension=apcu
extension=memcache
extension=memcached

There are no issues inside the docker container, even with my modifications. I'm out of ideas how to debug this. Starting php-fpm in foreground doesn't print any log messages to the terminal.

@kevinpapst
Copy link
Member

I added your config to my local installation, no change visible.
What if you remove the complete framework config part (clear cache afterwards)?

Maybe you try to add some debug statements to the file /caddy/kimai/app/vendor/symfony/intl/Data/Bundle/Reader/BundleEntryReader.php
maybe something inside results in an endless loop and consumes more and more memory.

@magiruuvelvet
Copy link
Author

magiruuvelvet commented Apr 9, 2019

I managed to build a custom docker container based on the official one which is owned by me (UID 1000). I will post the docker files and build scripts later. Still need to adjust some things here and there.

I gave up getting this running on the host system.

EDIT: I had other problems with the API too, it leaked everything everywhere and ignored roles and permissions. The problem doesn't seem to exist in a Debain Stretch container, but on Arch Linux.

EDIT2:
kimai-docker-uid1000.zip
If you want to take a look, but it works now for me. Kimai is stored on the host system and uses the database on the host system as well.

@kevinpapst
Copy link
Member

Thanks for sharing and your feedback!
Looking forward for any contribution 👍

@ghost
Copy link

ghost commented Apr 14, 2019

Hi

I have exactly the same problem.

I'm using Arch as well but no docker installation. There is actually no proper log available.

I tried all your suggestions above but nothing worked so far.

Everything else works fine, only the customer area seems to have some problems.

If I find a solution I'll let you know.

Edit:
By the way, I imported everything from kimaiv1 to kimaiv2.

@kevinpapst
Copy link
Member

Which server are you using @dansman ?

@kevinpapst kevinpapst reopened this Apr 14, 2019
@ghost
Copy link

ghost commented Apr 14, 2019

I use my server at home. Nothing special. An old laptop.
ip= 192.168.1.76:port
Nginx
mariadb

I can try it on linode with arch as well if you want to but I guess there will be no difference.

@kevinpapst
Copy link
Member

Which PHP version?
Which PHP modules are installed?
How many customer have you created?
Can you add some debug statements to the files?
I am keen to fix this, if its a Kimai bug - I just don't know how to reproduce the problem...

@ghost
Copy link

ghost commented Apr 15, 2019

Hi Kevin
I created 12 customers with kimaiv1 - import to kimaiv2.

PHP 7.3.4

[PHP Modules]

apcu
Core
ctype
curl
date
dom
fileinfo
filter
gd
gmp
hash
iconv
imagick
intl
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
sockets
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

Enabled

;extension=bcmath
;extension=bz2
;extension=calendar
extension=curl
;extension=dba
;extension=enchant
;extension=exif
;extension=ftp
extension=gd
;extension=gettext
extension=gmp
extension=iconv
;extension=imap
extension=intl
;extension=sodium
;extension=ldap
extension=mysqli
;extension=odbc
zend_extension=opcache
;extension=pdo_dblib
extension=pdo_mysql
;extension=pdo_odbc
;extension=pdo_pgsql
extension=pdo_sqlite
;extension=pgsql
;extension=pspell
;extension=shmop
;extension=snmp
;extension=soap
extension=sockets
extension=sqlite3
;extension=sysvmsg
;extension=sysvsem
;extension=sysvshm
;extension=tidy
;extension=xmlrpc
;extension=xsl
extension=zip

extension=apcu.so
apc.enabled=1
apc.shm_size=32M
apc.ttl=7200
apc.enable_cli=1

mariadb 10.3.14-1

Nginx 1.14.2-1

Log

2019/04/16 09:25:39 [error] 19865#19865: *52 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 192.168.1.74, server: 192.168.1.76, request: "GET /de/admin/customer/2/edit HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock", host: "192.168.1.76:port", referrer: "http://192.168.1.76:port/"

Config

server {
  listen port;
  server_name 192.168.1.76;

  root /srv/http/kimai2/public;

  location / {
      # try to serve file directly, fallback to index.php
      try_files $uri /index.php$is_args$args;
    }

    location ~ ^/index\.php(/|$) {
#      fastcgi_pass 127.0.0.1:9000;
      fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
      fastcgi_split_path_info ^(.+\.php)(/.*)$;
      include fastcgi_params;
        fastcgi_read_timeout 120;

      # optionally set the value of the environment variables used in the application
#      fastcgi_param APP_ENV prod;
#      fastcgi_param APP_SECRET <app-secret-id>;
#      fastcgi_param DATABASE_URL "mysql://db_user:db_pass@host:3306/db_name";

  # When you are using symlinks to link the document root to the
  # current version of your application, you should pass the real
  # application path instead of the path to the symlink to PHP
  # FPM.
  # Otherwise, PHP's OPcache may not properly detect changes to
  # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
  # for more information).

  fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
  fastcgi_param DOCUMENT_ROOT $realpath_root;

  # Prevents URIs that include the front controller. This will 404:
  # http://domain.tld/index.php/some-path
  # Remove the internal directive to allow URIs like this

  internal;
  }

  # return 404 for all other php files not matching the front controller
  # this prevents access to other php files you don't want to be accessible.

  location ~ \.php$ {
    return 404;
  }

  error_log /var/log/nginx/kimai2_error.log;
  access_log /var/log/nginx/kimai2_access.log;
}

Can you add some debug statements to the files?

Which files?

No other useful logs available.

@glukose
Copy link

glukose commented Apr 16, 2019

Hey,
Your bug might be related to symfony/symfony#31089 & mautic/mautic#7408
You should upgrade to Symfony 4.2.5 or try to patch it with this : mautic/mautic#7408 (comment)

Cheers

@kevinpapst
Copy link
Member

Thanks @glukose for the info, that's very helpful.
Updating to Symfony 4.2 is on my roadmap, I guess that makes it urgent now...

@kevinpapst kevinpapst added this to the 0.9 milestone Apr 16, 2019
@ghost
Copy link

ghost commented Apr 16, 2019

Thanks @glukose & @kevinpapst

I check it then when everything is up to date.

@kevinpapst
Copy link
Member

Can you please test the PR #710 @dansman @magiruuvelvet ?

@ghost
Copy link

ghost commented Apr 17, 2019

Hi

Thanks for the quick solution. No problems so far anymore here.

@kevinpapst
Copy link
Member

@dansman There were problems reported by @magiruuvelvet for Arch Linux and PHP 7.3 with these changes. Could you have a look at the comments in #720 and let me know if you experience the same problems with the API requests or if it works on your end as expected?

@ghost
Copy link

ghost commented Apr 21, 2019

Hi

Sorry for the delay.

Is it still a problem? I can't find #720. Do you mean #710?
I actually never used API. I need advice for it.
I use global activities if it is necessary information.

@kevinpapst
Copy link
Member

Yes, that was a typo, I meant #710
The API is automatically used in the customer, project and activity select boxes.
Do they work as expected?

  • projects: show the filtered projects for the selected customer
  • activities: show the global activities and the project specific activities

This should be true for the "edit timesheet" and the toolbar-filter.

@ghost
Copy link

ghost commented Apr 21, 2019

Yes, that's working fine.

Like I said, I use only global activities.
Some of my customers has 2 or more projects. So when I choose the customer I'll see only the created projects of the customer.

@kevinpapst
Copy link
Member

Perfect, thats what I wanted to hear. Thanks for your feedback!

@ghost
Copy link

ghost commented Apr 23, 2019

You are welcome.
Thank you too.

@lock
Copy link

lock bot commented Jun 22, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. If you use Kimai on a daily basis, please consider donating to support further development of Kimai.

@lock lock bot locked and limited conversation to collaborators Jun 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging a pull request may close this issue.

3 participants