Webapp kills Apache

Hi all,

Is there any possible reason that a Xojo Web app would kill the Apache? The symptom is when the same app is opened more than once in the same PC, all other users will be kicked out and the web server has to be restarted again. But this does not happen to all machines, only some machines in the office cause this problem.

Environment: Ubuntu 16.04.3 LTS + Apache: 2.4.18 + Xojo 64-bit deployment

Thanks in advance.

Is there anything in the Apache logs related to the crash?

Check memory usage on that server. When available memory gets low, the OS will sometimes kill off non-essential processes… like Apache.

Here is the print screen of the error log:

https://drive.google.com/open?id=1V8kHhoDbOetUwRI-VkkfxruzIGkoxtBV

If you have 2 instances you should have uniqe app identifier.

If you upload using ftp, try using binary upload mode.

Not sure what’s actually happening here, could be a memory issue (circular reference?)

Unique identifier? Can be changed at run-time? Some more information, if the user entered an incorrect password in the Login page which is the first page when the app loads, the app kills immediately. However, the app design is just showing a message box telling the user has entered an incorrect password, nothing else.

@Derk Jochems , I just copy everything in the build folder generated by Xojo to the Linux Samba, not by ftp. The app runs ok if correct password is entered.

Does it “crash” when you run the app locally in the IDE? If so, you should be able to step through and figure out what’s causing it.

[quote=367194:@Tony Lam]Unique identifier? Can be changed at run-time? Some more information, if the user entered an incorrect password in the Login page which is the first page when the app loads, the app kills immediately. However, the app design is just showing a message box telling the user has entered an incorrect password, nothing else.

@Derk Jochems , I just copy everything in the build folder generated by Xojo to the Linux Samba, not by ftp. The app runs ok if correct password is entered.[/quote]

If that’s true, try it in a browser (safari or chrome) with developer tools, then show the page source and see the console. Leave the page source window of the browser open and go back to your web app and fill in the form, wrong (to get the crash) see what the browser is writing in the console.

OR: show us some code that’s inside the function or event that handles the form. It could be your doing something wrong.

@Greg O’Lone , nothing wrong when running locally ( thru Xojo debugger if I do not get your meaning wrong). Also if I entered the login information correctly, the app runs perfectly.

@Derk Jochems , thanks for your advise, will have it a try.

Well… tired of having the Apache down always… Would somebody can help to have a look at my app

https://drive.google.com/open?id=13Z1z9jtDoDS3obpcsmlXq5M8_Vzy0VMv

The symptom is: when somebody tries to login with invalid login information, sometimes (not always) the app will make down the Apache which then leads to all users using the app being killed. The app keeps running well if it can bypass the login problem, crashing seems only appears during login. The codes regarding login is in folder Interface -> System Login.

Another thing is, I noticed that errors keep recording in the Apache Error Log:

https://drive.google.com/open?id=1V8kHhoDbOetUwRI-VkkfxruzIGkoxtBV

This doesn’t seem to relate to the login problem as errors keep recording every 6 seconds around even the app is keep on running or I killed all the processes in Apache.

To me, its a big and important project. Please someone kind enough to give some advises. Thanks very much in advance again.

From what you’ve described and the error log you provided I really don’t think Apache is crashing. I would totally believe that your app is crashing though.

At first glance, let me suggest that you add a handler for App.UnhandledException and start logging what gets sent there. The way your app is configured right now, if an exception occurs, your app will definitely quit.

Thanks Greg, I added the following codes to event UnhandledException for both app and session, but it doesn’t seem catch anything:

dim rec as new DatabaseRecord
dim id as integer

rec.IntegerColumn("AppSession") = 2
rec.IntegerColumn("Number") = error.ErrorNumber
rec.Column("Message") = error.Message
rec.Column("Reason") = error.Reason
id = session.InsertRecord(app.UnicornDatabaseName, "ERRORLOG", rec, "app.UnhandledException", 1) //my insert statement

return false

Just found out that I have a bug in a module (not login module) that fires the session.UnhandledException when an exception occurs. The event actually works when an exception occurs, but it doesn’t fire when login fails then make the app crash, which means it is not an Exception error?

Not necessarily, but let’s check something else.

Have you checked the system logs? Specifically look for logs related to your app. If it’s being forcibly quit, it may be giving us a clue.

Finally, figured out what happened… I used to put all codes in the WebButton Action event, just don’t know why for the Login button, the codes are in the MouseDown event. After I put back the codes to the Action event, the problem is gone. Will MouseDown event of a WebButton make crash the app?

It shouldn’t. It’s just another event. Now it could be that MouseDown was also being sent to another control as well so more code than you thought was being run.

But what I have done is simply add an Action event to the button, copy the codes from MouseDown event, then delete the MouseDown event, nothing else.

I understand. What you dont know though is the relationship between MouseDown and Action in the JavaScript framework itself. The Action event fires later than all of the MouseDown events on the page because it’s actually connected to MouseUp, so while making this change sounds simple, it drastically changes the order that the events fire.

My guess is that the code in this event somehow relies on something else having previously run and now that it’s running later, the state is as it should be.

It is no doubt that I do not know much about the framework, sorry about that. But your guess reminds me that codes put in the Open event and in Shown event are not the same. I once put codes to create a container at runtime in Open event caused me troubles, then I put them in the Shown event and the problem was gone :slight_smile:

No need to apologize. Our event handling on the browser has some subtle issues that make it difficult to track this stuff down sometimes.