Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Juliette Reinders Folmer

    (@jrf)

    Hi Joy,

    Thanks for contacting me about this. Strangely enough I have both running at the same time as well without any problems…

    In other words, I need more info. There must be either a PHP error somewhere breaking things or a js errors.
    For js errors – please look in the js console of the browser.
    For PHP errors – please do a backtrace. If you’re not sure how to do this, you can find some simple instructions here: https://gist.github.com/jrfnl/5925642

    Smile,
    Juliette

    Thread Starter Joy

    (@joyously)

    Upon closer inspection, it looks like a memory issue, however it does not make much sense to me.
    The Debug Bar shows

    Memory Usage
    28,167,360 bytes

    The debug.log file shows
    PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 261904 bytes) in plugins\debug-bar-post-types\inc\debug-bar-pretty-output\class-debug-bar-pretty-output.php on line 166
    and then
    PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 261904 bytes) in plugins\debug-bar-post-types\inc\debug-bar-pretty-output\class-debug-bar-pretty-output.php on line 215
    twice since I tried it 4 times. I’m not sure why it is inconsistent in the memory size allowed.

    I deactivated 6 plugins, but I still get the fatal error. Now Debug Bar says

    Memory Usage
    25,869,808 bytes

    and the fatal error remains as PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 261904 bytes) in plugins\debug-bar-post-types\inc\debug-bar-pretty-output\class-debug-bar-pretty-output.php on line 215
    Still, the post types show, but the roles and capabilities do not.

    Plugin Author Juliette Reinders Folmer

    (@jrf)

    Hi Joy,

    This has nothing to do with the plugin, but with your WP/server setup.
    Deactivating plugins may help, but generally won’t make the error go away.

    Please have a look here:
    http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP
    https://tommcfarlin.com/wordpress-fatal-error-memory-exhausted/

    I’m marking this topic as resolved as it is not caused specifically by this plugin.

    Smile,
    Juliette

    Thread Starter Joy

    (@joyously)

    I sort of figured out why the memory size was inconsistent. It still does not make sense.
    My php.ini has 128M. I do not have any WP constants defined for memory limits, so the code defines WP_MEMORY_LIMIT to 40M and WP_MAX_MEMORY_LIMIT to 256M. And if the ini value is less than WP_MEMORY_LIMIT, it will ini_set to that. (But mine was already higher, so it would not.)

    So the error with the lower number (128M) was when I tried to look at the debug bar on the visitor side, and the higher number (256M) was when I looked at the debug bar on the admin side.

    I found that even if I specified a higher WP_MAX_MEMORY_LIMIT such as 368M, all was used and I got the error. So I deactivated all plugins except for Debug Bar and Debug Bar Post Types, and it worked. I discovered it is Easy Post Types that appears to be using the memory.
    So, yes, this is sort of resolved, but not for the reason you thought. I was using Easy Post Types a long time(with many other plugins) without memory errors until I tried Debug Bar Post Types, so there is still a question in my mind of where the problem is. The error lists this plugin as the one trying to get memory.

    Plugin Author Juliette Reinders Folmer

    (@jrf)

    Hi Joy,

    While I appreciated what you are saying, it really is not this plugin which is at issue. And it might well not be Easy Post Types either.

    To help you understand: it’s like you and ten other people are slowly filling a bucket with water. Everyone throws a bit in. At some point the bucket is full and will overflow. This is not because of person X throwing that last bit of water in, but because everyone has thrown water in.

    The error message mentions the plugin which was trying to use memory at the point of overflowing, not the plugin which has used most memory up to that point.
    So wildly blaming one plugin or another is neither here nor there.

    What you need to do is either increase the available memory (get a bigger bucket) or use a profiling tool like P3 profiler on your install to figure out which plugin is using *most* memory.

    Hope that helps.

    Smile,
    Juliette

    Thread Starter Joy

    (@joyously)

    Juliette,
    I can see your viewpoint, but I am an experienced programmer and know how this works. I don’t think you are off the hook…

    When I test without Easy Post Types, it all works.
    When I test without Debug Bar Post Types, it all works.
    It is only when both are used together that there is a memory issue.
    Perhaps Easy Post Types is defining something wrong and your plugin gets into an infinite loop trying to print it out. Or maybe Debg Bar Post Types is hooking into something that causes Easy Post Types to get into some crazy loop(recursive data or something).
    I already tried increasing memory, but it is used up regardless of what I set it to.

    Plugin Author Juliette Reinders Folmer

    (@jrf)

    Hi Joy,

    Good point – if it is the combination with EPT, there could be a race condition.

    All the same, I’ve seen DBPT working without any issues with other custom post type plugins such as Custom Content Type Manager and My Content Management, so I have a niggling feeling EPT might be doing something funky, though I haven’t tested this to confirm.

    DBPT is at the end of the day, just a very simple plugin which only shows the info on the registered post types, nothing more.

    Smile,
    Juliette

    Plugin Author Juliette Reinders Folmer

    (@jrf)

    Actually – just thinking, if EPT has a very complex nested object/array structure for some of their properties (can’t think which or even why….), that might easily be the reason as the print function does not have a limit on the level of nesting.

    Plugin Author Juliette Reinders Folmer

    (@jrf)

    Hi Joy,

    I’ve looked into this further and turns out that my last remark was spot on. EPT is using some convoluted way of storing their data resulting in nested objects and arrays with a depth of over 100!!!
    When testing locally I could confirm this: Fatal error: Maximum function nesting level of '100' reached, aborting!
    That is easily the reason that you were running out of memory.
    I’ve updated the plugin now to limit the recursion depth. That should solve your problem.

    Please be aware that if you’re using any of the following plugins, you’ll also need to update those to make sure the updated Pretty Print class gets loaded.
    Debug Bar Constants (update should be available)
    Debug Bar Screen Info (update expected soon – send in PR)

    All the same – it would not be a bad idea for the devs of EPT to rethink their plugin object structure…. just my two pennies…

    Smile,
    Juliette

    Thread Starter Joy

    (@joyously)

    Thank you so much for pursuing this to perfect your code. A loop without a limit can be trouble!

    First impressions can be deceiving.
    I posted a support topic for Easy Post Types, but no response yet.

    Plugin Author Juliette Reinders Folmer

    (@jrf)

    You’re welcome and thanks for helping me figure out what was really going wrong.

    Seriously, I hope EPT gets their act together as they really are doing something silly, but in the mean time, it won’t break this plugin anymore (nor your site).

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘conflict with Debug Bar Roles and Capabilities’ is closed to new replies.