Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

[2.2] some deprecations logs make my log file huge #7259

Closed
bamarni opened this Issue · 9 comments

4 participants

@bamarni

When requesting a page on a staging server, apache returns a 500 because there is a huge log file being generated, the php memory limit is getting reached.

I can see the generated log file size is 170 Megabytes, even after deleting it and re-requesting, it fails again and regenerates this same huge log file.

It looks like it's because of some deprecation traces, they contain a long stack trace in JSON, is it intended?

For example this one :

[2013-03-04 16:57:52] deprecation.WARNING: UserPassword class in Symfony\Compone
nt\Security\Core\Validator\Constraint namespace is deprecated since version 2.2 
and will be removed in 2.3. Use the Symfony\Component\Security\Core\Validator\Co
nstraints\UserPassword class instead. {"type":-100,"stack":[{"function":"handle"
,"class":"Symfony\\Component\\HttpKernel\\Debug\\ErrorHandler","type":"->","args
":[16384,"UserPassword class in Symfony\\Component\\Security\\Core\\Validator\\C
onstraint namespace is deprecated since version 2.2 and will be removed in 2.3. 
Use the Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPassword
 class instead.","/home/acme.com/test/vendor/symfony/symfony/src/Symfony/Compon
ent/Security/Core/Validator/Constraint/UserPassword.php",25,{"options":"NULL"}]}
,{"file":"/home/acme.com/test/vendor/symfony/symfony/src/Symfony/Component/Secu
rity/Core/Validator/Constraint/UserPassword.php","line":25,"function":"trigger_e
rror","args":["UserPassword class in Symfony\\Component\\Security\\Core\\Validat
or\\Constraint namespace is deprecated since version 2.2 and will be removed in 2.3. Use the Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPassword class instead.",16384]},{"file":"/home/acme.com/test/vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Form/Type/ProfileFormType.php","line":39,"function":"__construct","class":"Symfony\\Component\\Security\\Core\\Validator\\Constraint\\UserPassword","type":"->","args":[]},{"file":"/home/acme.com/test/src/Acme/UserBundle/Form/Type/ProfileFormType.php","line":15,"function":"buildForm","class":"FOS\\UserBundle\\Form\\Type\\ProfileFormType","type":"->","args":[{"username":"NULL","email":"NULL","country":"NULL","locality":"NULL","birthday":"NULL","sexe":"NULL","presentation":"NULL","avatar":"NULL","site":"NULL","site_description":"NULL","plainPassword":"NULL","plainPasswordConfirm":"NULL"},{"block_name":"NULL","data_class":"Acme\\UserBundle\\Entity\\User","empty_data":"[object] (Closure: {})","trim":"true","required":"true","read_only":"false","disabled":"false","max_length":"NULL","pattern":"NULL","property_path":"NULL","mapped":"true","by_reference":"true","error_bubbling":"true","label":"NULL","attr":[],"label_attr":[],"virtual":"false","compound":"true","translation_domain":"NULL","error_mapping":[],"validation_constraint":"NULL","constraints":[],"cascade_validation":"false","invalid_message":"This value is not valid.","invalid_message_parameters":[],"extra_fields_message":"This form should not contain extra fields.","post_max_size_message":"The uploaded file was too large. Please try to upload a smaller file.","csrf_protection":"true","csrf_field_name":"_token","csrf_provider":"[object] (Symfony\\Component\\Form\\Extension\\Csrf\\CsrfProvider\\SessionCsrfProvider: {})","intention":"profile","validation_groups":["Profile","Default"]}]},{"file":"/home/acme.com/test/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormType.php","line":167,"function":"buildForm","class":"Acme\\UserBundle\\Form\\Type\\ProfileFormType","type":"->","args":[{"username":"NULL","email":"NULL","country":"NULL","locality":"NULL","birthday":"NULL","sexe":"NULL","presentation":"NULL","avatar":"NULL","site":"NULL","site_description":"NULL","plainPassword":"NULL","plainPasswordConfirm":"NULL"},{"block_name":"NULL","data_class":"Acme\\UserBundle\\Entity\\User","empty_data":"[object] (Closure: {})","trim":"true","required":"true","read_only":"false","disabled":"false","max_length":"NULL","pattern":"NULL","property_path":"NULL","mapped":"true","by_reference":"true","error_bubbling":"true","label":"NULL","attr":[],"label_attr":[],"virtual":"false","compound":"true","translation_domain":"NULL","error_mapping":[],"validation_constraint":"NULL","constraints":[],"cascade_validation":"false","invalid_message":"This value is not valid.","invalid_message_parameters":[],"extra_fields_message":"This form should not contain extra fields.","post_max_size_message":"The uploaded file was too large. Please try to upload a smaller file.","csrf_protection":"true","csrf_field_name":"_token","csrf_provider":"[object] (Symfony\\Component\\Form\\Extension\\Csrf\\CsrfProvider\\SessionCsrfProvider: {})","intention":"profile","validation_groups":["Profile","Default"]}]},{"file":"/home/acme.com/test/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormType.php","line":126,"function":"buildForm","class":"Symfony\\Component\\Form\\ResolvedFormType","type":"->","args":[{"username":"NULL","email":"NULL","country":"NULL","locality":"NULL","birthday":"NULL","sexe":"NULL","presentation":"NULL","avatar":"NULL","site":"NULL","site_description":"NULL","plainPassword":"NULL","plainPasswordConfirm":"NULL"},{"block_name":"NULL","data_class":"Acme\\UserBundle\\Entity\\User","empty_data":"[object] (Closure: {})","trim":"true","required":"true","read_only":"false","disabled":"false","max_length":"NULL","pattern":"NULL","property_path":"NULL","mapped":"true","by_reference":"true","error_bubbling":"true","label":"NULL","attr":[],"label_attr":[],"virtual":"false","compound":"true","translation_domain":"NULL","error_mapping":[],"validation_constraint":"NULL","constraints":[],"cascade_validation":"false","invalid_message":"This value is not valid.","invalid_message_parameters":[],"extra_fields_message":"This form should not (...)

The strange thing is that I can't reproduce this locally, even with the same database dump than the staging server, both projects are to the same git hash and vendors installed from the same composer.lock file, but my local environment is not exactly the same so maybe it's related to a PHP/system setting?

@stof
Collaborator

@Seldaek The handling of the exception key in the context may need to be improved in Monolog. This becomes visible now that Symfony starts using this PSR-3 convention to log exceptions.

@Seldaek

What kind of improvements are you thinking of?

@stof
Collaborator

Well, probably avoiding to dump the whole stack trace in the LineFormatter but only the message (and the message of the previous exception) as stack traces tend to be very long.

@Seldaek

Can you try with latest monolog see if it looks better? However I'm not sure if the message you were seeing came from monolog's serialization. Looks like it might be something symfony does when logging.

@bamarni

I've updated deps on the remote server, now monolog is at dd0b216e0229a24178c2f0782f8a7172c7ed1c96, I'm still getting this issue and a 170MB log file.

But actually I don't think it's because of monolog, the huge log file looks like a side effect of an infinite loop or something like that, I'm still under the impression I have the same issue than @craue in #7043.

I've also noticed another page where it happens, both of those pages are related to FOSUserBundle (registration page + edit user preferences page), unfortunately I can't investigate more than that as I can't reproduce it locally, it only occurs on the remote server.

@stof
Collaborator

@bamarni note that FOSUserBundle should not trigger the deprecated error on these pages if you update the bundle to the latest version

@bamarni

@stof : ok thx for the tip, but I can't do that currently, this was a 2.0 symfony application I had to upgrade, but I've noticed some sort of BC breaks when upgrading fosuserbundle to master, so I prefer stick it to 1.3 for now.

@Seldaek Seldaek referenced this issue from a commit in Seldaek/symfony
@Seldaek Seldaek [HttpKernel] Remove args from 5.3 stack traces to avoid filling log f…
…iles, fixes #7259
99256e4
@fabpot fabpot referenced this issue from a commit
@fabpot fabpot merged branch Seldaek/fix-deprecated-logs (PR #7587)
This PR was merged into the 2.2 branch.

Discussion
----------

[2.2][HttpKernel] Remove args from 5.3 stack traces to avoid filling log files

Fixes #7259 - it just makes the PHP 5.3 behavior match the one on 5.4.

Commits
-------

99256e4 [HttpKernel] Remove args from 5.3 stack traces to avoid filling log files, fixes #7259
bf30a3d
@fabpot fabpot closed this
@fabpot fabpot referenced this issue from a commit
@fabpot fabpot Merge branch '2.2'
* 2.2:
  Fix finding ACLs from ObjectIdentity's with different types
  [HttpKernel] tweaked previous merge
  #7531: [HttpKernel][Config] FileLocator adds NULL as global resource path
  Fix autocompletion of command names when namespaces conflict
  Fix timeout in Process::stop method
  fixed CS
  Round stream_select fifth argument up.
  Fix Process timeout
  [HttpKernel] Remove args from 5.3 stack traces to avoid filling log files, fixes #7259
  bumped Symfony version to 2.2.2-DEV
  updated VERSION for 2.2.1
  updated CHANGELOG for 2.2.1
  Fixed phpdoc blocks to show that $uri can be passed as a string or ControllerReference (rather than just as a string)
  [HttpFoundation] Fixed copy pasted comment from FlashBag in AttributeBag
  [FrameworkBundle] fixed the discovery of the PHPUnit configuration file when using aggregate options like in -vc app/ (closes #7562)
  [WebProfilerBundle] removed next pointer class in a template
  fix overwriting of request's locale if attribute _locale is missing

Conflicts:
	src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php
	src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php
	src/Symfony/Component/HttpKernel/Kernel.php
83e078a
@bamarni

it fixed my issue thx

@mmucklo mmucklo referenced this issue from a commit
@fabpot fabpot merged branch Seldaek/fix-deprecated-logs (PR #7587)
This PR was merged into the 2.2 branch.

Discussion
----------

[2.2][HttpKernel] Remove args from 5.3 stack traces to avoid filling log files

Fixes #7259 - it just makes the PHP 5.3 behavior match the one on 5.4.

Commits
-------

99256e4 [HttpKernel] Remove args from 5.3 stack traces to avoid filling log files, fixes #7259
674d72b
@hackzilla hackzilla referenced this issue from a commit
@fabpot fabpot Merge branch '2.2'
* 2.2:
  Fix finding ACLs from ObjectIdentity's with different types
  [HttpKernel] tweaked previous merge
  #7531: [HttpKernel][Config] FileLocator adds NULL as global resource path
  Fix autocompletion of command names when namespaces conflict
  Fix timeout in Process::stop method
  fixed CS
  Round stream_select fifth argument up.
  Fix Process timeout
  [HttpKernel] Remove args from 5.3 stack traces to avoid filling log files, fixes #7259
  bumped Symfony version to 2.2.2-DEV
  updated VERSION for 2.2.1
  updated CHANGELOG for 2.2.1
  Fixed phpdoc blocks to show that $uri can be passed as a string or ControllerReference (rather than just as a string)
  [HttpFoundation] Fixed copy pasted comment from FlashBag in AttributeBag
  [FrameworkBundle] fixed the discovery of the PHPUnit configuration file when using aggregate options like in -vc app/ (closes #7562)
  [WebProfilerBundle] removed next pointer class in a template
  fix overwriting of request's locale if attribute _locale is missing

Conflicts:
	src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php
	src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php
	src/Symfony/Component/HttpKernel/Kernel.php
287a2d3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.