ecore_con - move libproxy to a slave binary with stdin/out msging
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Sun, 8 Jan 2017 13:57:54 +0000 (22:57 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Mon, 9 Jan 2017 06:29:33 +0000 (15:29 +0900)
commitbd2f189d4c8dcaecde9b821f59ccd3978f940dfd
treec5bba7b5ebda7b4e72fc0ee38acd518bb8b28560
parent5bb9294966ef8a95089edb390e1093750ba38ca7
ecore_con - move libproxy to a slave binary with stdin/out msging

so here's the ugly problem. libproxy. yes. we've discussed memory
usage (e.g. it may have to execute javascript and pull in lots of deps
etc.) but we dlopene'd on the fly. ok... but this didn't solve another
issue i hit:

libproxy was causing enlightenment to abort(). some internal bit of
libproxy was raising a c++ exception. this wasn't caught. this causes
an abort(). takes down your entire desktop. FANTASTIC. this is bad. i
wouldnt' expect a library we depend on to be THIS anti-social but
libproxy seemingly is. it SHOULd catch its error sand just propagate
back to us so we can handle gracefully.

there reall is no way around this - isolate libproxy. it's even worse
that libproxy can load arbitrary modules that come from anywhere sho
who knows what issues this can cause. isolation is the best solution i
can think of.

so this makes an elf+net_proxy_helper we spawn the first time we need
a proxy lookup. we re-use that binary again and again until it exits
(it should exit after 10 seconds of being idle with no requests coming
in/pending). it'll respawn again later if needed. this involves now
the efl net threads having to marshall back to mainloop to do the
spawn and to write to the proxy process (reading is done by async exe
data events and the data is passed down a thread queue to the waitng
efl net thread). if the exe dies with pending requests unanswered then
it's respawned again and the req's are re-sent to it... just in case.
it has a limit on how often it'll respawn quickly.

this seems to work in my limited testing. this ALSO now isolates
memory usage of libproxy to another slave process AND this process
will die taking its memory with it once it's been idle for long
enough. that;s also another good solution to keeping libproxy impact
at bay.
.gitignore
src/Makefile_Ecore_Con.am
src/bin/ecore_con/efl_net_proxy_helper.c [new file with mode: 0644]
src/lib/ecore_con/ecore_con.c
src/lib/ecore_con/ecore_con_private.h
src/lib/ecore_con/ecore_con_proxy_helper.c [new file with mode: 0644]
src/lib/ecore_con/efl_net_dialer_http.c