Issue with rebar3_auto and ranch (cowboy)

Hi there! I’m running into a problem while using the rebar3_auto plugin with a cowboy application.

Basically on the recompile ranch throws an error.

I ran into this issue a year and a half ago and hoped it would magically disappear. Alas…

Anyways, I’m hoping there is a work around because I would really love automatic recompilation while working on web apps.

3 Likes

Hi @fancycade and welcome on forum! Could you please share error what you get? Also would be great if you will show repo where you try this plugin.

2 Likes

It seems that it is coming into conflict with the already existing ranch connection. So I guess the question is how does one work around this?

Example repo: ~fancycade/mysterio - sourcehut git

Error:

=ERROR REPORT==== 20-Dec-2021::16:08:11.155350 ===
Failed to start Ranch listener mysterio_http_listener in ranch_tcp:listen([{cacerts,'...'},{key,'...'},{cert,'...'},{port,8080}]) for reason eaddrinuse (address already in use)

=SUPERVISOR REPORT==== 20-Dec-2021::16:08:11.155781 ===
    supervisor: {<0.676.0>,ranch_listener_sup}
    errorContext: start_error
    reason: {listen_error,mysterio_http_listener,eaddrinuse}
    offender: [{pid,undefined},
               {id,ranch_acceptors_sup},
               {mfargs,
                   {ranch_acceptors_sup,start_link,
                       [mysterio_http_listener,ranch_tcp]}},
               {restart_type,permanent},
               {significant,false},
               {shutdown,infinity},
               {child_type,supervisor}]

=SUPERVISOR REPORT==== 20-Dec-2021::16:08:11.156488 ===
    supervisor: {<0.676.0>,ranch_listener_sup}
    errorContext: shutdown
    reason: reached_max_restart_intensity
    offender: [{pid,{restarting,<0.678.0>}},
               {id,ranch_acceptors_sup},
               {mfargs,
                   {ranch_acceptors_sup,start_link,
                       [mysterio_http_listener,ranch_tcp]}},
               {restart_type,permanent},
               {significant,false},
               {shutdown,infinity},
               {child_type,supervisor}]
2 Likes

Here is issue. Looks like address is busy when plugin will try recompile and re run it… not sure that without code change of plugin you can fix it in your end. I suppose it make sense to create issue in plugin repo. Or you can try add logic like - if address is used, find and kill this process and then try run cowboy again.

3 Likes