Promotion cron job 500 error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yi.zhou@xplusz.com
    Member
    • Feb 2017
    • 31
    • 5.2.x

    [Bug / Issue] Promotion cron job 500 error

    Hi there, recently I have setup the user promotion in my vbulletin 5.3.2, but when the promotion cron job run, it always get 500 error. I have narrow down the issue to this query

    PHP Code:
    $sql "
                SELECT user.joindate, user.userid, user.membergroupids, user.posts, user.reputation,
                    user.usergroupid, user.displaygroupid, user.customtitle, user.username, user.ipoints,
                    userpromotion.joinusergroupid, userpromotion.reputation AS jumpreputation, userpromotion.posts AS jumpposts,
                    userpromotion.date AS jumpdate, userpromotion.type, userpromotion.strategy,
                    usergroup.title, usergroup.usertitle AS ug_usertitle,
                    usertextfield.rank
                FROM " 
    TABLE_PREFIX "user AS user
                INNER JOIN " 
    TABLE_PREFIX "userpromotion AS userpromotion ON (user.usergroupid = userpromotion.usergroupid)
                LEFT JOIN " 
    TABLE_PREFIX "usergroup AS usergroup ON (userpromotion.joinusergroupid = usergroup.usergroupid)
                LEFT JOIN " 
    TABLE_PREFIX "usertextfield AS usertextfield ON (usertextfield.userid = user.userid)
                " 
    iif(VB_AREA != 'AdminCP'"WHERE user.lastactivity >= " $params['time']); 
    It fetch almost all my user which I have over million users and try to loop though in the promotion, I assume the promotion query should only fetch the recent active user, but when I try to run the cron job in admincp, the last if statement will be false. I don't know if this is bug or this is intentional, can I just remove the VB_AREA check?
  • Wayne Luke
    vBulletin Technical Support Lead
    • Aug 2000
    • 74123

    #2
    You haven't provided any information on what the actual error is. A 500 server error is a very generic error and provides no information on how to resolve any issue. You shouldn't edit any vBulletin code under any circumstance. Please look at your error logs for Apache and PHP to find out what the error is.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API

    Comment

    • yi.zhou@xplusz.com
      Member
      • Feb 2017
      • 31
      • 5.2.x

      #3
      Wayne Luke , thank you for your reply, I turned display error on php and looked at apache error log, didn't find anything related, but I did found this post, https://www.vbulletin.com/forum/foru...on-cron-failed
      He is running into the same problem, so my guess is that running promotion cron in admincp will try to loop through all million users which cause the timeout?

      Comment

      • Wayne Luke
        vBulletin Technical Support Lead
        • Aug 2000
        • 74123

        #4
        That post is from vBulletin 4 and three years old. In can be considered irrelevant at this time. What are the contents of your PHP error log when the error occurs? If you're not logging your PHP Errors, you should be.
        Translations provided by Google.

        Wayne Luke
        The Rabid Badger - a vBulletin Cloud demonstration site.
        vBulletin 5 API

        Comment

        • yi.zhou@xplusz.com
          Member
          • Feb 2017
          • 31
          • 5.2.x

          #5
          I did log php error, but when it happens, I got nothing, beside the php error, I'm more wondering why iif(VB_AREA != 'AdminCP', "WHERE user.lastactivity >= " . $params['time']) is exclude from admincp schedule task tool, without that condition, it will just fetch 1m users and loop in the following code


          PHP Code:
          $promotions vB::getDbAssertor()->assertQuery('fetchUsersForPromotion', array('time' => $lastrun));
          foreach (
          $promotions as $promotion)
          {
              ..... 

          Comment

          • Wayne Luke
            vBulletin Technical Support Lead
            • Aug 2000
            • 74123

            #6
            I don't know why the code is written that way. I am sure there is a good reason for it somewhere that someone may even know about. I would most likely say so that the system doesn't return a million records and kill the site with a 500 server error.

            I need to know what the PHP error is. Thank you.
            Translations provided by Google.

            Wayne Luke
            The Rabid Badger - a vBulletin Cloud demonstration site.
            vBulletin 5 API

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...