About Store Forum Documentation Contact



Post Reply 
APP_EXIT_IMMEDIATELY
Author Message
Houge Offline
Source Licensee

Post: #1
APP_EXIT_IMMEDIATELY
Hi,

How do I manage time with APP_EXIT_IMMEDIATELY flag, if Time.update() is a private function?
I wish I could call it manually.

And how can I call Shut() in that case? I have a while() loop in IntPre, but when I kill an application Shut() never gets called (even if I override App.quit and App.exit functions).
(This post was last modified: 01-03-2019 02:47 AM by Houge.)
01-03-2019 02:34 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RedcrowProd Offline
Binary Licensee

Post: #2
RE: APP_EXIT_IMMEDIATELY
App.quit and app.exit is ignored with initpre flag. (I think)
Because the flag says it shutdown after the initpre func finishes (and not immediately pfft), id simply check on the last line of the initpre if app.flag contains app_exit_immediately and if so do the shut() func
(This post was last modified: 01-03-2019 05:15 AM by RedcrowProd.)
01-03-2019 05:09 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: APP_EXIT_IMMEDIATELY
What's the reason to make a loop in InitPre?
01-03-2019 11:28 AM
Find all posts by this user Quote this message in a reply
Houge Offline
Source Licensee

Post: #4
RE: APP_EXIT_IMMEDIATELY
Long story short - I want to run EE apps on a headless server. By "headless" I mean not APP_ALLOW_NO_GPU flag and not running an app without GPU (on integrated graphics), but literally on a "headless" server, with NO display at all.

Now what I need to do to run compiled EE app on a headless linux server (new install on DigitalOcean):
1. Create Ubuntu 18.04 VM.
2. Install all needed packages.
3. Create virtual framebuffer (aka virtual display) using Xvfb
4. Export display in console (export DISPLAY=:0 )
5. Run EE application
6. Run VNC server to manage application (like EE server for projects).

and everything is OK.

If I don't do items 3-4, I get the following error:
Code:
> ./Server
Can't open XDisplay
sh: 1: zenity: not found

I wanted to try to move Update() to IntPre() because I thought display is not initialized there and that's the reason to use APP_EXIT_IMMEDIATELY, but it looks like I am wrong.

I love this engine very much, but in my opinion it currently has one problem (actually wo, but one comes from another): inability to run headless out of the box. The problem that comes from this one is that "Server" application for collaborative work is hard to host because you need to have either Windows server (which is inefficient in disk space and resources), or use virtual framebuffers, which is complex and eats a lot of resources, because display is handled by CPU and ram.

For Serer application it would be cool to have console application for settings/account management (or if the same app is run with arguments like "get" or "set" it would be nice too), because you need to login to Linux machine with server to perform setup anyway.

I can do it myself, but I don't want to drag custom changes through EE versions, because I think these features are needed in default versions of EE and Server.

=====
Quote:What's the reason to make a loop in InitPre?
HERE you said the following:
Quote:if you don't need graphics directx initilization then you can do your codes in InitPre and enable flag APP_EXIT_IMMEDIATELY
(This post was last modified: 01-04-2019 02:38 AM by Houge.)
01-04-2019 01:22 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #5
RE: APP_EXIT_IMMEDIATELY
Hi,

The simple workaround is to run Server on your local computer, configure it fully, and then copy the "Server Settings" and replace that file on the headless linux server.

If you have any code changes that makes EE better, feel free to submit them to github repository.

Thank you!
01-04-2019 03:29 AM
Find all posts by this user Quote this message in a reply
Houge Offline
Source Licensee

Post: #6
RE: APP_EXIT_IMMEDIATELY
Thanks for your answer, Esenthel.

And I will smile

I created a pull request for headless for Linux. I tested it with "Esenthel MMO" package, running server on headless Ubuntu 18.04 VM (actually that was a container, but the same thing in general) and Clients on Windows.

Next thing I would like to do is to slightly update Installer to allow it to run headless too (setting installation path as an argument), for example:

Code:
>./EsenthelInstaller -install-dir=/home/esenthel/Esenthel

Because the only thing it needs to run is a path to install, and this will make headless servers updates much easier (now it is really a pain). I'll create this pull request in the nearest future (if you don't implement it first).
(This post was last modified: 01-05-2019 07:33 PM by Houge.)
01-05-2019 07:22 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #7
RE: APP_EXIT_IMMEDIATELY
Hi,

