Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #27709

    Geoff N
    Participant

    Hi all
    I’m not sure if I should be posting this here or WPBakery. I went there first but they wanted some kind of Item Purchase Code which I don’t think I have since Visual Composer seemed to come bundled with the X-theme that we bought.

    The problem is that opening up a page for editing, and attempting to save it, causes a large number of ajax requests to be sent to the server. Simply ‘viewing’ the page in WordPress does not seem to cause these problems, it is only when editing.

    I traced it down to a function or method or something (I’m not that familiar with JavaScript yet) called ‘render’ which starts at line 170 of composer-atts.js in plugins/js_composer/assets/js_backend. The relevant bit is shown below. I put in a call to ‘alert’ for debugging, and had to click the okay button somewhere between 55 and 60 times (I lost count) on both opening the page for edit, and clicking the update button.


    render:function (param, value) {
    var image_src = $('[data-model-id=' + this.model.id + ']').data('field-' + param.param_name + '-attach-image');
    var $thumbnail = this.$el.find('.attachment-thumbnail[data-name=' + param.param_name + ']');
    if (_.isUndefined(image_src)) {
    alert("firing off ajax again");
    $.ajax({
    type:'POST',
    url:window.ajaxurl,
    data:{
    action:'wpb_single_image_src',
    content:value
    },
    dataType:'html',
    context:this
    }).done(function (src) {
    vc.atts['attach_image'].updateImage($thumbnail, src);
    });
    } else {
    $('[data-model-id=' + this.model.id + ']').removeData('field-' + param.param_name + '-attach-image');
    vc.atts['attach_image'].updateImage($thumbnail, image_src);
    }

    return value;
    },

    Version numbers
    Wordpress 3.8.1
    X-Theme 1.7.2 (child theme of Icon says 1.0.0)
    X Shortcodes 2.0.6
    Visual Composer 3.7.3

    Addenda
    Here is a portion of /var/log/http/access_log showing the burst of ajax requests at roughly half second intervals. This goes on for approximately 30 seconds total, during which time our server is on it’s knees begging for mercy.

    121.44.111.1 - - [29/Mar/2014:18:18:02 +1100] "POST /wprtm/wp-admin/admin-ajax.php HTTP/1.1" 200 - "http://vps01.realtimeminds.com/wprtm/wp-admin/post.php?post=6798&action=edit&message=1" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36"
    121.44.111.1 - - [29/Mar/2014:18:18:03 +1100] "POST /wprtm/wp-admin/admin-ajax.php HTTP/1.1" 200 - "http://vps01.realtimeminds.com/wprtm/wp-admin/post.php?post=6798&action=edit&message=1" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36"
    121.44.111.1 - - [29/Mar/2014:18:18:03 +1100] "POST /wprtm/wp-admin/admin-ajax.php HTTP/1.1" 200 - "http://vps01.realtimeminds.com/wprtm/wp-admin/post.php?post=6798&action=edit&message=1" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36"
    121.44.111.1 - - [29/Mar/2014:18:18:04 +1100] "POST /wprtm/wp-admin/admin-ajax.php HTTP/1.1" 200 - "http://vps01.realtimeminds.com/wprtm/wp-admin/post.php?post=6798&action=edit&message=1" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36"
    121.44.111.1 - - [29/Mar/2014:18:18:05 +1100] "POST /wprtm/wp-admin/admin-ajax.php HTTP/1.1" 200 - "http://vps01.realtimeminds.com/wprtm/wp-admin/post.php?post=6798&action=edit&message=1" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36"
    121.44.111.1 - - [29/Mar/2014:18:18:05 +1100] "POST /wprtm/wp-admin/admin-ajax.php HTTP/1.1" 200 - "http://vps01.realtimeminds.com/wprtm/wp-admin/post.php?post=6798&action=edit&message=1" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36"
    121.44.111.1 - - [29/Mar/2014:18:18:06 +1100] "POST /wprtm/wp-admin/admin-ajax.php HTTP/1.1" 200 - "http://vps01.realtimeminds.com/wprtm/wp-admin/post.php?post=6798&action=edit&message=1" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36"
    121.44.111.1 - - [29/Mar/2014:18:18:06 +1100] "POST /wprtm/wp-admin/admin-ajax.php HTTP/1.1" 200 - "http://vps01.realtimeminds.com/wprtm/wp-admin/post.php?post=6798&action=edit&message=1" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36"
    121.44.111.1 - - [29/Mar/2014:18:18:07 +1100] "POST /wprtm/wp-admin/admin-ajax.php HTTP/1.1" 200 - "http://vps01.realtimeminds.com/wprtm/wp-admin/post.php?post=6798&action=edit&message=1" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36"
    121.44.111.1 - - [29/Mar/2014:18:18:08 +1100] "POST /wprtm/wp-admin/admin-ajax.php HTTP/1.1" 200 - "http://vps01.realtimeminds.com/wprtm/wp-admin/post.php?post=6798&action=edit&message=1" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36"
    121.44.111.1 - - [29/Mar/2014:18:18:08 +1100] "POST /wprtm/wp-admin/admin-ajax.php HTTP/1.1" 200 - "http://vps01.realtimemind

    I noticed there was already a forum discussion about Visual Composer causing server crashes. However that seemed to be specifically about GoDaddy, and we are not using GoDaddy. Possibly this is related, but that other thread was a bit scanty on specific information to really know.

    We are hosted on a vps. The vps is not actually crashing, but soon after installing X-Theme we started getting ‘out of memory’ warnings from the hosting company. I have managed to work around this by simply reducing the maximum number of child processes in apache. But the cpu still gets pegged at about 80-90% for a half minute or so when trying to update pages.

    I set a breakpoint in “Chrome developer tools” immediately after my ‘alert’ statement, the was able to get a stack trace. Two of them are shown below, though I must admit I’m not really sure what I’m looking at so can’t be sure how useful this is for you.

    _.extend.attach_image.render (composer-atts.js?ver=3.7.3:177)
    (anonymous function) (composer-view.js?ver=3.7.3:147)
    w.each.w.forEach (load-scripts.php?c=1&load%5B%5D=hoverIntent,commonn-bar,wp-ajax-response,jquery-color,wp-lists…:404)
    vc.shortcode_view.Backbone.View.extend.changeShortcodeParams (composer-view.js?ver=3.7.3:140)
    window.VcRowView.vc.shortcode_view.extend.changeShortcodeParams (composer-custom-views.js?ver=3.7.3:73)
    Backbone.View.extend.appendShortcode (composer-view.js?ver=3.7.3:735)
    (anonymous function) (composer-view.js?ver=3.7.3:669)
    w.each.w.forEach (load-scripts.php?c=1&load%5B%5D=hoverIntent,commonn-bar,wp-ajax-response,jquery-color,wp-lists…:404)
    g.(anonymous function) (load-scripts.php?c=1&load%5B%5D=hoverIntent,commonn-bar,wp-ajax-response,jquery-color,wp-lists…:412)
    Backbone.View.extend.addAll (composer-view.js?ver=3.7.3:668)
    c (load-scripts.php?c=1&load%5B%5D=hoverIntent,commonn-bar,wp-ajax-response,jquery-color,wp-lists…:412)
    a.Events.trigger (load-scripts.php?c=1&load%5B%5D=hoverIntent,commonn-bar,wp-ajax-response,jquery-color,wp-lists…:412)
    h.extend.reset (load-scripts.php?c=1&load%5B%5D=hoverIntent,commonn-bar,wp-ajax-response,jquery-color,wp-lists…:412)
    t.success (load-scripts.php?c=1&load%5B%5D=hoverIntent,commonn-bar,wp-ajax-response,jquery-color,wp-lists…:412)
    vc.shortcodes_collection.Backbone.Collection.extend.sync (composer-models.js?ver=3.7.3:148)
    h.extend.fetch (load-scripts.php?c=1&load%5B%5D=hoverIntent,commonn-bar,wp-ajax-response,jquery-color,wp-lists…:412)
    (anonymous function) (composer-view.js?ver=3.7.3:1024)

    … and another …

    _.extend.attach_image.render (composer-atts.js?ver=3.7.3:177)
    (anonymous function) (composer-view.js?ver=3.7.3:147)
    w.each.w.forEach (load-scripts.php?c=1&load%5B%5D=hoverIntent,commonn-bar,wp-ajax-response,jquery-color,wp-lists…:404)
    vc.shortcode_view.Backbone.View.extend.changeShortcodeParams (composer-view.js?ver=3.7.3:140)
    window.VcRowView.vc.shortcode_view.extend.changeShortcodeParams (composer-custom-views.js?ver=3.7.3:73)
    Backbone.View.extend.appendShortcode (composer-view.js?ver=3.7.3:735)
    (anonymous function) (composer-view.js?ver=3.7.3:669)
    w.each.w.forEach (load-scripts.php?c=1&load%5B%5D=hoverIntent,commonn-bar,wp-ajax-response,jquery-color,wp-lists…:404)
    g.(anonymous function) (load-scripts.php?c=1&load%5B%5D=hoverIntent,commonn-bar,wp-ajax-response,jquery-color,wp-lists…:412)
    Backbone.View.extend.addAll (composer-view.js?ver=3.7.3:668)
    c (load-scripts.php?c=1&load%5B%5D=hoverIntent,commonn-bar,wp-ajax-response,jquery-color,wp-lists…:412)
    a.Events.trigger (load-scripts.php?c=1&load%5B%5D=hoverIntent,commonn-bar,wp-ajax-response,jquery-color,wp-lists…:412)
    h.extend.reset (load-scripts.php?c=1&load%5B%5D=hoverIntent,commonn-bar,wp-ajax-response,jquery-color,wp-lists…:412)
    t.success (load-scripts.php?c=1&load%5B%5D=hoverIntent,commonn-bar,wp-ajax-response,jquery-color,wp-lists…:412)
    vc.shortcodes_collection.Backbone.Collection.extend.sync (composer-models.js?ver=3.7.3:148)
    h.extend.fetch (load-scripts.php?c=1&load%5B%5D=hoverIntent,commonn-bar,wp-ajax-response,jquery-color,wp-lists…:412)
    (anonymous function) (composer-view.js?ver=3.7.3:1024)

    There doesn’t seem to be a ‘preview’ button in this forum, and I have copied and posted and typed a whole bunch of tags and code. I hope you get something that makes sense.

    Regards
    Kevin
    kevingolding2001@gmail.com

    P.S. My boss is Geoff Nix, and it was he who actually purchased X-theme, so I am probably logged in as him as he sent me the login details after making the purchase.

    P.P.S. This has given him a very negative perception of our current vps hosting provider (Mammoth VPS) as he now perceives them as ‘slow’ and thinks I screwed up in recommending them.

    #27978

    Support
    Member

    Hey!

    Thank you for using the theme! If you haven’t read some of it yet, definitely take some time to review all of our resources in the Knowledge Base especially this article that might give you an idea as to why the Customizer is failing: http://theme.co/x/member/kb/solutions-to-potential-setup-issues/

    Basically, the article will tell you to increase the wordpress php memory limit in order to handle the Customizer.

    A lot of setup questions like this are already covered in there and in much more detail than we can provide here. We include documentation, numerous helpful articles, and dozens of videos, which go over many aspects of the theme. Another thing you can do is to contact your hosting provider and ask for some advice on how you could improve the overall experience when using the Customizer. Ajax on websites is not uncommon nowadays and WordPress is no exception. Currently, the core of WordPress uses Ajax only in the administration screens. For instance, Ajax is used for instant updates and the auto-save functionality on post and page editing screens, this is also true on Customizer.

    If you find you still have a question after taking the time to thoroughly go through all of these materials, don’t hesitate to let us know and we will be happy to assist you.

    Thank you for your understanding.

    #28015

    Geoff N
    Participant

    So, are you suggesting that upon saving a page, a burst of approximately 60 identical ajax requests at half second intervals is normal and we just have to tune the server to somehow cope with this?

    #28282

    Alexander
    Keymaster

    Hi Geoff,

    Visual Composer does make a good amount of AJAX request while it’s being used. I just did a test with several elements and didn’t get duplicate requests in quick succession like this. Just a few each time I moved to another screen in VC.

    Can you please update your site to use the following versions? (latest for X Theme at this time)
    X Theme (1.8.0)
    X Shortcodes 2.0.9
    Visual Composer 1.7.4

    I’m not seeing it running the latest on my test site, so maybe it’s a bug that’s been resolved.

    Let us know what you find out

    #42726

    Flix F
    Participant

    I can confirm massive server load during backend operations. The delays cause a lot of frustration while editing pages. This does not happen when using a different theme, same VCC version. It has something to do with the custom elements added by X.

    #43051

    Rad
    Moderator

    Hi Guys,

    X’s VC customization is just same how other 3rd party addons customized their own. The integration standard was set by WPBakery and should be followed. And X customization are just adding/changing additional input and shortcodes, and it VC’s responsibility on how it will render or retrieve these elements, or how it will be saved on backend (ajax).

    And it is really slow if your shortcode contents became large for rendering. Like concurrent 250 connections using some demo homepage.

    We will still investigate this, and see what we can do to optimize this.

    Thank you.

    #46889

    Michael G
    Participant

    I would also like to weigh in on this topic. I know nothing at all about “AJAX” or PHP. However, I have recently received two warnings from my host about Account Resource Overage. I only recently purchased the X theme and had never received these warnings prior to this purchase.

    For the past couple of weeks I have been consistently working on my site. I use Visual Composer exclusively since users have been advised not to switch back and forth between the classic editing panel and VC (I learned this the hard way after twice being forced to rebuild a page due to this conflict). Anyway, as I was saying, I’ve been using VC as I work on my site and now I’m suddenly getting warnings about Account Resource Overages.

    My site is still in the construction phase. It currently has only a few complete pages. I am the only user. The content consists only of a homepage slider, some images, and dummy text. In other words, as websites go, it’s size and activity are insignificant. Because of this, I was really puzzled as to why I was suddenly being warned by my host that my account was at risk of suspension due to resource overage. That is, until I happened to stumble across this thread.

    The concerns expressed by these other users make sense to me, given the circumstances that I’ve just described. If this issue is valid, it needs to be promptly addressed. I am thoroughly delighted with this theme and have no regrets about making this investment. In fact, I intend to use this theme exclusively going forward if I can reach a sufficient level of comfort with it. However, if the concerns expressed here prove to be legitimate, I may have no choice but to abandon this theme to avoid a contentious relationship with my host provider.

    Please continue to investigate this matter.

    Thank you,
    Michael

    #47336

    Alexander
    Keymaster

    Thanks for your feedback Michael.

    At this time we don’t have any more information. Please make sure you are using the latest version of X, and the Visual Composer version that is bundled with it.

    Keep in mind that the extra resources will only be used while you are editing. When you close the editor, you won’t be making extra page requests. Another method for if you are working with very large pages, would be setting a local development environment. You could build your site there, and copy the content to your live site when it’s finished.

    #70784

    Icarus S
    Participant

    I just wanted to share my experiences. I was having a very similar issue as others have noted. It started with my host throttling my CPU access. When looking through request logs and profiling with firebug, I noticed a huge number of admin-ajax.php POSTS, between 30 and 50 requests when editing a post page. When inspecting both the HTTP Request and Response of these calls, I noticed they were trying to invoke an ajax action through admin-ajax.php called “wpb_single_image_src”.

    The crazy thing was that the calls were buggy and not returning any response, they do not execute properly without a second variable called “content” which should contain a post Id. In other words, my site was generating 30 to 50 AJAX calls which all returned nothing, so my server was being flooded with request for no good reason. This call is only made when a page has Visual Composer content. This is likely a bug with Visual Composer or the way X is using the plugin. I did not dig in enough to determine which.

    I updated the javascript file located at wp-content\plugins\js_composer\assets\js\backend\composer-atts.js in the following manner.

    Old Line 199: if (_.isUndefined(image_src)){
    New Line 199: if (_.isUndefined(image_src) && !_.isUndefined(value)){

    So I’m checking to see if the value for content is defined, if not, the AJAX request will not be invoked. This had an immediate effect on my admin load times when editing a post. Also, nothing should be affected, because these calls were failing regardless. I hope this helps someone else out there.

    I’m running.
    WPBakery Visual Composer Version 4.1.3
    X – Shortcodes Version 2.3.3
    X Theme Version 2.1.0

    #71053

    Rad
    Moderator

    Thanks for sharing Icarus, noted this.