[erlang-questions] noproc gen_server cowboy

Ahmad Baitalmal ahmad@REDACTED
Wed May 14 00:02:28 CEST 2014


Thanks Erik,

I did a bit more digging, The call for file:read_file_info in cowboy_static.erl is returning this:

{ok,{file_info,15990163246731,regular,read_write,
               {{2014,5,13},{20,51,46}},
               {{2014,5,9},{19,57,47}},
               {{2014,5,13},{19,46,18}},
               33188,1,2049,0,1704124,0,0}}

The file is only 3723 bytes. I verified this also on an erl shell. Same result. 

So it looks like something is up in kernel-3.0/file.erl when running on a mipsel chip.

Everything else is working, except for this file size issue. Oh and the body is empty. 

For now, I plan on using an onresponse hook to load up the file and fix the content-length as it goes out. :( Not ideal...

______________
Ahmad Baitalmal
CEO & Co-Founder
BitBuilder.com
650.539.9401

On May 13, 2014, at 1:13 AM, Erik Søe Sørensen <eriksoe@REDACTED> wrote:

> It's not just a reverse-endian'ed size...
> 458453399216374 = 0x'0001'A0F6'0001'A0F6 -- weird duplication...
> (0x1A0F6 = 106742 = 104.2KB, so that part fits.)
> 
> 
> 2014-05-13 1:10 GMT+02:00 Ahmad Baitalmal <ahmad@REDACTED>:
> Thanks Loïc,
> 
> It now runs and I can connect. I thought I read somewhere that relx automatically started the related apps. I guess it doesn't always.
> 
> There is something wrong still, I'm getting this error for all files in the browser.
> net::ERR_CONTENT_LENGTH_MISMATCH
> 
> I checked the headers and cowboy is reporting the header "Content-Length: 458453399216374" for a file that is only 104K.
> 
> Could this be a problem with cowboy running on a little-endian machine (mipsel)?
> 
> Thanks,
> 
> 
> On Sun, May 11, 2014 at 10:32 PM, Loïc Hoguin <essen@REDACTED> wrote:
> You didn't start the cowboy dependencies, I'm not sure how it could have worked on your Mac. Cowboy requires crypto, cowlib and ranch to be started to run. Try application:ensure_all_started(cowboy) instead and it'll do that for you.
> 
> 
> On 05/12/2014 02:20 AM, Ahmad Baitalmal wrote:
> Hi,
> Im going crazy trying to solve this.
> 
> Works on my Mac, but when I copy to a linux router (OpenWRT, R17, cowboy
> 0.9.0) it give me the error below.
> Is this a cowboy or erlang gen_server issue?
> I tried http, same result. So it's not an ssl issue. I can't tell what
> the error is...
> 
> 
> % --------------------- This is my app code that starts cowboy
> -module(onion_app).
> -behavior(application).
> -export([start/2]).
> -export([stop/0]).
> -export([stop/1]).
> -include("common.hrl").
> 
> start(_Type, _Args) ->
>    application:start(cowboy),
>    Dispatch = cowboy_router:compile([
>      {'_', [
>        {"/",       cowboy_static,   {priv_file, onion ,"index.html"}},
>        {"/[...]",  cowboy_static,   {priv_dir, onion , ""}}
>      ]}
>    ]),
>    RootDir = code:root_dir(),
>    Port = 443,
>    cowboy:start_https(my_https_listener, 10,[
>        {port, Port},
>        {certfile, RootDir ++ "/ssl/onion.crt"},
>        {keyfile, RootDir ++ "/ssl/onion.key"}
>      ],
>      [
>        {env, [{dispatch, Dispatch}]}
>      ]
>    )
>    onion_sup:start_link().
> stop(_State) ->
>    ok.
> 
> 
> % --------------------- I'm getting this error :(
> Exec: /mnt/sda1/onion/erts-6.0/bin/erlexec -boot
> /mnt/sda1/onion/releases/1/onion -env ERL_LIBS
> /mnt/sda1/onion/releases/1/lib -config
> /mnt/sda1/onion/releases/1/sys.config -args_file
> /mnt/sda1/onion/releases/1/vm.args -- console
> 
> =INFO REPORT==== 11-May-2014::03:45:55 ===
>      application: onion
>      exited: {bad_return,
>               {{onion_app,start,[normal,[]]},
>                {'EXIT',
>                 {noproc,
>                  {gen_server,call,
>                   [ranch_sup,
>                    {start_child,
>                     {{ranch_listener_sup,my_https_listener},
>                      {ranch_listener_sup,start_link,
>                       [my_https_listener,10,ranch_ssl,
>                        [{port,443},
>                         {certfile,"/mnt/sda1/onion/ssl/onion.crt"},
>                         {keyfile,"/mnt/sda1/onion/ssl/onion.key"}],
>                        cowboy_protocol,
>                        [{env,
>                          [{dispatch,
>                            [{'_',[],
>                              [{[],[],cowboy_static,
>                                {priv_file,onion,"index.html"}},
>                               {[<<"tomato">>,'...'],[],tomato,[tomato]},
>                               {['...'],
>                                [],cowboy_static,
>                                {priv_dir,onion,[]}}]}]}]}]]},
>                      permanent,5000,supervisor,
>                      [ranch_listener_sup]}},
>                    infinity]}}}}}
>      type: permanent
> Eshell V6.0  (abort with ^G)
> (onion@REDACTED)1> {"Kernel pid
> terminated",application_controller,"{application_start_failure,onion,{bad_return,{{onion_app,start,[normal,[]]},{'EXIT',{noproc,{gen_server,call,[ranch_sup,{start_child,{{ranch_listener_sup,my_https_listener},{ranch_listener_sup,start_link,[my_https_listener,10,ranch_ssl,[{port,443},{certfile,\"/mnt/sda1/onion/ssl/onion.crt\"},{keyfile,\"/mnt/sda1/onion/ssl/onion.key\"}],cowboy_protocol,[{env,[{dispatch,[{'_',[],[{[],[],cowboy_static,{priv_file,onion,\"index.html\"}},{['...'],[],cowboy_static,{priv_dir,onion,[]}}]}]}]}]]},permanent,5000,supervisor,[ranch_listener_sup]}},infinity]}}}}}}"}
> 
> 
> Thanks,
> 
> --
> Ahmad
> ___________
> 650.539.9395
> 
> Sent from my iPhon
> 
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
> 
> 
> -- 
> Loïc Hoguin
> http://ninenines.eu
> 
> 
> 
> -- 
> Ahmad
> ___________
> 650.539.9395
> 
> Sent from my iPhone
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140513/8ce45d79/attachment.htm>


More information about the erlang-questions mailing list