theillo Posted December 29, 2016 Share Posted December 29, 2016 I had this problem before and I updated to ver 1.6.10, and it fixed it for a while. But now it's back: I'm trying to create or edit a product. Loading the actual page takes about 4 seconds. Then it loads each product tab via Ajax. And always one of them will randomly not load, giving a 404 response to the ajax request (which then logs this to the console). If I check my server logs, they'll always say "premature end of script headers". This now leads to the "save" and "save and stay" buttons to stay in they loading state, and I'll never be able to click them. For a while I tried Firefox instead of chrome, and I had no problems with FF. Since the update it only worked on chrome, FF gave problems right away. I am able to click on each tab and it'll load the tab once clicked. But for the initial setup it's trying to load all the tabs, fails on one, and this causes it to be unusable. I am unable to create or edit products right now. And the problem is also very random: Sometimes it'll be "features" that can't be loaded, sometimes "attachments"... In addition to that I get random 404 error pages when trying to navigate my back office. I'll refresh and it works again. Super annoying! What could be causing this and how can I fix it? Link to comment Share on other sites More sharing options...
vekia Posted January 1, 2017 Share Posted January 1, 2017 product page has several sections like informations ,associations, prices, images etc. each of this section is loaded "in background". While browser trying to load one (or more) from these sections - it generates an error, so in effect you see popup with notification about some troubles, "save" buttons are spinning all the time etc. To find what section generates such problems it will be necessary to: go to shop back office go to section catalog > products turn on browser console (in chrome ctrl+shift+j) clear it open product edit page watch the console output one of the entry will be red (error) copy it and paste here are there some more errors, not only 404 ? Link to comment Share on other sites More sharing options...
theillo Posted January 2, 2017 Author Share Posted January 2, 2017 Thank you so much for your response, as of right now I can't create new products, which is really bad as I am just starting to build my inventory. You have assesed the problem correctly. With one exception: I think I know the popup you are talking about, and I've seen it before, but it doesn't show. I am happy to copy and paste the contents of my console here, however it is always a different tab that's not loading. jquery-1.11.0.min.js:4 GET http://www.[mydomain].com/admin[secret]/index.php?controller=AdminProducts&token=540017c50ffb96f4c464908af9334c09&id_product=50&action=[THIS WILL ALWAYS BE DIFFERENT]&updateproduct&ajax=1&rand=1483337521564&_=14833375207 send @ jquery-1.11.0.min.js:4 ajax @ jquery-1.11.0.min.js:4 ProductTabsManager.display @ products.js:117 ProductTabsManager.displayBulk @ products.js:166 (anonymous) @ products.js:208 products.js:177 Uncaught TypeError: Cannot read property 'replace' of undefined at Object.<anonymous> (products.js:177) at j (jquery-1.11.0.min.js:2) at Object.fireWith (jquery-1.11.0.min.js:2) at x (jquery-1.11.0.min.js:4) at XMLHttpRequest.b (jquery-1.11.0.min.js:4) (anonymous) @ products.js:177 j @ jquery-1.11.0.min.js:2 fireWith @ jquery-1.11.0.min.js:2 x @ jquery-1.11.0.min.js:4 b @ jquery-1.11.0.min.js:4 I'm trying to reload 10 times, here's all the values for the action parameter I've gotten in the URL: Attachments Attachments Pack AND Images (two 404 GET responses in one request) Associations Just now it worked! ModuleAppointment_scheduler* Shipping Virtual Product Prices Features (I have features disabled by the way) *I have 3 custom modules loading via hookDisplayAdminProductsExtra, they also utilize the hookActionProductUpdate Now of course I'm wondering if they could cause any problems. But why would they cause such intermittent problems? I am doing an experiment now, 10x reloading with my 3 custom modules DISABLED: It worked Attachments Images Suppliers Images Quantities (I have the Quantity feature disabled) Shipping It worked It worked Suppliers Well, while the success rate seems to be slightly better without my custom modules, that doesn't help much as my whole business revolves around these custom modules. Now, my error logs on the apache server show this: [Sun Jan 01 22:23:18 2017] [error] [client myIP] Premature end of script headers: index.php, referer: http://www.mydomain.com/adminsecret/index.php?controller=AdminProducts&addproduct&token=540017c50ffb96f4c464908af9334c09 If I edit rather than add a product, the referer will have additional parameters: &id_product=50&updateproduct So I have 17 of these errors now... Link to comment Share on other sites More sharing options...
theillo Posted January 2, 2017 Author Share Posted January 2, 2017 I'll also ask my hosting provider, this might be specific to my server... Link to comment Share on other sites More sharing options...
theillo Posted January 4, 2017 Author Share Posted January 4, 2017 Okay my host checked and said I've been running out of memory. They increased the default memory limit for me. How can I optimize prestashop so it uses less memory? Link to comment Share on other sites More sharing options...
theillo Posted January 4, 2017 Author Share Posted January 4, 2017 IMO the best fix would be to load the tabs on demand, rather than in bulk... I'm guessing I'd have to modify products.js for this. Any other ideas or pointers? Link to comment Share on other sites More sharing options...
theillo Posted January 4, 2017 Author Share Posted January 4, 2017 (edited) Well, for now I did Line 1883: var tabs_manager = new ProductTabsManager(); tabs_manager.setTabs(product_tabs); $(document).ready(function() { and I added this: var tabs_manager = new ProductTabsManager(); delete product_tabs.Features; delete product_tabs.Suppliers; delete product_tabs.Quantities; delete product_tabs.Warehouses; tabs_manager.setTabs(product_tabs); $(document).ready(function() {... Seems to work for now... But I also cranked my memory limit up to 128M. Please if you have any additional advice for me, let me know!!!!! EDIT: actually it's still quite unreliable. Edited January 4, 2017 by theillo (see edit history) Link to comment Share on other sites More sharing options...
theillo Posted January 4, 2017 Author Share Posted January 4, 2017 Maybe this did the trick for now. Looks like there has been an issue in the past where prestashop was looking like a DOS attack. So they made a little workaround to always wait 1 second between each ajax request. So I'm making this my default now... Line 202: /*In order to prevent mod_evasive DOSPageInterval (Default 1s)*/ var time = 1000; //this was set to 0, I changed it// if (mod_evasive) { time = 1000; } Link to comment Share on other sites More sharing options...
George Bazz Posted February 23, 2019 Share Posted February 23, 2019 Hello Theilo, I have (and have had) the same problem 2 years later 😂 I was wondering if you ever ended up creating the on demand tab tool cause that sounds a like a really good idea (pretty sure they did it in PS 1.7?). Thanks in advance, G Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now