Live upgrade and new views

138 views
Skip to first unread message

Tomas Morstein

unread,
Jul 1, 2013, 4:51:05 PM7/1/13
to chica...@googlegroups.com
Hi,

Is there any reason why the new code (at least views) is not loaded during the code hot-swap via init.sh reload?
From what I saw in the CB source, hot-swap only reloads the existing (already loaded) code what seems to be correct because I would expect the new (compiled, but not loaded) module to be lazy-loaded at the time when it is called from somewhere, not soon.

But instead of this expected behaviour, CB reports internal error because of "missing" view.

Is my expectation correct? Do we need to take an extra care when reloading the app?

Thanks,
Tom

PS: we always used 'restart' before -- but now, we've managed to have 100% of our dependencies hot-swap friendly, so why to bother with hard restart anymore? :-)

Evan Miller

unread,
Jul 2, 2013, 11:55:21 AM7/2/13
to ChicagoBoss
Hi Tom,

Can you share the exact error message you're seeing? You're talking about running in production, right? All of the modules, including the view modules, ought to be correctly reloaded when you do an init.sh reload.

Evan



--
You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Evan Miller
http://www.evanmiller.org/

Tomas Morstein

unread,
Jul 2, 2013, 12:53:53 PM7/2/13
to chica...@googlegroups.com
Hi Evan,

It gives 404 with no more errors in logfiles. Of course, it's in production mode.
I've just tried to simulate it:
- removed all ebin/*.beam, moved existing src/view/x/y.html to /tmp
- rebar compile
- init.sh start
- app returns HTTP 404 for the specified page (this is OK)
- now /tmp/y.html moved back to src/view/x/y.html
- rebar compile, ebin/appname_view_x_y.beam exists
- init.sh reload
- "loading routes from bla bla bla..." appears in log
- app still returns HTTP 404 for /x/y URI
- init.sh attach; l(appname_view_x_y) gives {ok, appname_view_x_y}, but still HTTP 404 on the web
- boss_load:reload_all() by hand on eshell -- still no errors, and {module, appname_view_x_y} IS member of the returned array!

...I really don't know what's wrong, but it seems that even if the module is loaded correctly, it won't get rendered and reports (if the error handling routes are disabled) well known message [The requested template ("src/view/home/dashboard.{dtl,html,txt,jade,eex}") was not found. Additionally, no handler was found for processing 404 errors. You probably want to modify ../weberp/priv/weberp.routes to prevent errors like this one."].

After './init.sh restart', everything works again. It's a regular CB from your github, thus no hacks:
$ git describe master
v0.8.7-39-g05e20a7

...we only use model_manager other than default but I don't think this is the problem.

Tom

Tomas Morstein

unread,
Jul 2, 2013, 1:00:32 PM7/2/13
to chica...@googlegroups.com
BTW, we also wanted to upgrade rebar, so we decided to install it system-wide and don't ship it with any of our projects. But since it is required for all the init.sh stuff, we replaced it by shellscript which attempts to call a regular rebar binary from somewhere in the user's path.
What if we did the same for the rebar binary in CB skeleton dir?

T.

Evan Miller

unread,
Jul 13, 2013, 3:25:30 PM7/13/13
to ChicagoBoss
Did you figure this issue out?

I don't think calling a rebar in the user's path is a good idea because that leads down into version mismatch hell.

Tomas Morstein

unread,
Jul 16, 2013, 4:40:07 AM7/16/13
to chica...@googlegroups.com
Unfortunately, not yet :-(
Message has been deleted

Tomas Morstein

unread,
Sep 14, 2013, 9:26:22 AM9/14/13
to chica...@googlegroups.com
On Wednesday, September 11, 2013 4:21:01 PM UTC+2, Ilya Shuma wrote:
Is there any update on this issue?

cb seems to still ignore new views after ./init.sh reload

From what I know, there are no news on this.

Also, I think the WebController (at least in development mode) is loaded properly. Once you add a new controller, it works well -- but for some reason, it does not appear in the boss_app_info record (returned by boss_web:application_info/1) until the full restart of CB.
We've found this problem when we started to generate application menus based on the list of available controllers...

I am not sure if it does in production too, because we still have to restart entire application at least because of the view problem.

Tomas Morstein

unread,
Sep 14, 2013, 9:47:50 AM9/14/13
to chica...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages