WebListBox items not shown by webapp unless run as sudo

Xojo 2021r2.1; a web app on linux does not show any WebListBox items (tried many browsers). if I run the web app it as another user, it does. How is this possible?

I addded debug just before the line that does AddRow to the WebListBox, and it prints out the data that is supposed be in the listbox. But in browser there is nothing.

As an update: unless the webapp is run as sudo, no buttons or controls work on it.

run the webapp as sudo or other user, it works. how?

Ubuntu-1804-bionic-64 4.15.0-154-generic.

Check the permissions of everything in the resources directory and make sure they are not restricted to root.

I gave the entire directory where web app is located and all its children access drwxrwxrwx and still same.

and Port is > 1024 ?

yes it is, port 8080. I can open the page but no controls work. There are no errors or messages from app, so not sure what is happening.

make sure it’s not already or still running… you could happen to have forgot it was running in the background?

killed them all for sure. It fails to start anyway if something listens on same port

That’s correct but do you have more web apps on the same server?

  • If so, then make sure the identifier is different in the build settings.

perhaps apache (re)started and highjacked the port?

  • this happens because apache may be installed by default on your server and be a service that auto-resets.

it is a standalone app, no apaches or anything else there. Th app loads, reads config from a file, connects to mysql and so on. even retrieves items from database that are supposed to be loaded into a weblistbox. Only there is nothing in that listbox when the page is opened in a browser. I even have a label that shows how many items are supposed ti be in that list (row count of db query). It’s correct, but no items

and no buttons work.

run as sudo - everything works…

Do you create some file at runtime? Any possibility that it has created a file once under sudo that later a regular user can’t have the proper access?

Nope, doesn’t create any files. I tried to run it as a “service” in supervisor, so it ran as “supervisord” user. it worked. try from console as any other user - not working.

1 Like

There’s still a bunch of things it could be, but the fact that it runs fine with elevated privileges still means that it is a permissions issue.

I’d start looking at the logs in /var/log and see if you get any errors in any of those files when launching or accessing your app.

did you make sure the executable is set to chmod 755 ? so that others can execute too. It could be most likely be a permissions issue as @Greg_O_Lone suggests here.

The execution permission is not the issue, it executes.

However UI elements in the web page of this app are broken depending which user runs it. Sometimes it works when run by non-admin user, too. Why, who knows. There is nothing in logs anywhere and the app displays the web pages, but listboxes don’t display any items.

A different web app, in a different directory, on a different port fails to respond to HandleURL, unless run as sudo.

Is there some files it wants to create or access somewhere, even for a HandleURL request? I swear i gave all permissions to files in the entire directory where the web app is, but unless its run as sudo it glitches.

You’ll certainly need access to the temp directory for that (whatever SpecialFolder.Temporary points to). However I wouldn’t expect the app to work at all out it didn’t. That said most requests up to 256K are handled completely in memory so unless you’re posting huge amounts of data, I wouldn’t have spect you to run into that.

the app runs without complaints, but a handleURL request hangs unless it’s run as sudo.
requests are tiny.

And what is being done in that HandleUrl call?

Response.Write (list)
Response.Status = 200
return true

list is a JSON string.

Assuming this is the same machine that Xojo is crashing on, you wouldn’t happen to have SELinux enabled, would you?

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.