erlyaws / yaws

Yaws webserver
https://erlyaws.github.io
BSD 3-Clause "New" or "Revised" License
1.28k stars 267 forks source link

Can't listen to socket: {error,eaddrinuse} #342

Closed sachithmuhandiram closed 6 years ago

sachithmuhandiram commented 6 years ago

When I try to run yaws in my Ubuntu, I get following Error.

`Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:10] [kernel-poll:true]

Eshell V9.2 (abort with ^G) 1> =INFO REPORT==== 4-Jul-2018::07:00:08 === Yaws: Using config file /etc/yaws/yaws.conf

=ERROR REPORT==== 4-Jul-2018::07:00:08 === use_old_ssl in yaws.conf is no longer supported - ignoring

=INFO REPORT==== 4-Jul-2018::07:00:08 === Yaws: Using global subconfig file /etc/yaws/conf.d/localhost-ssl.conf

=INFO REPORT==== 4-Jul-2018::07:00:08 === Yaws: Using global subconfig file /etc/yaws/conf.d/localhost.conf

=INFO REPORT==== 4-Jul-2018::07:00:08 === yaws debug:Add path "/usr/local/lib/yaws-appmods/ebin"

=INFO REPORT==== 4-Jul-2018::07:00:08 === yaws debug:Add path "/usr/local/lib/yaws/examples/ebin"

=INFO REPORT==== 4-Jul-2018::07:00:08 === yaws debug:Running with id="default" Running with debug checks turned on (slower server) Logging to directory "/var/log/yaws"

=INFO REPORT==== 4-Jul-2018::07:00:08 === Ctlfile : /home/sachith/.yaws/yaws/default/CTL

=ERROR REPORT==== 4-Jul-2018::07:00:08 === Yaws: Failed to listen 0.0.0.0:8443 : {error,eaddrinuse}

=ERROR REPORT==== 4-Jul-2018::07:00:08 === Can't listen to socket: {error,eaddrinuse} =INFO REPORT==== 4-Jul-2018::07:00:08 === application: yaws exited: {{shutdown, {failed_to_start_child,yaws_server, {badbind, [{yaws_server,start_group,2, [{file,"yaws_server.erl"},{line,261}]}, {lists,filtermap,2,[{file,"lists.erl"},{line,1317}]}, {yaws_server,init2,5, [{file,"yaws_server.erl"},{line,245}]}, {gen_server,init_it,2, [{file,"gen_server.erl"},{line,365}]}, {gen_server,init_it,6, [{file,"gen_server.erl"},{line,333}]}, {proc_lib,init_p_do_apply,3, [{file,"proc_lib.erl"},{line,247}]}]}}}, {yaws_app,start,[normal,[]]}} type: permanent {"Kernel pid terminated",application_controller,"{application_start_failure,yaws,{{shutdown,{failed_to_start_child,yaws_server,{badbind,[{yaws_server,start_group,2,[{file,\"yaws_server.erl\"},{line,261}]},{lists,filtermap,2,[{file,\"lists.erl\"},{line,1317}]},{yaws_server,init2,5,[{file,\"yaws_server.erl\"},{line,245}]},{gen_server,init_it,2,[{file,\"gen_server.erl\"},{line,365}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,333}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,247}]}]}}},{yaws_app,start,[normal,[]]}}}"} Kernel pid terminated (application_controller) ({application_start_failure,yaws,{{shutdown,{failed_to_start_child,yaws_server,{badbind,[{yaws_server,start_group,2,[{file,"yaws_server.erl"},{line,261}]

Crash dump is being written to: erl_crash.dump...done`

This is my first time with yaws.

vinoski commented 6 years ago

{error,eaddrinuse} is Erlang-speak for the EADDRINUSE error number in C:

#define EADDRINUSE  48      /* Address already in use */

As its name implies, it says that the network address you're trying to use is already in use by another application. The error from Yaws explains the issue:

=ERROR REPORT==== 4-Jul-2018::07:00:08 ===
Yaws: Failed to listen 0.0.0.0:8443 : {error,eaddrinuse}

Something else is already using port 8443, so it's unavailable for Yaws to use. You should either figure out what's on that port so you can stop it, which you can do by running lsof in bash or another command shell and grepping the output for that port number, or you should change your Yaws configuration to use a different port.

sachithmuhandiram commented 6 years ago

Thanks, lsof solved the problem.