MLA attachment page memory leak?
-
If a media attachment in the media library is unattached and the Media Library Assistant plugin is active, something about the call to the ***_image_link() function in the image or attachment template produces an error:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 3 bytes) in ….[host]/wordpress/wp-includes/wp-db.php on line 1780
That kicks the WP loop out of the code early, lopping off whatever code should have been processed afterward. I’ve read that it may be a memory leak in the code or an infinite loop. Over a year ago (Jan. 15, 2015), when I addressed the problem with you, David, you concluded:
WordPress just stopped processing everything when it hit the PHP code for the nav-links section of your page. Without access to the server and the PHP template for your attachment page it is hard to be more specific, but it is a server-side code problem, not an HTML formatting problem. You said that W3 Total Cache is not running; are there other plugins active at this point?
If you can’t solve this problem, I could look at your template file. Don’t post the template here. You can give me your contact information and I will respond with an address where you can e-mail the template file to me.
You later wrote, “It has been a month since my last post in this topic. I assume you have found a solution to your truncated HTML output issue,” before marking the topic “resolved.” However, I had never found a solution to the issue. I either had partially satisfactory workarounds or I just accepted the issue.
The problem is not in the template, because when the MLA plugin is deactivated, all attachment pages display properly with no error, and files that are attached to a post also display properly even with MLA active. It doesn’t matter which theme is being used: the loop breaks upon reaching the image_link() function. But I would like to have gallery pages of images that aren’t attached and need for the WP loop to complete for those images’ attachment pages. Moreover, when MLA is active and I configure the (Photo) Gallery plugin (by WebDorado [https://www.ads-software.com/plugins/photo-gallery/]) to “Import from Media Library” and then try to add images, the pop-up frame indicates an Internal Server error that does not happen when MLA is deactivated.
Is there any way you can investigate the portion of the code that breaks the Loop when MLA queries the database? The line in the WordPress DB class (wp-db.php) where the error occurs is in the public function “query($query),” which begins on Line 1677.
When MLA is active, attachment tag classes are added to the article html tag, but not when it is not active. But the attachment tag classes are no problem when the attachment has a parent.
I’ve done some digging for when WP calls anything with “_image_link(” and found four relevant files: An example image.php in the MLA directory, my theme’s image.php, class-simplepie.php, and media.php. The latter two are in the wp-includes directory, which I think makes them core files.
I guess when the Loop gets to the nav-links in the attachment template file, it goes to the previous_image_link() function in wp-includes/media.php (Line 2597), which then calls the adjacent_image_link() function (Line 2629).
I can’t replicate the problem on my localhost. I downgraded my MAMP application so that I could simulate PHP 5.3, which is what is installed on my live remote server. I even tried to copy the contents of my remote htaccess file to localhost. Nothing makes any difference. On my localhost, the attachment pages render perfectly even for unattached files and the media library option in the Gallery plugin works with MLA active. It doesn’t appear to be a problem with the template; if it’s a server-side problem, I sure would like to know what it is so that I can get it fixed.
Thank you, in advance, for your efforts.
This unattached image attachment page demonstrates the appearance of the problem. But when the image is attached to a post, there is no problem performing the query and completing the page. If I deactivate MLA, even the former attachment page is complete.
https://www.ads-software.com/plugins/media-library-assistant/
- The topic ‘MLA attachment page memory leak?’ is closed to new replies.