Le 13/07/2012 21:40, Adam Monsen a écrit :
Just for fun, suppose you were

* using the Symfony2 framework
* writing a long-running PHP daemon process
* using monolog
* using the fingers-crossed handler at 'error', grouped with
   a stream handler at 'info'
* logging lots of info() messages in said long-running process
* using a buffer_size of 0 for said handler(s)

Is this just asking for a memory leak?

Looks like the default buffer_size is 0, meaning it will buffer forever
if an 'error' message is never handled.

Here's my logging config (did you really think this was just a
hypothetical?):

monolog:
     handlers:
         main:
           type:         fingers_crossed
           action_level: error
           handler:      grouped
         grouped:
           type: group
           members: [nested, mylog]
         nested:
           type:  stream
           path:  %kernel.logs_dir%/%kernel.environment%.log
           level: info
         mylog:
           type: service
           id: adams_custom_log_handler
           level: warning

Something tells me that most use of PHP is short-running, and a
long-running daemon written in PHP is going to have many memory leaks,
if not from PHP core, from the many libraries only considering their
code will be used from within anything besides long-running PHP processes.

The FingersCrossedHandler has an optional buffer limit. My advice would be to run your long running processes in a dedicated environment (importing the prod config as basis for instance) in which you can tweak some config (for instance adding a buffer limit on this handler). FYI, the configuration reference of MonologBundle (showing all possible options) is available on http://symfony.com/doc/current/reference/configuration/monolog.html

Symfony being a web framework, I don't think expecting long running processes for the prod environment is a the best expectation (your user will leave your site quickly if the process to generate it can be considered as long running). And as it supports environments, it is easy to have a separate environment with a configuration optimized for long running processes.

--
Christophe | Stof

--
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to