Page MenuHomePhabricator

ecore_con: ecore_con_server_del does not unlink socket
Closed, ResolvedPublic

Description

With latest EFL (this is a recent regression:

Using local unix sockets.

Using a client/server with ecore_con_server_add. When trying to use the same socket path again ecore_con_server_add fails. We use this code in Edi for notification.

UPDATE:

ecore_con_server_del is not unlinking local unix sockets atm. Previously it did.

netstar created this task.Nov 30 2017, 4:48 AM
netstar added a subscriber: cedric.

So functionally for each socket_name this only works once.

Ordinarily we could do notification for build/clean/test as many times as we liked, it breaks after first notification.

Maybe we are doing something wrong here??? It DID work. :)

Okay, it seems ecore_con_server_del() isn't deleting the local socket from disk.

netstar renamed this task from ecore_con: client/server regresssion to ecore_con: ecore_con_server_del does not unlink socket.Dec 15 2017, 2:00 AM
netstar updated the task description. (Show Details)

The file descriptor is being closed properly (-1), some reason the file remains now.

On Linux when I restart E, am having efreetd failure. I wonder if this is related???

netstar added a subscriber: raster.Dec 18 2017, 7:12 AM

The efreet errors do seem to be due to stale sockets.

ERR<15397>:efreet_cache lib/efreet/efreet_cache.c:169 _cb_server_del() efreetd connection failed 10 times! check for stale socket files in /run/user/1000//.ecore/efreetd

i just started seeing these dialogs in the last few days/week or so... i haven't checked to see if the dialog code is new though or the fact it is happening is new.

yeah. efreetd is just not running now. this is really recent.

So, seems efreetd is working on Linux and FreeBSD, but still having issues here on both platforms with Edi.

as i said on irc. i think these are 2 different issues. the efreetd one was more urgent as it impacted a core service in efl. the one you have (add server, del server, then add again within the same process run) is a different issue i think. that needs a different look into it. i may have to write a small test case for this.

ok. i made a simple example:

#include <stdio.h>
#include <Ecore.h>
#include <Ecore_Con.h>

Ecore_Con_Server *svr = NULL;

Eina_Bool
_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
   Ecore_Con_Event_Client_Add *ev = event;

   printf("INFO: client added %p: %s\n", ev->client, ecore_con_client_ip_get(ev->client));
   return ECORE_CALLBACK_RENEW;
}

Eina_Bool
_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
   Ecore_Con_Event_Client_Del *ev = event;

   printf("INFO: client deleted %p: %s!\n", ev->client, ecore_con_client_ip_get(ev->client));
   ecore_con_client_del(ev->client);
   return ECORE_CALLBACK_RENEW;
}

Eina_Bool
_data(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
   Ecore_Con_Event_Client_Data *ev = event;

   printf("INFO: client data %p: %s\n"
          "INFO:  - size: %d\n"
          "-- BEGIN DATA --\n",
          ev->client, ecore_con_client_ip_get(ev->client),
          ev->size);

   fwrite(ev->data, ev->size, 1, stdout);
   puts("-- END DATA --");

   ecore_con_client_send(ev->client, ev->data, ev->size);
   ecore_con_client_del(ev->client);

   return ECORE_CALLBACK_RENEW;
}

Eina_Bool
_timer(void *data EINA_UNUSED)
{
   ecore_con_server_del(svr);
   svr = ecore_con_server_add(ECORE_CON_LOCAL_USER, "test", 0, NULL);
   if (!svr)
     {
        printf("Can't create server 2\n");
        exit(-1);
     }
   else
     {
        printf("New server %p\n", svr);
     }
   return EINA_TRUE;
}

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

   ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, _add, NULL);
   ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, _del, NULL);
   ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, _data, NULL);

   svr = ecore_con_server_add(ECORE_CON_LOCAL_USER, "test", 0, NULL);
   if (!svr)
     {
        printf("Can't create server 1\n");
        exit(-1);
     }
   printf("Server %p\n", svr);

   ecore_timer_add(1.0, _timer, NULL);

   ecore_main_loop_begin();

   ecore_con_server_del(svr);
   svr = NULL;

   ecore_con_shutdown();
   ecore_shutdown();
   eina_shutdown();

   return 0;
}

it works well for me here... :/ ? :\ :(

Server 0x55fa5b27a8c0
New server 0x55fa5b277ab0
New server 0x55fa5b277020
New server 0x55fa5b273610

and so on...

zmike edited projects, added Restricted Project; removed efl.Jun 11 2018, 6:56 AM
zmike edited projects, added efl: networking; removed Restricted Project.Jun 11 2018, 8:47 AM
netstar closed this task as Resolved.Jun 15 2018, 3:58 AM

This seems resolved. It has been a long time since looking into the issue.