cgi not responding properly

  1. ‹ Older
  2. 4 months ago

    Tobias B

    Mar 12 Pre-Release Testers, Xojo Pro Bern, Switzerland
    Edited 4 months ago

    I tested again with Safari on the the URL you've posted in the other thread. Still the "push" requests do get a HTTP 504 Gateway Timeout answer after 40 sec.

    -image-

    Later I saw a "ping" request beeing unanswered because of a Connection Reset. This lead to the client side JS showing the "The application has gone off-line." message and starting the offline-polling. That polling is apparently directing the wrong URL polling "http://alemac.com.br/cgi-bin/test/xojo/ping" instead of "http://alemac.com.br/cgi-bin/test/test.cgi/xojo/ping" which is, imho, a bug on its own affecting the CGI target: Feedback Case #51525. This is causing lots of (correct) 403 or 404 errors.

    But still, your configuration change seems not to be active or at least not helping with the 504 messages. Nor do I understand why the connection of the "ping" call was reset.

    You do have some logging in the App to confirm it is not crashing / the same instance is running continuously, don't you?

  3. Alexandre C

    Mar 12 Pre-Release Testers, Xojo Pro Brazil

    @Tobias B Later I saw a "ping" request beeing unanswered because of a Connection Reset. This lead to the client side JS showing the "The application has gone off-line." message and starting the offline-polling. That polling is apparently directing the wrong URL polling "http://alemac.com.br/cgi-bin/test/xojo/ping" instead of "http://alemac.com.br/cgi-bin/test/test.cgi/xojo/ping" which is, imho, a bug on its own affecting the CGI target: Feedback Case #51525. This is causing lots of (correct) 403 or 404 errors.

    But still, your configuration change seems not to be active or at least not helping with the 504 messages. Nor do I understand why the connection of the "ping" call was reset.

    English, please…

    @Tobias B You do have some logging in the App to confirm it is not crashing / the same instance is running continuously, don't you?

    No. In this case, it's a simple cgi app. the app does nothing.

  4. Greg O

    Mar 12 Xojo Inc Somewhere near Raleigh, NC

    That polling is apparently directing the wrong URL polling "http://alemac.com.br/cgi-bin/test/xojo/ping" instead of "http://alemac.com.br/cgi-bin/test/test.cgi/xojo/ping" which is, imho, a bug on its own

    On Xojo Cloud, that’s perfectly legal.

  5. Alexandre C

    Mar 12 Pre-Release Testers, Xojo Pro Brazil

    Ok. That's causing the cgi to not respond properly?

    If i understood correctly, it's a bug on xojo cgi itself, right?
    If yes, any idea when it'll be fixed?

    Alex

  6. Tobias B

    Mar 12 Pre-Release Testers, Xojo Pro Bern, Switzerland

    @Alexandre C English, please…

    I'm sorry if anything I said was not understandable, I'm not a native speaker.

    @Alexandre C If i understood correctly, it's a bug on xojo cgi itself, right?

    The issue with the path for the reconnect ping (#51525) which seem to require a special webserver configuration (present at Xojo Cloud) is just a second thing preventing the automatic re-connect. I think it is negligible here.

    I tested again with Chrome and Safari from Switzerland. The connection reset did not happen again, both browsers keep the connection just fine. But still the "push" POSTs receive a 504 after 40 seconds - which alone should not cause a disconnect. I'm out of ideas here.

  7. Greg O

    Mar 13 Xojo Inc Somewhere near Raleigh, NC
    Edited 4 months ago

    Edit: I thought you said your server was on Xojo Cloud, but I see that it's not.

    I too am at a loss. We have hundreds of customer apps running on Xojo Cloud built with various versions of Xojo which are not encountering these issues, including a few of ours.

    @Alexandre C - no, it is not a bug in the cgi script. Every Xojo web app cgi script is identical. If something were wrong, they’d all be failing.

    The issue with the path for the reconnect ping (#51525) which seem to require a special webserver configuration (present at Xojo Cloud) is just a second thing preventing the automatic re-connect. I think it is negligible here.

    That’s not what I said. On Xojo Cloud, the servers are configured to allow the cgi script to behave as an index file so that they don’t have to appear in a he url... and since the trailing “xojo/ping” is virtual, it should work just fine. This configuration is not required for the feature to work.

    The 504 Gateway error indicates that the app simply isn’t responding in the time that Apache thinks is long enough, about 40 seconds in this case, and yes, that is too long for a web app to take to respond. Humans get frustrated at 3 seconds, 40 is an eternity.

    App crashes are usually the culprit, but if the app isn’t crashing, the second most likely scenario is that the app is hung because it’s waiting for something. If your app connects to another service or server, make sure those are “always” available, that the appropriate firewall ports are open and if something unexpected happens that your app doesn’t crash if it gets no result (like an empty result from an HTTPSocket when you are expecting json).

    The next most common issue is that your app has a method that takes a lot of cpu for an extended period of time, effectively locking out the browsers until it’s finished. This usually occurs because of an unyielding tight loop in your code. A common example is retrieving a large recordset and sending all those rows to a listbox at once. It’s a double whammy actually because you pull the records in a loop and then all that data has to be sent to the browser.

  8. Greg O

    Mar 13 Xojo Inc Somewhere near Raleigh, NC
    Edited 4 months ago

    Ok, so I've jut gone to http://alemac.com.br/cgi-bin/test/test.cgi and your app is definitely taking too long to respond. looking at the debug tools, I'm seeing latencies between 4 and 7 seconds to return the built in pictures which are all below 10 kilobytes, heck, the Shown event on the page is taking 6 seconds to respond and the response is actually empty.

    There's are a few possibilities:

    1. The server is really busy and the app is not getting enough time to respond.
    2. The app is really busy (as in my previous post, but that doesn't seem likely given the url I'm using)
    3. The server is throttling or killing the app (which I'm beginning to think is the most likely scenario)

    Lets get some specifics about your server as I see that you are not on Xojo Cloud.

    1. Is this a private or shared server? That is, are you paying for a full Virtual Private Server or is this simply a hosting account?
    2. What is the OS & Version your server is using? cat /etc/os-release should get that for us.
    3. How many CPU cores do you have and how much memory is available? If you have shell access, running the command "top" will give us this info.
  9. Greg O

    Mar 13 Xojo Inc Somewhere near Raleigh, NC
    Edited 4 months ago

    @Alexandre C - On that sample app, please download the following file:

    https://www.dropbox.com/s/h8wwc2lyh9vlcsa/ServerPingFix.xojo_binary_code?dl=1

    drop that file into the project and then drag an instance to WebPage1 (or whatever page is shown there). This may not solve the overall problem, but may help with the ping problem.

  10. Alexandre C

    Mar 13 Pre-Release Testers, Xojo Pro Brazil
    Edited 4 months ago

    @Greg OLone The server is really busy and the app is not getting enough time to respond.

    i'll check

    @Greg OLone The app is really busy (as in my previous post, but that doesn't seem likely given the url I'm using)

    i think it's not, as you could see on sample app

    @Greg OLone The server is throttling or killing the app (which I'm beginning to think is the most likely scenario)

    i need to check.

    @Greg OLone Lets get some specifics about your server as I see that you are not on Xojo Cloud.
    Is this a private or shared server? That is, are you paying for a full Virtual Private Server or is this simply a hosting account?

    https://www.knownhost.com/managed-ssd-vps.html
    mine is a MVPS-3

    @Greg OLone What is the OS & Version your server is using? cat /etc/os-release should get that for us.

    NAME="CentOS Linux"
    VERSION="7 (Core)"
    ID="centos"
    ID_LIKE="rhel fedora"
    VERSION_ID="7"
    PRETTY_NAME="CentOS Linux 7 (Core)"
    ANSI_COLOR="0;31"
    CPE_NAME="cpe:/o:centos:centos:7"
    HOME_URL="https://www.centos.org/"
    BUG_REPORT_URL="https://bugs.centos.org/"

    CENTOS_MANTISBT_PROJECT="CentOS-7"
    CENTOS_MANTISBT_PROJECT_VERSION="7"
    REDHAT_SUPPORT_PRODUCT="centos"
    REDHAT_SUPPORT_PRODUCT_VERSION="7"

    @Greg OLone How many CPU cores do you have and how much memory is available? If you have shell access, running the command "top" will give us this info.

    4 cores, 6GB

    top - 09:37:22 up 7 days, 18:21, 1 user, load average: 0.59, 24.33, 122.19 Tasks: 80 total, 1 running, 77 sleeping, 1 stopped, 1 zombie %Cpu(s): 21.3 us, 3.7 sy, 0.0 ni, 75.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 6291456 total, 2433172 free, 2209344 used, 1648940 buff/cache KiB Swap: 0 total, 0 free, 0 used. 3919776 avail Mem

  11. Alexandre C

    Mar 13 Pre-Release Testers, Xojo Pro Brazil

    @Greg OLone @Alexandre C - On that sample app, please download the following file:

    https://www.dropbox.com/s/h8wwc2lyh9vlcsa/ServerPingFix.xojo_binary_code?dl=1

    drop that file into the project and then drag an instance to WebPage1 (or whatever page is shown there). This may not solve the overall problem, but may help with the ping problem.

    Done!

    new_instance

  12. Alexandre C

    Mar 13 Pre-Release Testers, Xojo Pro Brazil
    Edited 4 months ago

    Jason, from xojo's support, uploaded my previous cgi to xojo cloud.
    as expected, worked fine!

    http://67.205.169.107/test-Dev/

    so the problem is a configuration on my server. i just need to know which configuration is!

    the strange is that only occurs on MAC clients, not WINDOWS

    Alex

  13. Greg O

    Mar 13 Xojo Inc Somewhere near Raleigh, NC

    @Alexandre C Done!

    new_instance

    Ok, did you upload that app to your server?

  14. Alexandre C

    Mar 13 Pre-Release Testers, Xojo Pro Brazil

    @Greg OLone Ok, did you upload that app to your server?

    Yes, but i'm sorry, did not kill the actual cgi.

    You can try now.

  15. Alexandre C

    Mar 16 Pre-Release Testers, Xojo Pro Brazil

    @Greg OLone , hi!

    Any news?

    Best regards,

    Alex

  16. Greg O

    Mar 17 Xojo Inc Somewhere near Raleigh, NC
    Edited 4 months ago

    So I'm looking at the url you posted (http://alemac.com.br/cgi-bin/test/test.cgi ) using Internet explorer this morning and it's behaving exactly the same way as it does on the Mac, albeit a lot slower.

    I think the difference here is that the request timeout on Internet Explorer is just a lot higher than on the browser you are using on the Mac (I'm using Safari and it reaches timeout rather quickly by comparison)

    Anyway, I think this points to the problem being more systemic than browser specific. I still think you need to set the port to Automatic and see if that helps.

    Also, since this is a managed server, you could probably ask someone at your host to see if they have an app killer running. it may also be helpful to look at /var/log/messages and see if the app is crashing when a user accesses it.

    The Gateway timeout is definitely coming from Apache. You should really look into whether your app is crashing.

  17. Alexandre C

    Mar 20 Pre-Release Testers, Xojo Pro Brazil

    Hello @Greg OLone !

    Good morning.

    Let me ask you something…

    On xojo cloud server, the .htaccess have this two lines?

    AddHandler cgi-script .cgi
    Options +ExecCGI

    Best regards,

    Alex

  18. Greg O

    Mar 20 Xojo Inc Somewhere near Raleigh, NC

    @Alexandre C Hello @Greg OLone !

    Good morning.

    Let me ask you something…

    On xojo cloud server, the .htaccess have this two lines?

    AddHandler cgi-script .cgi
    Options +ExecCGI

    Best regards,

    Alex

    We do not use htaccess files on Xojo Cloud.

  19. Alexandre C

    Mar 20 Pre-Release Testers, Xojo Pro Brazil

    I think the problem was solved!

    Please look the http://alemac.com.br/cgi-bin/test/test.cgi

    I just added on .htaccess

    AddHandler cgi-script .cgi
    Options +ExecCGI

    Alex

  20. Alexandre C

    Mar 20 Pre-Release Testers, Xojo Pro Brazil

    hummm…

    not worked on this cgi…

    https://msi.alemac.com.br/cgi-bin/msi/msi.cgi

  21. 3 months ago

    Alexandre C

    Apr 1 Pre-Release Testers, Xojo Pro Brazil

    Hello everybody!

    I needed to change host name to: https://msidatastore.com.br/cgi-bin/msidatastore/msidatastore.cgi

    Same server, just changed the host name.

    The problem persists!

    Any ideas?

or Sign Up to reply!