CoursePress admin-ajax errors

When trying to edit Units in a course with more than 2 or 3 units, the admin screen stalls with a 502 error on admin-ajax.php

  • Predrag Dubajic

    Hi Morfjord,

    I see that there was no mention of conflict test on your site so could you please perform this by disabling your other plugins and switching to default WP theme and let us know if you had any issues after that?

    Also, the login with Google isn't working for me on your staging site as it shows me "Callback URL mismatch" error and I was unable to create an account.

    Can you send us your staging site login details by using our contact form and the template below:

    Subject: "Attn: Predrag Dubajic"
    - Site login url
    - WordPress admin username
    - WordPress admin password
    - Link back to this thread for reference
    - Any other relevant urls

    Best regards,

  • Predrag Dubajic

    Hi Morfjord,

    We're still checking with the developers about this and I was doing some tests on your site in the meantime but I was unable to replicate the issue anymore, is this constantly happening to you or just from time to time?

    Also, since you're using CoursePress for quite some time and I don't remember that you had this issue before, is this something that started happening recently?

    Best regards,

  • morfjord

    Yes it constantly happening to me, and ALL others that are admins on the site.
    So I'm guessing you are not testing in the way all other are using CoursePress.

    The course is imported to a test install and that is a clean Coursepress install. No multi site setup, but same problem! Support Access active for 5 days

    Please do the same we did in the test together.

    AND the user from the real platform are imported in the test platform, so do not send any notification to them.

  • Predrag Dubajic

    Hi Morfjord,

    Hmm, I can see the issue on that site, however I still couldn't replicate it on my installation even with that course exported from your site.

    It could be related to number of responses, so could you update to that we just released and then add this line in your child theme functions.php file:
    add_filter( 'coursepress_update_student_progress', '__return_false' );

    Let us know how it goes after that.

    Best regards,

  • morfjord

    Predrag Dubajic here is the same error on a clean test site:

    JQMIGRATE: Migrate is installed, version 1.4.1
    /wp-admin/admin-ajax.php?action=unit_builder&task=units_update&course_id=532&wp_nonce=bdeedd59bb Failed to load resource: the server responded with a status of 502 ()
    /wp-admin/admin-ajax.php?action=unit_builder&task=modules_update&course_id=532&unit_id=617&page=1&wp_nonce=bdeedd59bb&x=1 Failed to load resource: the server responded with a status of 502 ()

    Test this course:

  • morfjord

    We made more tests on our live multisite and we have the same problem there but there is not a compatibility issue that we could find. We are hosted with wpengine and their nginx kill script is the one killing the processes and generating the error.

    We will probably disable it but maybe you could look a bit into optimization - if processes would go under 60s we would not have this issue...

  • morfjord

    Here is the reply from wpengine support, there seems to be issues here:

    "The earlier disabling the timeout script (albeit temporarily) and recent enabling Ajax Monitoring have allowed us to compile some additional information on the long-running requests and subsequent 502 errors.

    Below is one example of a transaction trace on an admin-ajax call relating to pages like (and including)

    Note that the vast majority of the duration is comprised of the ProSites_Helper_Session component as well as several others referencing various CoursePress items. Here's a more detailed breakdown of that request:

    Lastly, this screenshot breaks down a few of those CoursePress_Data_Student::module_response and CoursePress_Data_Student::get_calculated_completion_data segments. While each one isn't taking much time to process, there were 857 and 916 of them (respectively) being called on that page request:

    I ran a search for ProSites_Helper_Session within your install's file system and found it referenced in numerous files in the pro-sites plugin:


    The get_calculated_completion_data and module_response items were found throughout the coursepress and coursepress1 plugins:


    This data indicates that the admin-ajax calls when updating content through coursepress necessitates an extremely high number of requests. The time needed to process these requests is easily exceeding 60-120 and running into our timeout script. Ideally, you'll want to contact the developers of the plugins for additional assistance but if you need further information from our end, please let us know -- we're certainly happy to help where we can. "

  • morfjord


    We did yet more tests and we have more findings - we tested the course on another multisite and we found this:
    - the course imported without the users works without problems
    - when importing the course including users we have the same issues
    - after deleting all users the save works again....we started to withdraw users one by one and re-testing in case there was a profile that interfered but no, we had to withdraw all users before saving worked again
    - if we disable the Pro-sites plugin the saving works even if there are users so there are definitely issues here.

    Additionally I noticed when we deleted users that bulk actions for student withdraw are not working - when selecting multiple users and tried to remove them using bulk actions we were redirected to posts page in dashboard

  • morfjord

    Hi Predrag,

    At this moment you can't view or test the original course where we had this issue, as I mentioned once we removed the students we were able to save without problems.

    On the we found a compatibility issue - the Database Browser plugin as I mentioned above. Once we disabled that the save worked. This is a single wp install tough and we did had the same issue with the course exported on other multisite installs - I also mentioned my findings above.

    If we're gonna have the same issue I will post again

  • Predrag Dubajic

    Hi Morfjord,

    I was doing number of tests on my end with 20 to 40 students but I was unable to replicate the issue whatever I tried.

    If you do encouter the issue again can you make sure that the code snippet mentioned here is applied and then tell us on which course we can see the issue.

    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.