WebApp closes by itself

  1. 3 months ago

    Tony L

    Feb 12 Pre-Release Testers, Xojo Pro Hong Kong

    Hi all,

    My web app sometimes closes by itself, no matter when the user is working on the app or when it is idle. Below is part of the error log captured from Apache, can someone please give me hints where about in my code could cause the error? Thanks in advance.

    p.s. app doesn't close that frequent but Apache just keep recording errors

    [Tue Feb 13 10:53:52.584145 2018] [cgi:error] [pid 7149] [client 192.168.2.5:45792] Script timed out before returning headers: unicornweb.cgi, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:54:22.590821 2018] [cgi:warn] [pid 7149] [client 192.168.2.5:45792] AH01220: Timeout waiting for output from CGI script /var/www/html/cgi/UnicornWeb/unicornweb.cgi, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:54:55.886558 2018] [cgi:warn] [pid 9189] [client 192.168.2.5:45844] AH01220: Timeout waiting for output from CGI script /var/www/html/cgi/UnicornWeb/unicornweb.cgi, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:54:55.886634 2018] [cgi:error] [pid 9189] [client 192.168.2.5:45844] Script timed out before returning headers: unicornweb.cgi, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi
    [Tue Feb 13 10:55:25.892785 2018] [cgi:warn] [pid 9189] [client 192.168.2.5:45844] AH01220: Timeout waiting for output from CGI script /var/www/html/cgi/UnicornWeb/unicornweb.cgi, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:55:59.236528 2018] [cgi:warn] [pid 7467] [client 192.168.2.5:45953] AH01220: Timeout waiting for output from CGI script /var/www/html/cgi/UnicornWeb/unicornweb.cgi, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:55:59.236612 2018] [cgi:error] [pid 7467] [client 192.168.2.5:45953] Script timed out before returning headers: unicornweb.cgi, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:56:29.243802 2018] [cgi:warn] [pid 7467] [client 192.168.2.5:45953] AH01220: Timeout waiting for output from CGI script /var/www/html/cgi/UnicornWeb/unicornweb.cgi, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:56:40.183166 2018] [cgi:error] [pid 7153] [client 192.168.2.5:46006] AH01215: Use of uninitialized value $length in subtraction (-) at /var/www/html/cgi/UnicornWeb/unicornweb.cgi line 131.: /var/www/html/cgi/UnicornWeb/unicornweb.cgi, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:56:40.183487 2018] [cgi:error] [pid 7153] [client 192.168.2.5:46006] AH01215: Use of uninitialized value $length in numeric eq (==) at /var/www/html/cgi/UnicornWeb/unicornweb.cgi line 130.: /var/www/html/cgi/UnicornWeb/unicornweb.cgi, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:56:40.184076 2018] [cgi:error] [pid 7153] [client 192.168.2.5:46006] End of script output before headers: unicornweb.cgi, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:56:44.675906 2018] [cgi:error] [pid 7151] [client 192.168.2.5:46015] AH02811: script not found or unable to stat: /var/www/html/cgi/UnicornWeb/xojo, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:56:49.696042 2018] [cgi:error] [pid 9706] [client 192.168.2.5:46023] AH02811: script not found or unable to stat: /var/www/html/cgi/UnicornWeb/xojo, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:56:54.717103 2018] [cgi:error] [pid 7307] [client 192.168.2.5:46029] AH02811: script not found or unable to stat: /var/www/html/cgi/UnicornWeb/xojo, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:56:59.737578 2018] [cgi:error] [pid 11265] [client 192.168.2.5:46031] AH02811: script not found or unable to stat: /var/www/html/cgi/UnicornWeb/xojo, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:57:04.759593 2018] [cgi:error] [pid 9189] [client 192.168.2.5:46034] AH02811: script not found or unable to stat: /var/www/html/cgi/UnicornWeb/xojo, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:57:09.780119 2018] [cgi:error] [pid 7294] [client 192.168.2.5:46039] AH02811: script not found or unable to stat: /var/www/html/cgi/UnicornWeb/xojo, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:57:14.796364 2018] [cgi:error] [pid 11223] [client 192.168.2.5:46041] AH02811: script not found or unable to stat: /var/www/html/cgi/UnicornWeb/xojo, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:57:47.766747 2018] [cgi:warn] [pid 7307] [client 192.168.2.5:46059] AH01220: Timeout waiting for output from CGI script /var/www/html/cgi/UnicornWeb/unicornweb.cgi, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:57:47.766824 2018] [cgi:error] [pid 7307] [client 192.168.2.5:46059] Script timed out before returning headers: unicornweb.cgi, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:57:48.059331 2018] [cgi:warn] [pid 9189] [client 192.168.2.5:46064] AH01220: Timeout waiting for output from CGI script /var/www/html/cgi/UnicornWeb/unicornweb.cgi, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:57:48.059393 2018] [cgi:error] [pid 9189] [client 192.168.2.5:46064] Script timed out before returning headers: unicornweb.cgi, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:58:17.767100 2018] [cgi:warn] [pid 7307] [client 192.168.2.5:46059] AH01220: Timeout waiting for output from CGI script /var/www/html/cgi/UnicornWeb/unicornweb.cgi, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:58:18.090006 2018] [cgi:warn] [pid 9189] [client 192.168.2.5:46064] AH01220: Timeout waiting for output from CGI script /var/www/html/cgi/UnicornWeb/unicornweb.cgi, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:58:51.446318 2018] [cgi:warn] [pid 11223] [client 192.168.2.5:46151] AH01220: Timeout waiting for output from CGI script /var/www/html/cgi/UnicornWeb/unicornweb.cgi, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    [Tue Feb 13 10:58:51.446399 2018] [cgi:error] [pid 11223] [client 192.168.2.5:46151] Script timed out before returning headers: unicornweb.cgi, referer: http://xojo2.astbsldata.com.hk/UnicornWeb/unicornweb.cgi

    Just an update to the status of my "problem". It is in fact my own fault, every time I compiled the project, I only copied the main program without the others. Now I copied everything to the server every time I deploy a new version, it seems to work without problem now. Sorry for my stupid mistake and many thanks to all your suggestions made in this thread.

  2. Rudolph T

    Feb 13 Pre-Release Testers, Xojo Pro South Africa

    Tony do you host the apps on a public server? Some ISP's monitor your memory and CPU usage and kill your processes without warning. Running Webapps in CGI mode spawns many PERL instances per session depending on the complexity of your app.

  3. Tony L

    Feb 13 Pre-Release Testers, Xojo Pro Hong Kong

    The cgi runs on our own Linux Server. Is it running out of memory or CPU? As my app is still in testing, number of concurrent users is limited, normally less than 5.

  4. Rudolph T

    Feb 13 Pre-Release Testers, Xojo Pro South Africa
    Edited 3 months ago

    Tony. have you tried running it as a standalone app? Standalone uses less resources according to my tests on Windows. CGI Webapps can be spammed very easily in my opinion and yes it will quickly use all your memory. If your app is stable in standalone then you know your problem is related either to your Apache server or Perl setup.

    ps. I would just like to add that a webapp will spawn multiple PERL instances ie. ActivePerl uses 7MB per instance in memory and StrawberryPerl uses 5MB per instance. I have created App in the past that would easily spawn 15 or more PERL instance in memory per session/browser connection. One user connecting to me app easily uses up to 150MB of PERL instances whilst the actual Webapp is not using a lot of memory by itself. The correct way to about it would be to make use of NGINX and then running standalone Webapps. I have not setup NGINX before but there are some people that have written about in this forum.

  5. Rudolph T

    Feb 13 Pre-Release Testers, Xojo Pro South Africa

    Standalone would be similar to running the app in debug mode. So if it stable in debug it means something on your CGI/Apache setup could be the problem.

  6. Rudolph T

    Feb 13 Pre-Release Testers, Xojo Pro South Africa

    @Mark S posted this link a while back. https://forum.xojo.com/39103-nginx-proxy-making-me-crazy/p2#p321563 about setting up XOJO Webapps with NGINX.

  7. Tony L

    Feb 13 Pre-Release Testers, Xojo Pro Hong Kong

    Rudolph, thanks a lot for your reply. I will try to deploy it as standalone app. Btw, does the error message refers to anything?

  8. Greg O

    Feb 13 Xojo Inc Somewhere near Raleigh, NC

    Hang on... Xojo Cloud runs as CGI, and there’s no reason why he can’t get this working.

    @Tony L The cgi runs on our own Linux Server. Is it running out of memory or CPU? As my app is still in testing, number of concurrent users is limited, normally less than 5.

    Yes, it certainly could be that. The errors you showed are indicative of an app that is closing mid request. To be truthful, it could be any exception causing this though

    Just out of curiously, have you implemented the UnhandledException events in App and Session to have them write to a file if something goes wrong?

    Another possibility is that you’ve somehow created a circular reference and there are objects being created that can’t be released. You’d eventually run out of ram from this too. The most common example is when users add a property to a webPage which points to the current session. Doing so means that when the app is finally done with the Session, it can’t delete it because there’s a page referencing the Session and the page can’t be deleted because that same session references the page.

    Look in the system log for references to your app by name. Seeing any errors from there may help diagnose the issue.

  9. Rudolph T

    Feb 13 Pre-Release Testers, Xojo Pro South Africa

    Greg I have tried multiple angles on CGI and I always run into an issue with the Apps spawning multiple PERL instances as explained above. Is there an example that shows ho to prevent this from happening?

  10. Tony L

    Feb 13 Pre-Release Testers, Xojo Pro Hong Kong

    @greg, yes I have implemented unhandled exception as you told me in another thread. There is a few records captured but it doesn’t seem that the shut down triggers any exception.

    I have looked into the Apache log, and what’s in there are those I posted in this thread. As I am not so familiar with Apache, so I need help to explain what the errors are about.

  11. Tony L

    Feb 13 Pre-Release Testers, Xojo Pro Hong Kong

    @greg, what is “closing mid request”? And shouldn’t be that xojo closes all runtime generated objects (or variables) when they are out of scope?

    For runtime created containers, I always check if it is nil before I create them.

  12. Greg O

    Feb 14 Xojo Inc Somewhere near Raleigh, NC

    @Rudolph T Greg I have tried multiple angles on CGI and I always run into an issue with the Apps spawning multiple PERL instances as explained above. Is there an example that shows ho to prevent this from happening?

    There should be one instance of the Perl script for each concurrent request... usually 2-4 per user. Bug I digress...

  13. Greg O

    Feb 14 Xojo Inc Somewhere near Raleigh, NC

    @Tony L yes I have implemented unhandled exception as you told me in another thread. There is a few records captured but it doesn’t seem that the shut down triggers any exception

    How about instead of having two concurrent threads about the same issue, we just chat here...

  14. Greg O

    Feb 14 Xojo Inc Somewhere near Raleigh, NC

    @Tony L what is “closing mid request”? And shouldn’t be that xojo closes all runtime generated objects (or variables) when they are out of scope?

    I’m talking about the app itself, not individual objects. Everything you’ve said so far points toward your app crashing (or being forced to quit by the OS)

    What we need to know next is how much RAM/CPU your server has and whether your app appears in /var/log/messages or /var/log/kernel.log. I’m guessing that we’ll find either a segfault (usually indicating an out of memory condition) or that there’s a maintenance app on the server that kills processes which use high CPU/RAM for extended periods of time. But you’ll need to look in the logs to find that out.

  15. Tony L

    Feb 14 Pre-Release Testers, Xojo Pro Hong Kong

    @Greg OLone How about instead of having two concurrent threads about the same issue, we just chat here...

    Sorry about that, but that's another problem a month or 2 ago. Last time the app crash was due to a button.mousedown event, and I changed to button.action, the problem was gone, so I thought everything is on the right track. But app crashes just happened again a week ago....

  16. Tony L

    Feb 14 Pre-Release Testers, Xojo Pro Hong Kong

    @Greg OLone I’m talking about the app itself, not individual objects. Everything you’ve said so far points toward your app crashing (or being forced to quit by the OS)

    What we need to know next is how much RAM/CPU your server has and whether your app appears in /var/log/messages or /var/log/kernel.log. I’m guessing that we’ll find either a segfault (usually indicating an out of memory condition) or that there’s a maintenance app on the server that kills processes which use high CPU/RAM for extended periods of time. But you’ll need to look in the logs to find that out.

    I have monitored the memory and CPU usage, doesn't seem a problem due to these 2. I will try to have a look at the server settings that you suggested and see what I can find there.

    Sorry that English is not my native language, I may misrepresent or misunderstood.

  17. Lars L

    Feb 14 Europe (Germany, Chemnitz)

    We experience the same problem since the last Xojo version on a standalone application. It's quitting occasionally. No high CPU-use, no high or growing RAM. And we didn't a thing on our app since the last version.

  18. Tony L

    Feb 14 Pre-Release Testers, Xojo Pro Hong Kong

    @Lars L We experience the same problem since the last Xojo version on a standalone application. It's quitting occasionally. No high CPU-use, no high or growing RAM. And we didn't a thing on our app since the last version.

    Did your problem solved yet? I am on 2017r3 however.

  19. Lars L

    Feb 14 Europe (Germany, Chemnitz)

    No, it's annoying. We wrote a console-app, which is starting our regular app every time it crashed. Thats a bad workaround, but we've got no idea how to fix this.

  20. Tony L

    Feb 14 Pre-Release Testers, Xojo Pro Hong Kong

    Sorry, mine is 2017r2.1

  21. Newer ›

or Sign Up to reply!