Hi,

That's true: elev8 'server mode' isn't working anymore. At some point after
Eo introduction, when elev8 forks itself in order to create a child process
that will run the script, the child process will face lots of errors when
trying to create its ecore objects (ecore_job and ecore_timer, for
instance).
As far as I could debug it, it's related to eina_main_loop_is(), which
return false in every call on the child process. So, ecore_jobs and timers
will not be created, leading to many error messages and eventually a
segfault. Just making eina_main_loop_is() return true will also lead to a
bad behaviour, so I think this problem is deeper.
I've attached an example of what I mean. The program will create a timer,
and when the timer expires, it'll fork a child, that will run an elementary
application. It will work, but it's possible to see all errors raised by
ecore. Does someone have an idea why this happens? Calling
ecore_fork_reset() has no effect on these bugs.

Thanks,


On Tue, Dec 11, 2012 at 11:32 PM, Lucas De Marchi <
lucas.demar...@profusion.mobi> wrote:

> On Tue, Dec 11, 2012 at 3:09 PM, Enlightenment SVN
> <no-re...@enlightenment.org> wrote:
> > Log:
> > elev8: Option to server mode do not "daemonize".
> >
> >   Summary:
> >    - Added option '--no-daemonize' to not start server mode as a daemon.
> >    Useful for systemd.
> >
> >    Author:    ederson <eder...@profusion.mobi>
> >
> > Author:       mello
> > Date:         2012-12-11 09:09:39 -0800 (Tue, 11 Dec 2012)
> > New Revision: 80674
> > Trac:         http://trac.enlightenment.org/e/changeset/80674
> >
> > Modified:
> >   trunk/PROTO/elev8/src/bin/args.c trunk/PROTO/elev8/src/bin/args.h
> trunk/PROTO/elev8/src/bin/main.cc
> >
> > Modified: trunk/PROTO/elev8/src/bin/args.c
> > ===================================================================
> > --- trunk/PROTO/elev8/src/bin/args.c    2012-12-11 16:48:49 UTC (rev
> 80673)
> > +++ trunk/PROTO/elev8/src/bin/args.c    2012-12-11 17:09:39 UTC (rev
> 80674)
> > @@ -17,6 +17,7 @@
> >    {
> >      ECORE_GETOPT_STORE_DEF_BOOL(0, "debug", "enable debuggind mode",
> EINA_TRUE),
>
> debugging?
>
> >      ECORE_GETOPT_STORE_DEF_BOOL(0, "server", "enable server mode",
> EINA_TRUE),
> > +    ECORE_GETOPT_STORE_DEF_BOOL(0, "no-daemonize", "do not create a
> daemon on server mode", EINA_TRUE),
> >      ECORE_GETOPT_STORE_DEF_BOOL(0, "shutdown", "shutdown elev8
> server.", EINA_TRUE),
> >      ECORE_GETOPT_STORE_DEF_BOOL(0, "connect", "run app spawing a elev8
> server.", EINA_TRUE),
> >      ECORE_GETOPT_HELP('h', "help"),
> > @@ -33,6 +34,7 @@
> >     Ecore_Getopt_Value values[] = {
> >       ECORE_GETOPT_VALUE_BOOL(args->debug),
> >       ECORE_GETOPT_VALUE_BOOL(args->server),
> > +     ECORE_GETOPT_VALUE_BOOL(args->no_daemonize),
> >       ECORE_GETOPT_VALUE_BOOL(args->shutdown),
> >       ECORE_GETOPT_VALUE_BOOL(args->connect),
> >       ECORE_GETOPT_VALUE_BOOL(args->quit),
> >
> > Modified: trunk/PROTO/elev8/src/bin/args.h
> > ===================================================================
> > --- trunk/PROTO/elev8/src/bin/args.h    2012-12-11 16:48:49 UTC (rev
> 80673)
> > +++ trunk/PROTO/elev8/src/bin/args.h    2012-12-11 17:09:39 UTC (rev
> 80674)
> > @@ -11,6 +11,7 @@
> >    typedef struct {
> >       Eina_Bool debug;
> >       Eina_Bool server;
> > +     Eina_Bool no_daemonize;
> >       Eina_Bool shutdown;
> >       Eina_Bool connect;
> >       Eina_Bool quit;
> >
> > Modified: trunk/PROTO/elev8/src/bin/main.cc
> > ===================================================================
> > --- trunk/PROTO/elev8/src/bin/main.cc   2012-12-11 16:48:49 UTC (rev
> 80673)
> > +++ trunk/PROTO/elev8/src/bin/main.cc   2012-12-11 17:09:39 UTC (rev
> 80674)
> > @@ -493,7 +493,8 @@
> >
> >     if (args.server)
> >       {
> > -        daemonize();
> > +        if (!args.no_daemonize)
> > +          daemonize();
>
> why not just remove daemonize support? systemd and other inits can
> handle the damonization part for themselves. No need for this.
>
>
> Lucas De Marchi
>
>
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>



-- 
Ederson de Souza
ProFUSION Embedded Systems
//gcc -o test test.c `pkg-config --cflags --libs elementary`

#include <stdio.h>
#include <Elementary.h>

Evas_Object *win, *bg, *btn1;

typedef struct {
  int argc;
  char **argv;
} Args;

int forkk(){
  pid_t pid;

  pid = fork();
  if (!pid)
    {
       sleep(7);
       ecore_fork_reset();
    }

  return pid;
}

int elm_main(int argc, char **argv){
  win = elm_win_add(NULL, "Elementary", ELM_WIN_BASIC);

  if (win == NULL)
    return -1;

  bg = elm_bg_add(win);
  elm_bg_load_size_set(bg, 300, 300);
  elm_bg_color_set(bg, 100, 100, 200);
  evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  elm_win_resize_object_add(win, bg);
  evas_object_show(bg);

  btn1 = elm_button_add(win);
  elm_object_text_set(btn1, "Button");
  evas_object_resize(btn1, 120, 50);
  evas_object_move(btn1, 93, 101);
  evas_object_show(btn1);

  evas_object_resize(win, 300,300);
  elm_win_autodel_set(win, TRUE);
  elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
  evas_object_show(win);

  return 0;
}

Eina_Bool
timer_cb(void *data)
{
  Args *args = (Args*)data;
  if (!forkk())
    {
       elm_init(args->argc, args->argv);
       elm_main(args->argc, args->argv);
    }

  return ECORE_CALLBACK_CANCEL;
}


int main(int argc, char **argv)
{
  ecore_init();

  Args args = {argc, argv};

  ecore_timer_add(3, timer_cb, &args);
  ecore_main_loop_begin();
  ecore_shutdown();
  return 0;
}
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to