Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accessing a previously running site crashes dispatcher #714

Closed
kaos opened this issue Feb 13, 2014 · 14 comments
Closed

accessing a previously running site crashes dispatcher #714

kaos opened this issue Feb 13, 2014 · 14 comments

Comments

@kaos
Copy link
Member

kaos commented Feb 13, 2014

It doesn't matter if the site config says enabled true or false, only requirement is that the site was running, and then later was stopped.

Expected a 404, as it gives for a site that is disabled, and was never started.

12:42:27.204 [error] gen_server z_sites_dispatcher terminated with reason: no such process or port in call to gen_server:call('z_trans_server$zhost', table)
12:42:27.207 [error] CRASH REPORT Process z_sites_dispatcher with 0 neighbours exited with reason: no such process or port in call to gen_server:call('z_trans_server$zhost', table) in gen_server:terminate/6 line 744
12:42:27.208 [error] Supervisor z_sites_sup had child z_sites_dispatcher started with z_sites_dispatcher:start_link() at <0.749.0> exit with reason no such process or port in call to gen_server:call('z_trans_server$zhost', table) in context child_terminated
12:42:27.208 [error] CRASH REPORT Process <0.775.0> with 0 neighbours exited with reason: {{noproc,{gen_server,call,['z_trans_server$zhost',table]}},{gen_server,call,[z_sites_dispatcher,{dispatch,"zhost.local:8040","/en/admin/logon",'GET',http}]}} in gen_server:call/2 line 180
12:42:27.209 [error] CRASH REPORT Process <0.2154.0> with 0 neighbours exited with reason: no such process or port in call to gen_server:call(z_sites_dispatcher, {dispatch,"zhost.local:8040","/en/admin/logon",'GET',http}) in gen_server:call/2 line 180
12:42:27.212 [error] CRASH REPORT Process <0.768.0> with 0 neighbours exited with reason: no such process or port in call to gen_server:call(z_sites_dispatcher, {dispatch,"zhost.local:8040","/en/admin/logon",'GET',http}) in gen_server:call/2 line 180
12:42:27.214 [error] CRASH REPORT Process <0.1698.0> with 0 neighbours exited with reason: no such process or port in call to gen_server:call(z_sites_dispatcher, {dispatch,"zhost.local:8040","/en/admin/logon",'GET',http}) in gen_server:call/2 line 180
12:42:27.223 [error] CRASH REPORT Process <0.767.0> with 0 neighbours exited with reason: no such process or port in call to gen_server:call(z_sites_dispatcher, {dispatch,"zhost.local:8040","/en/admin/logon",'GET',http}) in gen_server:call/2 line 180
12:42:27.225 [error] CRASH REPORT Process <0.1462.0> with 0 neighbours exited with reason: no such process or port in call to gen_server:call(z_sites_dispatcher, {dispatch,"zhost.local:8040","/en/admin/logon",'GET',http}) in gen_server:call/2 line 180
12:42:27.228 [error] CRASH REPORT Process <0.2349.0> with 0 neighbours exited with reason: no such process or port in call to gen_server:call(z_sites_dispatcher, {dispatch,"zhost.local:8040","/en/admin/logon",'GET',http}) in gen_server:call/2 line 180
@arjan
Copy link
Member

arjan commented Feb 13, 2014

I've seen this crash before. So you're saying it's easily reproducible?

@mworrell
Copy link
Member

Is that after the site was restarted? Otherwise I fail to see how the dispatcher would be able to dispatch to that particular host.

@kaos
Copy link
Member Author

kaos commented Feb 13, 2014

I got a report for it, and reproduced it easily on my machine. The site was in state "stopped". Try it :p

@arjan
Copy link
Member

arjan commented Feb 13, 2014

You are right. Just do

z_sites_manager:stop(sitename).

and then try reload the site; it will crash.

On 13-02-14 13:29, Andreas Stenius wrote:

I got a report for it, and reproduced it easily on my machine. The site
was in state "stopped". Try it :p


Reply to this email directly or view it on GitHub
#714 (comment).

@arjan
Copy link
Member

arjan commented Feb 13, 2014

Finally managed to produce the stack trace:

(zotonic001@x1)27> [{gen_server,call,2,[{file,"gen_server.erl"},{line,180}]},
 {z_trans_server,table,1,
                 [{file,"/home/arjan/devel/zotonic/src/i18n/z_trans_server.erl"},
                  {line,71}]},
 {z_context,set_server_names,1,
            [{file,"/home/arjan/devel/zotonic/src/support/z_context.erl"},
             {line,201}]},
 {z_context,new,1,
            [{file,"/home/arjan/devel/zotonic/src/support/z_context.erl"},
             {line,156}]},
 {z_sites_dispatcher,wm_dispatch,5,
                     [{file,"/home/arjan/devel/zotonic/src/support/z_sites_dispatcher.erl"},
                      {line,569}]},
 {z_sites_dispatcher,handle_host_dispatch,3,
                     [{file,"/home/arjan/devel/zotonic/src/support/z_sites_dispatcher.erl"},
                      {line,189}]},
 {z_sites_dispatcher,handle_call,3,
                     [{file,"/home/arjan/devel/zotonic/src/support/z_sites_dispatcher.erl"},
                      {line,128}]},
 {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,588}]}]14:48:10.016 [error] gen_server z_sites_dispatcher terminated with reason: no such process or port in call to gen_server:call('z_trans_server$nmmweb', table)
14:48:10.017 [error] CRASH REPORT Process z_sites_dispatcher with 0 neighbours exited with reason: no such process or port in call to gen_server:call('z_trans_server$nmmweb', table) in gen_server:terminate/6 line 747

@arjan
Copy link
Member

arjan commented Feb 13, 2014

Will look into it later, no time now

@mworrell
Copy link
Member

Apparently the stopped site is still known to the dispatcher.

@arjan
Copy link
Member

arjan commented Feb 13, 2014

Yes, so what's the best solution to fix this?

@mworrell
Copy link
Member

Need to check - I think the dispatcher shouldn't "know" about any stopped site.

@arjan
Copy link
Member

arjan commented Feb 13, 2014

indeed so we need to reload the dispatch info when a site starts and/or stops? or is that done already?

@mworrell
Copy link
Member

I am not sure now, will have a look at it later.

@arjan
Copy link
Member

arjan commented Feb 13, 2014

BTW, it crashes because z_context:new() is called on a site that is not running. That is not such bad behaviour only the crash message could be better.

@arjan arjan closed this as completed in e8ef40a Feb 13, 2014
arjan pushed a commit that referenced this issue Feb 13, 2014
Fixes #714

This seems to be the most simple solution. Downside is that on Zotonic
startup the dispatch rules are reloaded several times (for each starting
site).

(cherry picked from commit e8ef40a)
@mworrell
Copy link
Member

Solution is good - efficiency of the dispatcher is something I want to tackle later anyway. (See also the GSoC 2014 list)

@kaos
Copy link
Member Author

kaos commented Feb 13, 2014

👍

@kaos kaos added this to the Release 0.10 milestone Feb 13, 2014
ddeboer pushed a commit to ddeboer/zotonic that referenced this issue May 16, 2017
Fixes zotonic#714

This seems to be the most simple solution. Downside is that on Zotonic
startup the dispatch rules are reloaded several times (for each starting
site).

(cherry picked from commit 6548399)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants