Skip to content

simple_bridge broken for cowboy 1.0.1 #66

@fbrau

Description

@fbrau

On an almost vanilla nitrogen setup with Otp21, cowboy 1.0.1 the code compiles fine,
but it fails when loading the runtime.

On the same topic. For me this is the last sane comit (for cowboy 1.0.1):
e209ea9
"Initial fixes to work with Erlang 21"

After this comit I get this error. (TRACE #1... there is another trace below this one)

Erlang/OTP 21 [erts-10.0] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:5] [hipe]

Eshell V10.0 (abort with ^G)
(myapp@127.0.0.1)1> Starting Cowboy Server on {0,0,0,0}:8000
Static Paths: ["js/","css/","images/","nitrogen/","favicon.ico"]
Document Root for Static: ./site/static
Using Cowboy Dispatch Table:
[{'',[],
[{[<<"js">>,'...'],
[],cowboy_static,
{dir,"./site/static/js/",[{mimetypes,cow_mimetypes,all}]}},
{[<<"css">>,'...'],
[],cowboy_static,
{dir,"./site/static/css/",[{mimetypes,cow_mimetypes,all}]}},
{[<<"images">>,'...'],
[],cowboy_static,
{dir,"./site/static/images/",[{mimetypes,cow_mimetypes,all}]}},
{[<<"nitrogen">>,'...'],
[],cowboy_static,
{dir,"./site/static/nitrogen/",[{mimetypes,cow_mimetypes,all}]}},
{[<<"favicon.ico">>],
[],cowboy_static,
{file,"./site/static/favicon.ico",[{mimetypes,cow_mimetypes,all}]}},
{'
',[],cowboy_simple_bridge_anchor,[]}]}]
=INFO REPORT==== 26-Dec-2018::16:17:02.459464 ===
application: simple_bridge
exited: {{undef,
[{cowboy,start_clear,
[http,
[{ip,{0,0,0,0}},{port,8000}],
#{env =>
#{dispatch =>
[{'',[],
[{[<<"js">>,'...'],
[],cowboy_static,
{dir,"./site/static/js/",
[{mimetypes,cow_mimetypes,all}]}},
{[<<"css">>,'...'],
[],cowboy_static,
{dir,"./site/static/css/",
[{mimetypes,cow_mimetypes,all}]}},
{[<<"images">>,'...'],
[],cowboy_static,
{dir,"./site/static/images/",
[{mimetypes,cow_mimetypes,all}]}},
{[<<"nitrogen">>,'...'],
[],cowboy_static,
{dir,"./site/static/nitrogen/",
[{mimetypes,cow_mimetypes,all}]}},
{[<<"favicon.ico">>],
[],cowboy_static,
{file,"./site/static/favicon.ico",
[{mimetypes,cow_mimetypes,all}]}},
{'
',[],cowboy_simple_bridge_anchor,[]}]}]},
max_keepalive => 100}],
[]},
{cowboy_simple_bridge_sup,init,1,
[{file,
"/home/fran/deploy_uber/web/lib/simple_bridge/src/cowboy_bridge_modules/cowboy_simple_bridge_sup.erl"},
{line,36}]},
{supervisor,init,1,[{file,"supervisor.erl"},{line,295}]},
{gen_server,init_it,2,[{file,"gen_server.erl"},{line,374}]},
{gen_server,init_it,6,[{file,"gen_server.erl"},{line,342}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,249}]}]},
{simple_bridge_app,start,[normal,[]]}}
type: temporary
pusher starting with proxy fun serviceworker:pusher_proxy/5
ephemeral starting...
Starting Sync (Automatic Code Compiler / Reloader)
Scanning source files...

BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
(v)ersion (k)ill (D)b-tables (d)istribution


On even more recent commits, the last 5 or so, I get this error (TRACE #2.. this is long)

Erlang/OTP 21 [erts-10.0] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:5] [hipe]

Eshell V10.0 (abort with ^G)
(myapp@127.0.0.1)1> Starting Cowboy Server on {0,0,0,0}:8000
Static Paths: ["js/","css/","images/","nitrogen/","favicon.ico"]
Document Root for Static: ./site/static
Using Cowboy Dispatch Table:
[{'',[],
[{[<<"js">>,'...'],
[],cowboy_static,
{dir,"./site/static/js/",[{mimetypes,cow_mimetypes,all}]}},
{[<<"css">>,'...'],
[],cowboy_static,
{dir,"./site/static/css/",[{mimetypes,cow_mimetypes,all}]}},
{[<<"images">>,'...'],
[],cowboy_static,
{dir,"./site/static/images/",[{mimetypes,cow_mimetypes,all}]}},
{[<<"nitrogen">>,'...'],
[],cowboy_static,
{dir,"./site/static/nitrogen/",[{mimetypes,cow_mimetypes,all}]}},
{[<<"favicon.ico">>],
[],cowboy_static,
{file,"./site/static/favicon.ico",[{mimetypes,cow_mimetypes,all}]}},
{'
',[],cowboy_simple_bridge_anchor,[]}]}]
pusher starting with proxy fun serviceworker:pusher_proxy/5
ephemeral starting...
Starting Sync (Automatic Code Compiler / Reloader)
Scanning source files...
=ERROR REPORT==== 26-Dec-2018::16:12:20.306005 ===
Error in simple_bridge:make/2 - error - function_clause
[{sbw,'-cache_headers/1-lc$^0/1-0-',
[{[{<<"host">>,<<"localhost:8000">>},
{<<"connection">>,<<"Upgrade">>},
{<<"pragma">>,<<"no-cache">>},
{<<"cache-control">>,<<"no-cache">>},
{<<"user-agent">>,
<<"Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1">>},
{<<"upgrade">>,<<"websocket">>},
{<<"origin">>,<<"http://localhost:8000">>},
{<<"sec-websocket-version">>,<<"13">>},
{<<"accept-encoding">>,<<"gzip, deflate, br">>},
{<<"accept-language">>,<<"en-US,en;q=0.9">>},
{<<"cookie">>,
<<"fossil_display_settings=n%3D50%2Css%3Dx%2Cadvm%3D0%2Cy%3Dci">>},
{<<"sec-websocket-key">>,<<"Sasj5q6ZCDzuG3IYu0qONg==">>},
{<<"sec-websocket-extensions">>,
<<"permessage-deflate; client_max_window_bits">>}],
{http_req,#Port<0.16>,ranch_tcp,keepalive,<0.1501.0>,<<"GET">>,
'HTTP/1.1',
{{127,0,0,1},44600},
<<"localhost">>,undefined,8000,<<"/login">>,undefined,<<>>,
undefined,[],
[{<<"host">>,<<"localhost:8000">>},
{<<"connection">>,<<"Upgrade">>},
{<<"pragma">>,<<"no-cache">>},
{<<"cache-control">>,<<"no-cache">>},
{<<"user-agent">>,
<<"Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1">>},
{<<"upgrade">>,<<"websocket">>},
{<<"origin">>,<<"http://localhost:8000">>},
{<<"sec-websocket-version">>,<<"13">>},
{<<"accept-encoding">>,<<"gzip, deflate, br">>},
{<<"accept-language">>,<<"en-US,en;q=0.9">>},
{<<"cookie">>,
<<"fossil_display_settings=n%3D50%2Css%3Dx%2Cadvm%3D0%2Cy%3Dci">>},
{<<"sec-websocket-key">>,<<"Sasj5q6ZCDzuG3IYu0qONg==">>},
{<<"sec-websocket-extensions">>,
<<"permessage-deflate; client_max_window_bits">>}],
[{<<"sec-websocket-extensions">>,
[{<<"permessage-deflate">>,
[<<"client_max_window_bits">>]}]},
{<<"upgrade">>,[<<"websocket">>]},
{<<"connection">>,[<<"upgrade">>]}],
undefined,
[{websocket_version,13},{websocket_compress,false}],
waiting,<<>>,undefined,false,waiting,[],<<>>,undefined}}],
[{file,"/home/fran/deploy_uber/web/lib/simple_bridge/src/sbw.erl"},
{line,121}]},
{sbw,cache_headers,1,
[{file,"/home/fran/deploy_uber/web/lib/simple_bridge/src/sbw.erl"},
{line,121}]},
{sbw,new,2,
[{file,"/home/fran/deploy_uber/web/lib/simple_bridge/src/sbw.erl"},
{line,102}]},
{simple_bridge,make_nocatch,2,
[{file,"/home/fran/deploy_uber/web/lib/simple_bridge/src/simple_bridge.erl"},
{line,94}]},
{simple_bridge,inner_make,2,
[{file,"/home/fran/deploy_uber/web/lib/simple_bridge/src/simple_bridge.erl"},
{line,86}]},
{cowboy_simple_bridge_anchor,websocket_init,3,
[{file,"/home/fran/deploy_uber/web/lib/simple_bridge/src/cowboy_bridge_modules/cowboy_simple_bridge_anchor.erl"},
{line,43}]},
{cowboy_websocket,handler_init,3,
[{file,"src/cowboy_websocket.erl"},{line,131}]},
{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,442}]}]
=ERROR REPORT==== 26-Dec-2018::16:12:20.309883 ===
Ranch listener http had connection process started with cowboy_protocol:start_link/4 at <0.1501.0> exit with reason: {[{reason,function_clause},{mfa,{cowboy_simple_bridge_anchor,websocket_init,3}},{stacktrace,[{simple_bridge,inner_make,2,[{file,"/home/fran/deploy_uber/web/lib/simple_bridge/src/simple_bridge.erl"},{line,89}]},{cowboy_simple_bridge_anchor,websocket_init,3,[{file,"/home/fran/deploy_uber/web/lib/simple_bridge/src/cowboy_bridge_modules/cowboy_simple_bridge_anchor.erl"},{line,43}]},{cowboy_websocket,handler_init,3,[{file,"src/cowboy_websocket.erl"},{line,131}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,442}]}]},{req,[{socket,#Port<0.16>},{transport,ranch_tcp},{connection,keepalive},{pid,<0.1501.0>},{method,<<"GET">>},{version,'HTTP/1.1'},{peer,{{127,0,0,1},44600}},{host,<<"localhost">>},{host_info,undefined},{port,8000},{path,<<"/login">>},{path_info,undefined},{qs,<<>>},{qs_vals,undefined},{bindings,[]},{headers,[{<<"host">>,<<"localhost:8000">>},{<<"connection">>,<<"Upgrade">>},{<<"pragma">>,<<"no-cache">>},{<<"cache-control">>,<<"no-cache">>},{<<"user-agent">>,<<"Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1">>},{<<"upgrade">>,<<"websocket">>},{<<"origin">>,<<"http://localhost:8000">>},{<<"sec-websocket-version">>,<<"13">>},{<<"accept-encoding">>,<<"gzip, deflate, br">>},{<<"accept-language">>,<<"en-US,en;q=0.9">>},{<<"cookie">>,<<"fossil_display_settings=n%3D50%2Css%3Dx%2Cadvm%3D0%2Cy%3Dci">>},{<<"sec-websocket-key">>,<<"Sasj5q6ZCDzuG3IYu0qONg==">>},{<<"sec-websocket-extensions">>,<<"permessage-deflate; client_max_window_bits">>}]},{p_headers,[{<<"sec-websocket-extensions">>,[{<<"permessage-deflate">>,[<<"client_max_window_bits">>]}]},{<<"upgrade">>,[<<"websocket">>]},{<<"connection">>,[<<"upgrade">>]}]},{cookies,undefined},{meta,[{websocket_version,13},{websocket_compress,false}]},{body_state,waiting},{buffer,<<>>},{multipart,undefined},{resp_compress,false},{resp_state,waiting},{resp_headers,[]},{resp_body,<<>>},{onresponse,undefined}]},{opts,[]}],[{cowboy_websocket,handler_init,3,[{file,"src/cowboy_websocket.erl"},{line,149}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,442}]}]}

=ERROR REPORT==== 26-Dec-2018::16:12:20.309820 ===
Error in process <0.1501.0> on node 'myapp@127.0.0.1' with exit value:
{[{reason,function_clause},
{mfa,{cowboy_simple_bridge_anchor,websocket_init,3}},
{stacktrace,
[{simple_bridge,inner_make,2,
[{file,
"/home/fran/deploy_uber/web/lib/simple_bridge/src/simple_bridge.erl"},
{line,89}]},
{cowboy_simple_bridge_anchor,websocket_init,3,
[{file,
"/home/fran/deploy_uber/web/lib/simple_bridge/src/cowboy_bridge_modules/cowboy_simple_bridge_anchor.erl"},
{line,43}]},
{cowboy_websocket,handler_init,3,
[{file,"src/cowboy_websocket.erl"},{line,131}]},
{cowboy_protocol,execute,4,
[{file,"src/cowboy_protocol.erl"},{line,442}]}]},
{req,
[{socket,#Port<0.16>},
{transport,ranch_tcp},
{connection,keepalive},
{pid,<0.1501.0>},
{method,<<"GET">>},
{version,'HTTP/1.1'},
{peer,{{127,0,0,1},44600}},
{host,<<"localhost">>},
{host_info,undefined},
{port,8000},
{path,<<"/login">>},
{path_info,undefined},
{qs,<<>>},
{qs_vals,undefined},
{bindings,[]},
{headers,
[{<<"host">>,<<"localhost:8000">>},
{<<"connection">>,<<"Upgrade">>},
{<<"pragma">>,<<"no-cache">>},
{<<"cache-control">>,<<"no-cache">>},
{<<"user-agent">>,
<<"Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1">>},
{<<"upgrade">>,<<"websocket">>},
{<<"origin">>,<<"http://localhost:8000">>},
{<<"sec-websocket-version">>,<<"13">>},
{<<"accept-encoding">>,<<"gzip, deflate, br">>},
{<<"accept-language">>,<<"en-US,en;q=0.9">>},
{<<"cookie">>,
<<"fossil_display_settings=n%3D50%2Css%3Dx%2Cadvm%3D0%2Cy%3Dci">>},
{<<"sec-websocket-key">>,<<"Sasj5q6ZCDzuG3IYu0qONg==">>},
{<<"sec-websocket-extensions">>,
<<"permessage-deflate; client_max_window_bits">>}]},
{p_headers,
[{<<"sec-websocket-extensions">>,
[{<<"permessage-deflate">>,[<<"client_max_window_bits">>]}]},
{<<"upgrade">>,[<<"websocket">>]},
{<<"connection">>,[<<"upgrade">>]}]},
{cookies,undefined},
{meta,[{websocket_version,13},{websocket_compress,false}]},
{body_state,waiting},
{buffer,<<>>},
{multipart,undefined},
{resp_compress,false},
{resp_state,waiting},
{resp_headers,[]},
{resp_body,<<>>},
{onresponse,undefined}]},
{opts,[]}],
[{cowboy_websocket,handler_init,3,
[{file,"src/cowboy_websocket.erl"},{line,149}]},
{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,442}]}]}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions