Author Topic: Infinite recursion on VM3.4.2 (Virtuemart bug)  (Read 374 times)

stAn99

  • Contributing Developer
  • Jr. Member
  • *
  • Posts: 79
    • One Page Checkout for Virtuemart 2
Infinite recursion on VM3.4.2 (Virtuemart bug)
« on: October 12, 2018, 10:50:20 am »
Hello friends, we just discovered a possible memory leak and infinite recursion bug on VM3.4.2 when handling 404 category pages in some cases.

we must had adjusted:
\components\com_virtuemart\views\category\view.html.php

original code:
Code: [Select]
//No redirect here, for category id = 0 means show ALL categories! note by Max Milbers
if ((!empty($this->categoryId) and $this->categoryId!==-1 ) and (empty($category->slug) or !$category->published)) {
$this->handle404();
}

with:
Code: [Select]
//No redirect here, for category id = 0 means show ALL categories! note by Max Milbers
if ((!empty($this->categoryId) and $this->categoryId!==-1 ) and (empty($category->slug) or !$category->published)) {
static $wasHere;
if (empty($wasHere)) {
$wasHere = true;
$this->handle404();
}
}

now the page simply says:
Category not found

which is better then waisting all available RAM of the server due to this.

also posted on our OPC's support forum:
https://www.rupostel.com/phpBB3/posting.php?mode=edit&f=7&p=7752

best regards, stan
----
RuposTel.com
www.rupostel.com
Your customized checkout solution for Virtuemart

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3390
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: Infinite recursion on VM3.4.2 (Virtuemart bug)
« Reply #1 on: October 12, 2018, 17:46:41 pm »
I have same problem when google try to load a unpublished category = infinit loop and have some time slowdown.
I hope it's the right solution and dev add a fix for this because a hacker can shutdown a shop only using this trick.

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2802
  • VirtueMart Version: 3.4
Re: Infinite recursion on VM3.4.2 (Virtuemart bug)
« Reply #2 on: October 13, 2018, 10:08:03 am »
If you cannot wait for a "fix"

Turn off Vm404 error handling in VM configuration

labelled "Enable VirtueMart 404 error handling"

The error handling will then use Joomla's default methods
regards
A

Joomla 3.8.13
php 7.1

thefbi

  • Jr. Member
  • **
  • Posts: 71
Re: Infinite recursion on VM3.4.2 (Virtuemart bug)
« Reply #3 on: October 13, 2018, 11:31:41 am »
Hello,

ok, thank you, that did the trick for now.

welrachid

  • Jr. Member
  • **
  • Posts: 248
  • 3rd party plugin developer
  • Skype Name: wel.rachid
  • VirtueMart Version: Always LATEST stable
Re: Infinite recursion on VM3.4.2 (Virtuemart bug)
« Reply #4 on: October 15, 2018, 10:28:50 am »
possible related issue removed since it was not related after all
Best regards,
Wel

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8186
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
Re: Infinite recursion on VM3.4.2 (Virtuemart bug)
« Reply #5 on: October 15, 2018, 12:38:48 pm »
no .. this is when no cat id is in the url
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

welrachid

  • Jr. Member
  • **
  • Posts: 248
  • 3rd party plugin developer
  • Skype Name: wel.rachid
  • VirtueMart Version: Always LATEST stable
Re: Infinite recursion on VM3.4.2 (Virtuemart bug)
« Reply #6 on: October 15, 2018, 13:17:49 pm »
im seeing this on all pages that i have running vm, where any 404 will generate this infinite loop. This means that _all_ new installations of vm will be "born" with this problem due to the missing .css file that has been removed.

when 404 handling is enabled in vm it will case this infinite loop (all my pages have sef friendly urls etc.)
Best regards,
Wel

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8186
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
Re: Infinite recursion on VM3.4.2 (Virtuemart bug)
« Reply #7 on: October 15, 2018, 13:33:04 pm »
This isn't true .. the recursion discussed here is a Frontend thing caused by the cat view

I just deleted my toolbar_images.css -- fine -- I get a 500 error

Error: Call to undefined method Joomla\CMS\Document\RawDocument::addHeadLink(): View not found [name, type, prefix]: category, css, contentView

but that's it -- even with full error and debugging it doesn't even throw a notice or log
I only see this error if I try to access the file directly administrator/components/com_virtuemart/assets/css/toolbar_images.css?vmver=01d6f5e0
  .. it gets treated like a normal missing file by the site, page loads normally and the page is as fast as ever

and certainly no recursion  -- the VM  404 error handling is a frontend thing

something is different on your server in the way that it is handling this error

but of course agree that the call to to this file must be removed
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

welrachid

  • Jr. Member
  • **
  • Posts: 248
  • 3rd party plugin developer
  • Skype Name: wel.rachid
  • VirtueMart Version: Always LATEST stable
Re: Infinite recursion on VM3.4.2 (Virtuemart bug)
« Reply #8 on: October 15, 2018, 13:48:49 pm »
i see.
Then you have more data than i have. I just used a fresh joomla installation (without any sample data) and then installed newest VM and then saw this problem.

Have you both SEF urls and rewrite enabled on the site you are testing with?
If they both are on, then i guess you are right.. that my issue was not related
Best regards,
Wel

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8186
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
Re: Infinite recursion on VM3.4.2 (Virtuemart bug)
« Reply #9 on: October 15, 2018, 13:50:02 pm »
Quote
Have you both SEF urls and rewrite enabled on the site you are testing with?

these settings have no effect on the admin
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

welrachid

  • Jr. Member
  • **
  • Posts: 248
  • 3rd party plugin developer
  • Skype Name: wel.rachid
  • VirtueMart Version: Always LATEST stable
Re: Infinite recursion on VM3.4.2 (Virtuemart bug)
« Reply #10 on: October 15, 2018, 14:07:03 pm »
So this frontend template has no effect on admin 404?
https://prnt.sc/l6a3it

remember that there is not .htaccess in the administrator directory, this means that /index.php will be the one handling files not found.

# RewriteBase /

## Begin - Joomla! core SEF Section.
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
#
## End - Joomla! core SEF Section.


Not sure if its something in the current template that is causing this (joomshaper helix3)
Best regards,
Wel

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8186
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
Re: Infinite recursion on VM3.4.2 (Virtuemart bug)
« Reply #11 on: October 15, 2018, 14:37:00 pm »
its showing its own page but  I cant see  $this->handle404(); from VM is involved
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

welrachid

  • Jr. Member
  • **
  • Posts: 248
  • 3rd party plugin developer
  • Skype Name: wel.rachid
  • VirtueMart Version: Always LATEST stable
Re: Infinite recursion on VM3.4.2 (Virtuemart bug)
« Reply #12 on: October 15, 2018, 15:37:08 pm »
removed link
Best regards,
Wel

stAn99

  • Contributing Developer
  • Jr. Member
  • *
  • Posts: 79
    • One Page Checkout for Virtuemart 2
Re: Infinite recursion on VM3.4.2 (Virtuemart bug)
« Reply #13 on: October 17, 2018, 15:05:41 pm »
hello, in some cases when default joomla htaccess for sef is used, missing static files (such as images, css, or else) load index.php and if the default page is virtuemart, then you also get the infinite loop per the problem described here.

that way 4 missing files will put down your server completely.

generally you must make sure that static files always return 404 without loading index.php

you can try to add this to your .htaccess to the front:

Code: [Select]
RewriteEngine On

#stan: never load index.php for static files:
RewriteRule ^(.*?)\.(php|css|js|jpg|jpeg|png|pdf|cur|eot|ttf|woff|ico|woff2|svg|json|txt)$ - [L]


you can adjust the list of static files extensions as needed.

best regards, stan
----
RuposTel.com
www.rupostel.com
Your customized checkout solution for Virtuemart