Menu

#882 js files cause timeout?

open
nobody
None
1
2016-02-16
2016-02-02
Anonymous
No

I've just completed an install at http://www.ibiblio.org/gdunc/mrbs and I'm getting a lot of gateway timeout errors from pages pulled from practically anything in the mrbs/js/ directory.

Is there anything I can do to increase performance?

Discussion

1 2 > >> (Page 1 of 2)
  • John Beranek

    John Beranek - 2016-02-02

    Is your server not allowed to fetch data from the Internet? If so you need the following in your config.inc.php:

    $zoneinfo_update = FALSE;
    
     
    • Anonymous

      Anonymous - 2016-02-03

      Why would it fetch data from the Internet? I'll add that to the config to see if it helps.

       
  • Anonymous

    Anonymous - 2016-02-03

    I added that to my config - that does seem to help, I think. I'm not using iCal, so, I don't quite understand why this works. But, I may be over thinking it...

     
  • Campbell Morrison

    Yes, MRBS fetches data from the internet to update the timezone definitions periodically. Strictly speaking this need only happen if you are using iCal, but I think this will happen even if you are not.

    However, I would not expect it to affect the js files. I think something else must be causing the problem there.

     
  • John Beranek

    John Beranek - 2016-02-03

    Well, any file which includes functions_ical.inc will potentially cause a zone fetch. The pages that include this do seem to be pretty limited though:

    edit_entry_handler.php
    import.php
    report.php
    view_entry.php

    functions_mail.php - but only if ical has been enabled

     
    • Campbell Morrison

      Yes, which makes me think that it's not the problem causing the js files to take a long time to download. I tried the site yesterday and saw that some of the js files were sometimes taking 30+ seconds to download. I tried again today to see if it had changed, but my DNS server (OpenDNS) is now blocking the site on the grounds that it contains malware, so I didn't proceed.

       
  • John Beranek

    John Beranek - 2016-02-03

    I'd say there is something to suggest that get_vtimezone() should only fetch files if ical is enabled though...

     
    • Campbell Morrison

      ... or maybe functions_ical.inc should only be included if ical is enabled?

       
      • Campbell Morrison

        Actually I don't think either of those solutions work. The icalendar functions are not just used when icalendar mal is enabled. They are also used for importing and exporting events.

         
  • Anonymous

    Anonymous - 2016-02-03

    I had an isue with Google's Malware blocker thanks to a set of old files that were uploaded by another user. I'm working to get that cleared today. Hopefully I'll be off the naughty list soon.

    I did notice better performance by disabling timezone but, it's still really slow in downloading the js files. It's kind of strange that these files take so long to load. I didn't have any issues at all working on a local server on campus, but, I wanted to post to the web if I could.

     
  • Campbell Morrison

    Yes, I've just checked again. Firebug is telling me that it's taking just over 30s (eg 30.7s) to download the JavaScript files. However, if I just put the URL of the JavaScript file directly into the browser address bar it downloads in about 200ms. It feels like there's a 30s timeout in there somewhere. As that's the default timeout for a PHP script, I suspect something's getting stuck in a loop somewhere or blocking on a resource.

     
  • Anonymous

    Anonymous - 2016-02-04

    Any clue on how to narrow down the issue?? I'm pretty handy with modifying PHP and I've set up my share of servers, but, I'm on a hosted site that I'm pretty limited with. Any assistance would be appreciated.

     
  • Campbell Morrison

    I wonder if the problem is a server problem of some kind? In MRBS the JavaScript files, and some of the CSS files, are created dynamically using PHP. When MRBS's day.php page is loaded it will fire off requests for two such CSS files and seven such JavaScript files. The server will be hit with all seven requests at the same time and I wonder if this is causing the problems? I notice that sometimes your site works fine, even after a forced refresh, and at other times I start hitting the 30s download times.

    I don't know if your hosting provider can help some more?

    [It would probably be a good idea for other reasons for MRBS to concatenate the CSS files and JavaScript files and serve them as one of each, but that's going to be a longer term solution]

     
  • Anonymous

    Anonymous - 2016-02-04

    I agree that it's likely something with the performance hit of attempting to dynamically build the pages - I thought originally that it could be related to their MySQL server, but, I'm not sure. I'll keep plugging away at it or I may need to switch to a different system if this one doesn't behave well on my host.

     
  • Campbell Morrison

    I don't think it's anything to do with their MySQL server as those pages don't go anywhere near MySQL (as far as I am aware). And they're not performance intensive either - all they do is conditionally include bits of JavaScript code based on some PHP config variables.

    I have a feeling it's probably something to do with the number of PHP processes that are fired off almost simultaneously and that this is breaking some server configuration limit, or causing some kind of weird race condition.

     
  • Campbell Morrison

    Just to test the theory, I've put together a version of js.inc attached which concatenates all those dynamically created JS files and delivers them inline. Could you try it and see if it solves the problem? If so, then I'll tidy it up a bit.

     
  • Anonymous

    Anonymous - 2016-02-04

    Well, that didn't help. I think there must be an error somewhere in that file. I'm getting a white screen now, viewing source shows that it is stopping somewhere before loading the tables. I'll see if I can't take a look at it later.

    For now, I've left up your js.inc file on my site. (which I've modified header.inc to call js2.inc) I'll swing back around and take a look at it tonight. Right now I'm having issues trying to get my staff to switch back to the on-campus system anyway. This will prevent them from doing anything on the online system anyway. ;)

     
  • Campbell Morrison

    Strange. Let me know how you get on. I tested that file on my system and everything worked OK, so I'm not quite sure why it's failing.

     
  • Campbell Morrison

    I assume you are running MRBS 1.5.0? The js.inc file above won't work with earlier versions.

     
  • Anonymous

    Anonymous - 2016-02-05

    Nope, I'm running 1.4.11. I'll update my version which might also assist in some of these performance issues. I had no idea I was that far off.

     
  • Anonymous

    Anonymous - 2016-02-05

    Okay, I updated to 1.5 on www.ibiblio.org/gdunc/mrbs/. Went through a pretty frustrating bit when I couldn't get your file to load then realized that I probably needed to copy it over to the new mrbs directory...

    You sir, Campbell Morrison, are a genius. Get that new js.inc put into the next release. That solved it, I think... Take a look for yourself.

     
  • Campbell Morrison

    I don't think it's right - you're not getting the datepicker in the header. Looking at the source you're not getting the JavaScript at all. Not quite sure why - it worked OK on my site.

     
  • Campbell Morrison

    My guess is that file_get_contents() calls in js.inc are returning FALSE for some reason - permissions maybe? Try putting the following at the beginning of the file to see what's going on:

    error_reporting(-1);
    ini_set('display_errors', '1');
    
     
  • Campbell Morrison

    Thanks. I'll think about how to get round that

     
1 2 > >> (Page 1 of 2)