Thanks for your contribution, the Pull Request had various issues, so I've cancelled it, and submitted my own patches.
Also added support for detecting command line on Linux so you can play around with the installer.
01-06-2019 08:02 AM
Find all posts by this user Quote this message in a reply
RedcrowProd Offline
Binary Licensee

Post: #8
RE: APP_EXIT_IMMEDIATELY
Woaw That is awesome i am def. Looking towards to use this as i remember using the same technique as houge to set up my linux server on my old project.
Once again i am reminded how much i enjoyed this engine smile
(This post was last modified: 01-06-2019 08:40 AM by RedcrowProd.)
01-06-2019 08:38 AM
Find all posts by this user Quote this message in a reply
Houge Offline
Source Licensee

Post: #9
RE: APP_EXIT_IMMEDIATELY
(01-06-2019 08:02 AM)Esenthel Wrote:  Hi,

Thanks for your contribution, the Pull Request had various issues, so I've cancelled it, and submitted my own patches.
Also added support for detecting command line on Linux so you can play around with the installer.

Yes, sure, that is totally fine, because you know the engine a lot better than me grin
I remember it was like that every time and I am OK with that.
Thank you!
01-06-2019 03:56 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Houge Offline
Source Licensee

Post: #10
RE: APP_EXIT_IMMEDIATELY
Please tell me how I should edit the editor code, as an Esenthel project (not in "EsenthelEngine\Editor Source\_Build_\Esenthel"), right?
(This post was last modified: 01-06-2019 10:41 PM by Houge.)
01-06-2019 09:09 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #11
RE: APP_EXIT_IMMEDIATELY
Open the Editor
Go To: "C:\Esenthel\Editor Source\" in the Editor
Open "Esenthel Editor" Project
01-07-2019 03:49 AM
Find all posts by this user Quote this message in a reply
Houge Offline
Source Licensee

Post: #12
RE: APP_EXIT_IMMEDIATELY
Can you please also include XDisplay or flag check in InitSound()?

I get the following warnings (but the application still runs, not exits):

Code:
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
AL lib: (EE) ALCplaybackAlsa_open: Could not open playback device 'default': No such file or directory

I also see you are doing something with "active_wait" now, can you please include more wait time (using active_wait and background_wait I assume) to Server application by default, like 5ms or 10ms (now there is Time.wait(1) in Update()).
It will allow to utilize CPU time much more efficiently on the servers.
(This post was last modified: 01-13-2019 01:52 AM by Houge.)
01-13-2019 01:30 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Houge Offline
Source Licensee

Post: #13
RE: APP_EXIT_IMMEDIATELY
And one more thing, I think it would be great if we could check if application is currently headless during runtime, can you please add something like
Code:
Bool App.isHeadless()
Which will always return false except the time when XDisplay fails to initialize?

Sorry I'm still bothering you about this.
(This post was last modified: 01-13-2019 10:42 PM by Houge.)
01-13-2019 10:41 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #14
RE: APP_EXIT_IMMEDIATELY
Sounds work independently on XDisplay (they're not connected).

Delay bigger than 1 would slow down synchronization between server and clients.

Just made public:
D.created
in latest engine source.
01-14-2019 08:24 AM
Find all posts by this user Quote this message in a reply
Houge Offline
Source Licensee

Post: #15
RE: APP_EXIT_IMMEDIATELY
(01-14-2019 08:24 AM)Esenthel Wrote:  Sounds work independently on XDisplay (they're not connected).
Yes, but there is no sound when server is headless. So just ignore this errors? Doesn't seem right to me.
Maybe add something like APP_NO_SOUND then? I don't know.

(01-14-2019 08:24 AM)Esenthel Wrote:  Delay bigger than 1 would slow down synchronization between server and clients.
What about App.active_wait? Isn't it a solution for this?
But with 1ms it uses 10% of VPS's CPU when idle. OK, I'll make it as a custom setting in my version.

(01-14-2019 08:24 AM)Esenthel Wrote:  Just made public:
D.created
in latest engine source.
Thank you!
(This post was last modified: 01-14-2019 04:46 PM by Houge.)
01-14-2019 01:14 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply