I'm getting the following error when starting my app in production mode. All works fine on dev side, can migrate, compile and release without issue on the production app but when running it, it crashes on start.
I'm sure it is something very obvious I am missing. I am running Erlang 19 and Elixir 1.3.2.
17:42:52.768 [info] Application curriculum exited:
Curriculum.start(:normal, []) returned an error: shutdown: failed to
start child: Curriculum.Endpoint
** (EXIT) shutdown: failed to start child: Phoenix.Endpoint.Server
** (EXIT) an exception was raised:
** (FunctionClauseError) no function clause matching in System.get_env/1
(elixir) lib/system.ex:358: System.get_env(4000)
(phoenix) lib/phoenix/endpoint/server.ex:34: Phoenix.Endpoint.Server.to_port/1
(phoenix) lib/phoenix/endpoint/server.ex:28: Phoenix.Endpoint.Server.default/3
(phoenix) lib/phoenix/endpoint/server.ex:17: anonymous fn/5 in Phoenix.Endpoint.Server.init/1
(elixir) lib/enum.ex:1623: Enum."-reduce/3-lists^foldl/2-0-"/3
(phoenix) lib/phoenix/endpoint/server.ex:15: Phoenix.Endpoint.Server.init/1
(stdlib) supervisor.erl:294: :supervisor.init/1
(stdlib) gen_server.erl:328: :gen_server.init_it/6 {"Kernel pid
terminated",application_controller,"{application_start_failure,curriculum,{{shutdown,{failed_to_start_child,'Elixir.Curriculum.Endpoint',{shutdown,{failed_to_start_child,'Elixir.Phoenix.Endpoint.Server',{function_clause,[{'Elixir.System',get_env,[4000],[{file,\"lib/system.ex\"},{line,358}]},{'Elixir.Phoenix.Endpoint.Server',to_port,1,[{file,\"lib/phoenix/endpoint/server.ex\"},{line,34}]},{'Elixir.Phoenix.Endpoint.Server',default,3,[{file,\"lib/phoenix/endpoint/server.ex\"},{line,28}]},{'Elixir.Phoenix.Endpoint.Server','-init/1-fun-0-',5,[{file,\"lib/phoenix/endpoint/server.ex\"},{line,17}]},{'Elixir.Enum','-reduce/3-lists^foldl/2-0-',3,[{file,\"lib/enum.ex\"},{line,1623}]},{'Elixir.Phoenix.Endpoint.Server',init,1,[{file,\"lib/phoenix/endpoint/server.ex\"},{line,15}]},{supervisor,init,1,[{file,\"supervisor.erl\"},{line,294}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,328}]}]}}}}},{'Elixir.Curriculum',start,[normal,[]]}}}"}
Prod.exs file contents
http: [port: {:system, 4000}],url: [host: "example.com"],cache_static_manifest: "priv/static/manifest.json",server: true
config :phoenix, :serve_endpoints, true
import_config "prod.secret.exs"
Your value for port in config/prod.exs is wrong. It should either be:
port: 4000
to always run on port 4000, or:
port: {:system, "PORT"}
to read the port from the environment variable PORT (you can change the name to any other string).
Related
When running an EUnit test that tests an application or starts and stops (or tests killing of) gen_server or supervisor processs, error logger outputs crash reports and other messages by default:
$ rebar3 eunit 1s
===> Verifying dependencies...
===> Compiling my_app
===> Performing EUnit tests...
...........=INFO REPORT==== 5-Sep-2019::16:32:18.760457 ===
application: ranch
exited: stopped
type: temporary
=INFO REPORT==== 5-Sep-2019::16:32:18.760545 ===
application: xmerl
exited: stopped
type: temporary
=INFO REPORT==== 5-Sep-2019::16:32:18.763882 ===
application: my_app
exited: stopped
type: temporary
......=ERROR REPORT==== 5-Sep-2019::16:32:18.814431 ===
** Generic server my_app_sup terminating
** Last message in was {'EXIT',<0.279.0>,test_kill}
** When Server state == {state,
{local,my_app_sup},
simple_one_for_one,
{[undefined],
#{undefined =>
{child,undefined,undefined,
{my_app_server,start_link,[]},
transient,5000,worker,
[my_app_server]}}},
{maps,#{<0.355.0> => [my_app_test]}},
1,5,[],0,my_app_sup,[]}
** Reason for termination ==
** test_kill
=CRASH REPORT==== 5-Sep-2019::16:32:18.814598 ===
crasher:
initial call: supervisor:my_app_sup/1
pid: <0.354.0>
registered_name: my_app_sup
exception exit: test_kill
in function gen_server:decode_msg/9 (gen_server.erl, line 432)
ancestors: [<0.279.0>]
message_queue_len: 0
messages: []
links: []
dictionary: []
trap_exit: true
status: running
heap_size: 1598
stack_size: 27
reductions: 6463
neighbours:
...........
Finished in 0.457 seconds
28 tests, 0 failures
How can I avoid these expected messages during testing?
These can be avoided by temporarily disabling TTY reports in the error logger. Surround the code which produces the reports with this:
my_test() ->
error_logger:tty(false),
try
% code that produces error logger reports
after
error_logger:tty(true)
end.
If you use this many times in the tests, this wrapper can be useful:
without_error_logger(Fun) ->
error_logger:tty(false),
try
Fun()
after
error_logger:tty(true)
end.
Which is used like so:
without_error_logger(fun() ->
% code that produces error logger reports
end)
Can anyone please help to understand these crash logs?
RabbitMQ 3.6.6, Erlang 19.1
RabbitMQ is running on Microsoft Windows Web Server 2008 R2 6.1.7601 Service Pack 1 Build 7601 64bit.
RabbitMQ started to crash yesterday after running OK about one year. Now I have upgraded Erlang and RabbitMQ Server to the versions mentioned above but this did not change anything - still crashing
frequently.
.log:
=ERROR REPORT==== 13-Dec-2016::22:13:55 ===
** Generic server rabbit_disk_monitor terminating
** Last message in was update
** When Server state == {state,"d:/ETOIMI~1/RabbitMQ/RABBIT~1",50000000,
14439952384,100,10000,#Ref<0.0.1.27257>,false,
true}
** Reason for termination ==
** {eacces,[{erlang,open_port,
[{spawn,"C:\\Windows\\system32\\cmd.exe /c dir /-C /W \"d:/ETOIMI~1/RabbitMQ/RABBIT~1\""},
[binary,stderr_to_stdout,stream,in,hide]],
[{file,"erlang.erl"},{line,2080}]},
{os,cmd,1,[{file,"os.erl"},{line,230}]},
{rabbit_disk_monitor,get_disk_free,2,
[{file,"src/rabbit_disk_monitor.erl"},
{line,218}]},
{rabbit_disk_monitor,internal_update,1,
[{file,"src/rabbit_disk_monitor.erl"},
{line,193}]},
{rabbit_disk_monitor,handle_info,2,
[{file,"src/rabbit_disk_monitor.erl"},
{line,165}]},
{gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,601}]},
{gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,667}]},
{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}
-sasl.log:
=CRASH REPORT==== 13-Dec-2016::22:13:55 ===
crasher:
initial call: rabbit_disk_monitor:init/1
pid: <0.211.0>
registered_name: rabbit_disk_monitor
exception exit: {eacces,
[{erlang,open_port,
[{spawn,
"C:\\Windows\\system32\\cmd.exe /c dir /-C /W \"d:/ETOIMI~1/RabbitMQ/RABBIT~1\""},
[binary,stderr_to_stdout,stream,in,hide]],
[{file,"erlang.erl"},{line,2080}]},
{os,cmd,1,[{file,"os.erl"},{line,230}]},
{rabbit_disk_monitor,get_disk_free,2,
[{file,"src/rabbit_disk_monitor.erl"},
{line,218}]},
{rabbit_disk_monitor,internal_update,1,
[{file,"src/rabbit_disk_monitor.erl"},
{line,193}]},
{rabbit_disk_monitor,handle_info,2,
[{file,"src/rabbit_disk_monitor.erl"},
{line,165}]},
{gen_server,try_dispatch,4,
[{file,"gen_server.erl"},{line,601}]},
{gen_server,handle_msg,5,
[{file,"gen_server.erl"},{line,667}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,247}]}]}
in function gen_server:terminate/7 (gen_server.erl, line 812)
ancestors: [rabbit_disk_monitor_sup,rabbit_sup,<0.164.0>]
messages: []
links: [<0.210.0>]
dictionary: []
trap_exit: false
status: running
heap_size: 6772
stack_size: 27
reductions: 381464
neighbours:
=SUPERVISOR REPORT==== 13-Dec-2016::22:13:55 ===
Supervisor: {local,rabbit_disk_monitor_sup}
Context: child_terminated
Reason: {eacces,
[{erlang,open_port,
[{spawn,
"C:\\Windows\\system32\\cmd.exe /c dir /-C /W \"d:/ETOIMI~1/RabbitMQ/RABBIT~1\""},
[binary,stderr_to_stdout,stream,in,hide]],
[{file,"erlang.erl"},{line,2080}]},
{os,cmd,1,[{file,"os.erl"},{line,230}]},
{rabbit_disk_monitor,get_disk_free,2,
[{file,"src/rabbit_disk_monitor.erl"},{line,218}]},
{rabbit_disk_monitor,internal_update,1,
[{file,"src/rabbit_disk_monitor.erl"},{line,193}]},
{rabbit_disk_monitor,handle_info,2,
[{file,"src/rabbit_disk_monitor.erl"},{line,165}]},
{gen_server,try_dispatch,4,
[{file,"gen_server.erl"},{line,601}]},
{gen_server,handle_msg,5,
[{file,"gen_server.erl"},{line,667}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,247}]}]}
Offender: [{pid,<0.211.0>},
{name,rabbit_disk_monitor},
{mfargs,{rabbit_disk_monitor,start_link,[50000000]}},
{restart_type,{transient,1}},
{shutdown,30000},
{child_type,worker}]
Also I have found Erlang crash dump, please see
HERE
If there is more information that should be provided by me please let me know.
Thank you!
** {eacces,[{erlang,open_port,
[{spawn,"C:\\Windows\\system32\\cmd.exe /c dir /-C /W \"d:/ETOIMI~1/RabbitMQ/RABBIT~1\""},
eacces is an Erlang error:
eacces Missing search or write permissions for the parent directories
of Dir.
most likely the service has problems to access here: d:/ETOIMI~1/RabbitMQ/RABBIT~1\
I am trying to communicate with a rabbitmq server from my mongooseim server. For that first I copied rabbitmq-client library (for erlang) to my apps directory, updated my makefile and then recompiled mongooseim code. (as per the instruction from here). This way I can compile the code with no error and can see amqp_client has been started from mongooseim console. Now when I try to run amqp_connection:start() from the console I get the below error. How to fix this?
(mongooseim#localhost)8> {ok, Connection} = amqp_connection:start(#amqp_params_network{}).
2015-04-23 15:07:27.320 [debug] <0.790.0> Supervisor {<0.790.0>,amqp_connection_sup} started amqp_connection_type_sup:start_link() at pid <0.791.0>
2015-04-23 15:07:27.324 [debug] <0.790.0> Supervisor {<0.790.0>,amqp_connection_sup} started amqp_gen_connection:start_link(<0.791.0>, {amqp_params_network,<<"guest">>,<<"guest">>,<<"/">>,"localhost",5672,0,0,0,infinity,none,[#Fun<amq..>,...],...}) at pid <0.792.0>
** exception exit: {{function_clause,[{amqp_gen_connection,terminate,
[{undef,[{rabbit_net,connection_string,
[#Port<0.6063>,outbound],
[]},
{amqp_network_connection,try_handshake,3,[]},
{amqp_gen_connection,handle_call,3,[]},
{gen_server,try_handle_call,4,
[{file,"gen_server.erl"},{line,607}]},
{gen_server,handle_msg,5,
[{file,"gen_server.erl"},{line,639}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,237}]}]},
{<0.791.0>,
#amqp_params_network{username = <<"guest">>,
password = <<"guest">>,virtual_host = <<"/">>,
host = "localhost",port = 5672,channel_max = 0,
frame_max = 0,heartbeat = 0,connection_timeout = infinity,
ssl_options = none,
auth_mechanisms = [#Fun<amqp_auth_mechanisms.plain.3>,
#Fun<amqp_auth_mechanisms.amqplain.3>],
client_properties = [],socket_options = []}}],
[]},
{gen_server,try_terminate,3,
[{file,"gen_server.erl"},{line,621}]},
{gen_server,terminate,7,
[{file,"gen_server.erl"},{line,787}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,237}]}]},
{gen_server,call,[<0.792.0>,connect,infinity]}}
in function gen_server:call/3 (gen_server.erl, line 190)
(mongooseim#localhost)9> 2015-04-23 15:07:27.411 [error] <0.792.0> gen_server <0.792.0> terminated with reason: no function clause matching amqp_gen_connection:terminate({undef,[{rabbit_net,connection_string,[#Port<0.6063>,outbound],[]},{amqp_network_connection,try_handshake,...},...]}, {<0.791.0>,{amqp_params_network,<<"guest">>,<<"guest">>,<<"/">>,"localhost",5672,0,0,0,infinity,...}})
2015-04-23 15:07:27.412 [error] <0.792.0> CRASH REPORT Process <0.792.0> with 0 neighbours exited with reason: no function clause matching amqp_gen_connection:terminate({undef,[{rabbit_net,connection_string,[#Port<0.6063>,outbound],[]},{amqp_network_connection,try_handshake,...},...]}, {<0.791.0>,{amqp_params_network,<<"guest">>,<<"guest">>,<<"/">>,"localhost",5672,0,0,0,infinity,...}}) in gen_server:terminate/7 line 792
2015-04-23 15:07:27.414 [error] <0.790.0> Supervisor {<0.790.0>,amqp_connection_sup} had child connection started with amqp_gen_connection:start_link(<0.791.0>, {amqp_params_network,<<"guest">>,<<"guest">>,<<"/">>,"localhost",5672,0,0,0,infinity,none,[#Fun<amq..>,...],...}) at <0.792.0> exit with reason no function clause matching amqp_gen_connection:terminate({undef,[{rabbit_net,connection_string,[#Port<0.6063>,outbound],[]},{amqp_network_connection,try_handshake,...},...]}, {<0.791.0>,{amqp_params_network,<<"guest">>,<<"guest">>,<<"/">>,"localhost",5672,0,0,0,infinity,...}}) in context child_terminated
2015-04-23 15:07:27.416 [error] <0.790.0> Supervisor {<0.790.0>,amqp_connection_sup} had child connection started with amqp_gen_connection:start_link(<0.791.0>, {amqp_params_network,<<"guest">>,<<"guest">>,<<"/">>,"localhost",5672,0,0,0,infinity,none,[#Fun<amq..>,...],...}) at <0.792.0> exit with reason reached_max_restart_intensity in context shutdown
The undef error message tells us that the rabbit_net module or the connection_string function is missing and rabbit_net is a part of rabbit_common package. I guess you didn't add rabbit_common. You can find the package on the website you pasted in the previous question - here. Repeat the steps with rabbit_common.ez and it should work.
My riak node is not responding to ping yet everything seems ok
(myclient#127.0.0.1)2> {ok, Pid} = riakc_pb_socket:start_link("127.0.0.1", 10018).
{ok,<0.217.0>}
(myclient#127.0.0.1)3> riakc_pb_socket:ping(Pid).
** exception exit: disconnected
(myclient#127.0.0.1)4>
=ERROR REPORT==== 21-Dec-2014::04:41:22 ===
** Generic server <0.217.0> terminating
** Last message in was {req_timeout,#Ref<0.0.0.306>}
** When Server state == {state,"127.0.0.1",10018,false,false,undefined,
undefined,
{[],[]},
1,[],infinity,100}
** Reason for termination ==
** disconnected
What is that i am not doing right??
Thanks in advance.
Port 10018 is the HTTP listening port for a Riak cluster set up in development mode, but you're using the protocol buffers client. Try port 10017 instead.
I've just installed passenger + nginx on a brand new Ubuntu 13.04 box, and trying to run an app that runs great on several other servers.
Every time I try to run the app in production, I get:
An error occurred while starting up the preloader: it did not write a startup response in time.
Application root
/home/avishai/apps/XXX/current
Environment (value of RAILS_ENV, RACK_ENV, WSGI_ENV and PASSENGER_ENV)
production
Ruby interpreter command
/home/avishai/.rvm/wrappers/ruby-1.9.3-p448/ruby
User and groups
Unknown
Environment variables
Unknown
Ulimits
Unknown
Passenger is able to load the app in development mode, but not production. The nginx error log shows the following:
[ 2013-08-14 17:09:14.8321 17810/7f99daebd700 Pool2/Spawner.h:738 ]: [App 17843 stdout]
[ 2013-08-14 17:10:44.8406 17810/7f99daebd700 Pool2/Implementation.cpp:774 ]: Could not spawn process for group /home/avishai/apps/XXX/current#default: An error occurred while starting up the preloader: it did not write a startup response in time.
in 'void Passenger::ApplicationPool2::SmartSpawner::throwPreloaderSpawnException(const string&, Passenger::SpawnException::ErrorKind, Passenger::ApplicationPool2::Spawner::BackgroundIOCapturerPtr&, const DebugDirPtr&)' (SmartSpawner.h:150)
in 'std::string Passenger::ApplicationPool2::SmartSpawner::negotiatePreloaderStartup(Passenger::ApplicationPool2::SmartSpawner::StartupDetails&)' (SmartSpawner.h:558)
in 'void Passenger::ApplicationPool2::SmartSpawner::startPreloader()' (SmartSpawner.h:206)
in 'virtual Passenger::ApplicationPool2::ProcessPtr Passenger::ApplicationPool2::SmartSpawner::spawn(const Passenger::ApplicationPool2::Options&)' (SmartSpawner.h:744)
in 'void Passenger::ApplicationPool2::Group::spawnThreadRealMain(const SpawnerPtr&, const Passenger::ApplicationPool2::Options&, unsigned int)' (Implementation.cpp:707)
[ 2013-08-14 17:10:44.8409 17810/7f99d8f9e700 agents/HelperAgent/RequestHandler.h:1888 ]: [Client 20] Cannot checkout session. An error occurred while starting up the preloader: it did not write a startup response in time.
[ 2013-08-14 17:10:44.8412 17810/7f99d8f9e700 agents/HelperAgent/RequestHandler.h:1888 ]: [Client 21] Cannot checkout session. An error occurred while starting up the preloader: it did not write a startup response in time.
I'm at a dead-end. How can I get the app to load?